Authored by qinchao

docker

@@ -16,10 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; @@ -16,10 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody;
16 import org.springframework.web.bind.annotation.RequestMapping; 16 import org.springframework.web.bind.annotation.RequestMapping;
17 import org.springframework.web.bind.annotation.ResponseBody; 17 import org.springframework.web.bind.annotation.ResponseBody;
18 18
19 -import java.util.ArrayList;  
20 -import java.util.HashMap;  
21 -import java.util.List;  
22 -import java.util.Map; 19 +import java.util.*;
23 20
24 @Controller 21 @Controller
25 @RequestMapping("/dockerMonitor") 22 @RequestMapping("/dockerMonitor")
@@ -55,6 +52,19 @@ public class DockerMonitorCtrl { @@ -55,6 +52,19 @@ public class DockerMonitorCtrl {
55 } 52 }
56 53
57 54
  55 + @RequestMapping("/getDockerClusterMap")
  56 + @ResponseBody
  57 + public BaseResponse<Map<String,String>> getDockerClusterMap() {
  58 + Map<String,String> map=new LinkedHashMap<>();
  59 + List<DockerMonitorClusterModel> ls = dockerMonitorClusterMapper.selectAll();
  60 + if(ls!=null&&ls.size()>0){
  61 + for(DockerMonitorClusterModel model:ls){
  62 + map.put(model.getClusterId(),model.getDescr());
  63 + }
  64 + }
  65 + return new BaseResponse(map);
  66 + }
  67 +
58 @RequestMapping("/getDockerService") 68 @RequestMapping("/getDockerService")
59 @ResponseBody 69 @ResponseBody
60 public BaseResponse<PageResponse<DockerMonitorServiceModel>> getDockerService(@RequestBody DockerInfoReq req) { 70 public BaseResponse<PageResponse<DockerMonitorServiceModel>> getDockerService(@RequestBody DockerInfoReq req) {
@@ -34,10 +34,14 @@ public class DockerServerDeployService { @@ -34,10 +34,14 @@ public class DockerServerDeployService {
34 List<String> ls=new ArrayList<>(); 34 List<String> ls=new ArrayList<>();
35 JSONObject searchResult=txServer.describeClusterNameSpaces(clusterId); 35 JSONObject searchResult=txServer.describeClusterNameSpaces(clusterId);
36 if(searchResult!=null&&searchResult.getInteger("code")!=null&& searchResult.getInteger("code").equals(NumberUtils.INTEGER_ZERO)){ 36 if(searchResult!=null&&searchResult.getInteger("code")!=null&& searchResult.getInteger("code").equals(NumberUtils.INTEGER_ZERO)){
37 - JSONArray jaServices=searchResult.getJSONObject("data").getJSONArray("namespaces");  
38 - for(int i=0;i<jaServices.size();i++){  
39 - ls.add(jaServices.getJSONObject(i).getString("name")); 37 + JSONObject dataJo=searchResult.getJSONObject("data");
  38 + if(dataJo!=null){
  39 + JSONArray jaServices=dataJo.getJSONArray("namespaces");
  40 + for(int i=0;i<jaServices.size();i++){
  41 + ls.add(jaServices.getJSONObject(i).getString("name"));
  42 + }
40 } 43 }
  44 +
41 } 45 }
42 return ls; 46 return ls;
43 } 47 }