Authored by qinchao

docker发布

... ... @@ -28,4 +28,5 @@ public class DockerProjectModel {
private String port;
private String autodeployflag;//支持自动发布--1支持,默认0不支持
private String projectType;
}
... ...
... ... @@ -8,7 +8,7 @@ import java.util.Set;
public class ProjectEnvironment {
private static String[] dockerEnvironments = {"yoho-online","yoho-gray"};
private static String[] dockerProjectJobTypes = {"Docker-Deploy-Node","Docker-Deploy-Java","Docker-Deploy-GitHook"};
private static String[] dockerProjectTypes = {"node","java","php","ops","other"};
private static Map<String,String> map = new HashMap<>();
static{
... ... @@ -35,8 +35,8 @@ public class ProjectEnvironment {
return dockerEnvironments;
}
public static String[] getDockerProjectJobTypes(){
return dockerProjectJobTypes;
public static String[] getDockerProjectTypes(){
return dockerProjectTypes;
}
}
... ...
... ... @@ -40,7 +40,7 @@ public class DockerBuildCtrl {
}
model.addAttribute("environments", ProjectEnvironment.getDockerEnvironments());
model.addAttribute("projectJobTypes", ProjectEnvironment.getDockerProjectJobTypes());
model.addAttribute("projectTypes", ProjectEnvironment.getDockerProjectTypes());
return new ModelAndView("project/docker_project");
}
... ... @@ -81,11 +81,11 @@ public class DockerBuildCtrl {
*/
@RequestMapping(value = "/getProjects")
@ResponseBody
public String getProjects(String projectJobType) {
public String getProjects(String projectType) {
try {
Map map = new HashMap<>();
map.put("projectJobType",projectJobType);
BaseResponse response=httpRestClient.defaultGet("/dockerProject/getDockerProjectByJobType", BaseResponse.class, map);
map.put("projectType",projectType);
BaseResponse response=httpRestClient.defaultGet("/dockerProject/getDockerProjectByProjectType", BaseResponse.class, map);
return JSONArray.toJSON(response.getData()).toString();
} catch (Exception ex) {
return "failed";
... ... @@ -161,7 +161,9 @@ public class DockerBuildCtrl {
@RequestMapping(value = "/toDockerInfoList")
public ModelAndView toDockerInfoList(DockerJenkinsReq dockerJenkinsReq) {
public ModelAndView toDockerInfoList(Model model,DockerJenkinsReq dockerJenkinsReq) {
model.addAttribute("projectTypes", ProjectEnvironment.getDockerProjectTypes());
model.addAttribute("projectJobTypes", httpRestClient.defaultGet("/dockerProject/getDockerProjectJobType",BaseResponse.class).getData());
return new ModelAndView("project/docker_info");
}
... ...
... ... @@ -95,13 +95,24 @@
<span class="input-group-addon">Docker项目名称:</span>
<input type="text" id="dockerProjectName_search" name="dockerProjectName_search" class="form-control" placeholder="" style="width: 180px"/>
</div>
<div class="input-group" style="float: left;">
<span class="input-group-addon">项目类型:</span>
<select class="form-control">
<option value="" selected="selected">所有类型</option>
<c:forEach items="${projectTypes }" var="projType" >
<option value="${projType }">${projType }</option>
</c:forEach>
</select>
</div>
<div class="input-group" style="float: left;">
<span class="input-group-addon">项目job类型:</span>
<select id="projectJobType_search" class="form-control">
<option value="" selected="selected">所有类型</option>
<option value="Docker-Deploy-Node">Docker-Deploy-Node</option>
<option value="Docker-Deploy-Java">Docker-Deploy-Java</option>
<option value="Docker-Deploy-GitHook">Docker-Deploy-GitHook</option>
<c:forEach items="${projectJobTypes }" var="projJobType" >
<option value="${projJobType }">${projJobType }</option>
</c:forEach>
</select>
</div>
... ... @@ -154,6 +165,10 @@
return rowIndex + 1;
}
},{
title : "项目类型",
field : "projectType",
width : "10%"
},{
title : "项目名称",
field : "projectName",
width : "10%"
... ...
... ... @@ -81,13 +81,13 @@
<label class="col-sm-1 control-label">项目类别</label>
<div class="col-sm-8">
<c:forEach items="${projectJobTypes }" var="projJobType" varStatus="projJobTypeStatus">
<div class="rdio rdio-default">
<input type="radio" name="projectJobTypes" id="${projJobType }" value="${projJobType }"
<c:forEach items="${projectTypes }" var="projType" varStatus="projTypeStatus">
<div class="rdio rdio-default" style='display: inline'>
<input type="radio" name="projectTypes" id="${projType }" value="${projType }"
onclick="getProjects()"
<c:if test="${projJobTypeStatus.index==0}">checked="checked"</c:if>
<c:if test="${projTypeStatus.index==0}">checked="checked"</c:if>
/>
<label for="${projJobType }">${projJobType }</label>
<label for="${projType }">${projType }</label>&nbsp;&nbsp;&nbsp;
</div>
</c:forEach>
</div>
... ... @@ -227,7 +227,7 @@
type: 'post',
url: contextPath + "dockerBuild/getProjects",
data: {
projectJobType:$("input[name='projectJobTypes']:checked").val()
projectType:$("input[name='projectTypes']:checked").val()
},
dataType: 'json',
success: function (data) {
... ...