...
|
...
|
@@ -21,6 +21,7 @@ import org.springframework.ui.Model; |
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
import java.util.*;
|
|
|
|
...
|
...
|
@@ -33,6 +34,22 @@ public class DockerBuildCtrl { |
|
|
@Autowired
|
|
|
private HttpRestClient httpRestClient;
|
|
|
|
|
|
private Map<String,String> dockerClusterMapCache;
|
|
|
|
|
|
@PostConstruct
|
|
|
private Map<String,String> initDockerClusterMap(){
|
|
|
BaseResponse rtn= httpRestClient.defaultPost("/dockerMonitor/getDockerClusterMap",null,BaseResponse.class);
|
|
|
if(rtn!=null&&200==rtn.getCode()&&null!=rtn.getData()){
|
|
|
try{
|
|
|
dockerClusterMapCache = (Map<String,String>)rtn.getData();
|
|
|
}catch (Exception e){
|
|
|
log.error("dockerClusterMapCache get error {}",e);
|
|
|
dockerClusterMapCache = null;
|
|
|
}
|
|
|
}
|
|
|
return dockerClusterMapCache;
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/toProject")
|
|
|
public ModelAndView toProject(Model model,String workJobId) {
|
|
|
if(StringUtils.isNotBlank(workJobId)){
|
...
|
...
|
@@ -265,11 +282,11 @@ public class DockerBuildCtrl { |
|
|
BaseResponse rtn= httpRestClient.defaultPost("/dockerProject/queryDockerServerStatus",dockerJenkinsReq,BaseResponse.class);
|
|
|
if(rtn!=null&&200==rtn.getCode()){
|
|
|
Map<String,Object> map= (Map<String,Object>)rtn.getData();
|
|
|
Map<String,String> tmpMap = (Map<String,String>)map.get("resultMap");
|
|
|
Map<String,String> descMap = (Map<String,String>)map.get("resultDescMap");
|
|
|
Map<String,String> clusterMap=this.getDockerClusterMap();
|
|
|
StringBuilder sb=new StringBuilder();
|
|
|
for(String key:tmpMap.keySet()){
|
|
|
sb.append(clusterMap.get(key)).append(":").append(tmpMap.get(key)).append(";");
|
|
|
for(String key:descMap.keySet()){
|
|
|
sb.append(clusterMap.get(key)).append(":").append(descMap.get(key)).append(";");
|
|
|
}
|
|
|
map.put("resultMessage",sb.toString());
|
|
|
}
|
...
|
...
|
@@ -277,8 +294,12 @@ public class DockerBuildCtrl { |
|
|
}
|
|
|
|
|
|
public Map<String,String> getDockerClusterMap(){
|
|
|
BaseResponse rtn= httpRestClient.defaultPost("/dockerMonitor/getDockerClusterMap",null,BaseResponse.class);
|
|
|
return (Map<String,String>)rtn.getData();
|
|
|
if(dockerClusterMapCache==null){
|
|
|
return initDockerClusterMap();
|
|
|
}
|
|
|
return dockerClusterMapCache;
|
|
|
//BaseResponse rtn= httpRestClient.defaultPost("/dockerMonitor/getDockerClusterMap",null,BaseResponse.class);
|
|
|
//return (Map<String,String>)rtn.getData();
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
|