Showing
4 changed files
with
39 additions
and
29 deletions
@@ -18,6 +18,9 @@ public class HostInfo implements Serializable { | @@ -18,6 +18,9 @@ public class HostInfo implements Serializable { | ||
18 | 18 | ||
19 | private int cloudType; | 19 | private int cloudType; |
20 | 20 | ||
21 | + //云可用区类型,aws还是aws,而腾讯云分为腾讯云 和 腾讯云az2 | ||
22 | + private int cloudDetailType; | ||
23 | + | ||
21 | private String tags; | 24 | private String tags; |
22 | 25 | ||
23 | private String createTime; | 26 | private String createTime; |
@@ -28,7 +28,6 @@ import java.util.Map; | @@ -28,7 +28,6 @@ import java.util.Map; | ||
28 | @Controller | 28 | @Controller |
29 | @RequestMapping("javaApi") | 29 | @RequestMapping("javaApi") |
30 | public class JavaAPICtrl { | 30 | public class JavaAPICtrl { |
31 | - Logger log = LoggerFactory.getLogger(JavaAPICtrl.class); | ||
32 | @Autowired | 31 | @Autowired |
33 | private HttpRestClient httpClient; | 32 | private HttpRestClient httpClient; |
34 | 33 | ||
@@ -51,13 +50,7 @@ public class JavaAPICtrl { | @@ -51,13 +50,7 @@ public class JavaAPICtrl { | ||
51 | @ResponseBody | 50 | @ResponseBody |
52 | public String getJavaApiInfo() { | 51 | public String getJavaApiInfo() { |
53 | String strType = ""; | 52 | String strType = ""; |
54 | - | ||
55 | - log.debug("get all type"); | ||
56 | - | ||
57 | strType = httpClient.defaultGet(HttpUriContants.JAVA_API_GET, String.class); | 53 | strType = httpClient.defaultGet(HttpUriContants.JAVA_API_GET, String.class); |
58 | - | ||
59 | - log.info("all type: {}", strType); | ||
60 | - | ||
61 | return strType; | 54 | return strType; |
62 | } | 55 | } |
63 | 56 | ||
@@ -73,7 +66,6 @@ public class JavaAPICtrl { | @@ -73,7 +66,6 @@ public class JavaAPICtrl { | ||
73 | @RequestMapping("/save") | 66 | @RequestMapping("/save") |
74 | @ResponseBody | 67 | @ResponseBody |
75 | public BaseResponse saveApiInfo(JavaApiInfoReq req) { | 68 | public BaseResponse saveApiInfo(JavaApiInfoReq req) { |
76 | - log.info("java api save req : {}", req); | ||
77 | BaseResponse rep = httpClient.defaultPost(HttpUriContants.JAVA_API_SAVE, req, BaseResponse.class); | 69 | BaseResponse rep = httpClient.defaultPost(HttpUriContants.JAVA_API_SAVE, req, BaseResponse.class); |
78 | return rep; | 70 | return rep; |
79 | } | 71 | } |
@@ -82,7 +74,6 @@ public class JavaAPICtrl { | @@ -82,7 +74,6 @@ public class JavaAPICtrl { | ||
82 | @RequestMapping("/del") | 74 | @RequestMapping("/del") |
83 | @ResponseBody | 75 | @ResponseBody |
84 | public BaseResponse delApiInfo(@RequestParam int id) { | 76 | public BaseResponse delApiInfo(@RequestParam int id) { |
85 | - log.info("java api del id : {}", id); | ||
86 | BaseResponse rep = httpClient.defaultGet(HttpUriContants.JAVA_API_DEL + "?id=" + id, BaseResponse.class); | 77 | BaseResponse rep = httpClient.defaultGet(HttpUriContants.JAVA_API_DEL + "?id=" + id, BaseResponse.class); |
87 | return rep; | 78 | return rep; |
88 | } | 79 | } |
@@ -91,7 +82,6 @@ public class JavaAPICtrl { | @@ -91,7 +82,6 @@ public class JavaAPICtrl { | ||
91 | @RequestMapping("/status") | 82 | @RequestMapping("/status") |
92 | @ResponseBody | 83 | @ResponseBody |
93 | public BaseResponse status(@RequestParam("list") String strList) { | 84 | public BaseResponse status(@RequestParam("list") String strList) { |
94 | - log.info("status req : {}", strList); | ||
95 | BaseResponse rep; | 85 | BaseResponse rep; |
96 | try { | 86 | try { |
97 | List<JavaApiStatusReq> req = JSON.parseArray(strList, JavaApiStatusReq.class); | 87 | List<JavaApiStatusReq> req = JSON.parseArray(strList, JavaApiStatusReq.class); |
@@ -147,7 +137,7 @@ public class JavaAPICtrl { | @@ -147,7 +137,7 @@ public class JavaAPICtrl { | ||
147 | @RequestMapping("/allStatus") | 137 | @RequestMapping("/allStatus") |
148 | @ResponseBody | 138 | @ResponseBody |
149 | public BaseResponse allStatus() { | 139 | public BaseResponse allStatus() { |
150 | - log.info("get allStatus"); | 140 | + //log.info("get allStatus"); |
151 | BaseResponse rep; | 141 | BaseResponse rep; |
152 | try { | 142 | try { |
153 | rep = httpClient.defaultGet(HttpUriContants.JAVA_API_STATUS_ALL, BaseResponse.class); | 143 | rep = httpClient.defaultGet(HttpUriContants.JAVA_API_STATUS_ALL, BaseResponse.class); |
@@ -9,12 +9,12 @@ | @@ -9,12 +9,12 @@ | ||
9 | </div> | 9 | </div> |
10 | 10 | ||
11 | <div class="form-group" > | 11 | <div class="form-group" > |
12 | - <label class="col-sm-2 control-label"> <span style="color:red">*</span>云类型:</label> | 12 | + <label class="col-sm-2 control-label"> <span style="color:red">*</span>云可用区:</label> |
13 | <div class="col-sm-8"> | 13 | <div class="col-sm-8"> |
14 | - <select id="cloudType" name="cloudType" class="form-control" onchange="autoHostName();"> | 14 | + <select id="cloudDetailType" name="cloudDetailType" class="form-control" onchange="autoHostName();"> |
15 | <option value="1">AWS</option> | 15 | <option value="1">AWS</option> |
16 | - <option value="2">腾讯云</option> | ||
17 | - <option value="3">腾讯云az2</option> | 16 | + <option value="21">腾讯云</option> |
17 | + <option value="22">腾讯云az2</option> | ||
18 | </select> | 18 | </select> |
19 | </div> | 19 | </div> |
20 | </div> | 20 | </div> |
@@ -44,14 +44,14 @@ | @@ -44,14 +44,14 @@ | ||
44 | 44 | ||
45 | function autoHostName(){ | 45 | function autoHostName(){ |
46 | var hostIp=$("#hostInfoForm #hostIp").val(); | 46 | var hostIp=$("#hostInfoForm #hostIp").val(); |
47 | - var cloudType=$('#hostInfoForm #cloudType option:selected').text(); | 47 | + var cloudDetailType=$('#hostInfoForm #cloudDetailType option:selected').text(); |
48 | var tags=""; | 48 | var tags=""; |
49 | $("input[name='appName']:checked").each(function(){ | 49 | $("input[name='appName']:checked").each(function(){ |
50 | if(tags.indexOf($(this).attr('value')+'-')<0){ | 50 | if(tags.indexOf($(this).attr('value')+'-')<0){ |
51 | tags += $(this).attr('value')+'-'; | 51 | tags += $(this).attr('value')+'-'; |
52 | } | 52 | } |
53 | }); | 53 | }); |
54 | - $("#hostInfoForm #alias").val(cloudType+"-"+tags+hostIp); | 54 | + $("#hostInfoForm #alias").val(cloudDetailType+"-"+tags+hostIp); |
55 | } | 55 | } |
56 | 56 | ||
57 | function endWithChars(str,endStr){ | 57 | function endWithChars(str,endStr){ |
@@ -97,12 +97,12 @@ | @@ -97,12 +97,12 @@ | ||
97 | <input type="text" id="hostIp" name="hostIp" class="form-control" placeholder="" style="width: 230px"/> | 97 | <input type="text" id="hostIp" name="hostIp" class="form-control" placeholder="" style="width: 230px"/> |
98 | </div> | 98 | </div> |
99 | <div class="input-group" style="float: left;"> | 99 | <div class="input-group" style="float: left;"> |
100 | - <span class="input-group-addon">云类型:</span> | ||
101 | - <select id="cloudType" name="cloudType" class="form-control"> | ||
102 | - <option value="0">全部</option> | 100 | + <span class="input-group-addon">云可用区:</span> |
101 | + <select id="cloudDetailType" name="cloudDetailType" class="form-control"> | ||
102 | + <option value="">全部</option> | ||
103 | <option value="1">AWS</option> | 103 | <option value="1">AWS</option> |
104 | - <option value="2">腾讯云</option> | ||
105 | - <option value="3">腾讯云az2</option> | 104 | + <option value="21">腾讯云</option> |
105 | + <option value="22">腾讯云az2</option> | ||
106 | <%--<option value="3">其他</option>--%> | 106 | <%--<option value="3">其他</option>--%> |
107 | </select> | 107 | </select> |
108 | </div> | 108 | </div> |
@@ -214,15 +214,17 @@ | @@ -214,15 +214,17 @@ | ||
214 | field : "hostIp", | 214 | field : "hostIp", |
215 | width : "10%" | 215 | width : "10%" |
216 | }, { | 216 | }, { |
217 | - title : "云类型", | ||
218 | - field : "cloudType", | 217 | + title : "云可用区", |
218 | + field : "cloudDetailType", | ||
219 | formatter : function(value, rowData, rowIndex) { | 219 | formatter : function(value, rowData, rowIndex) { |
220 | if(value == 1){ | 220 | if(value == 1){ |
221 | return 'AWS'; | 221 | return 'AWS'; |
222 | - } else if(value == 2){ | 222 | + } else if(value == 21){ |
223 | return '腾讯云'; | 223 | return '腾讯云'; |
224 | + }else if(value == 22){ | ||
225 | + return '腾讯云az2'; | ||
224 | }else{ | 226 | }else{ |
225 | - return '其他'; | 227 | + return value; |
226 | } | 228 | } |
227 | }, | 229 | }, |
228 | width : "5%" | 230 | width : "5%" |
@@ -301,13 +303,13 @@ | @@ -301,13 +303,13 @@ | ||
301 | $("#searchHostInfoBtn").click(function () { | 303 | $("#searchHostInfoBtn").click(function () { |
302 | var alias = $("#alias").val(); | 304 | var alias = $("#alias").val(); |
303 | var hostIp = $("#hostIp").val(); | 305 | var hostIp = $("#hostIp").val(); |
304 | - var cloudType = $("#cloudType").val(); | 306 | + var cloudDetailType = $("#cloudDetailType").val(); |
305 | var tags=$("#tags").val(); | 307 | var tags=$("#tags").val(); |
306 | var onlyShowTagsIsNull=$("#tagsIsNull").val(); | 308 | var onlyShowTagsIsNull=$("#tagsIsNull").val(); |
307 | $("#hostInfoTable").table("load", { | 309 | $("#hostInfoTable").table("load", { |
308 | 'alias': alias, | 310 | 'alias': alias, |
309 | 'hostIp': $.trim(hostIp), | 311 | 'hostIp': $.trim(hostIp), |
310 | - 'cloudType': cloudType, | 312 | + 'cloudDetailType': cloudDetailType, |
311 | 'tags': JSON.stringify(tags), | 313 | 'tags': JSON.stringify(tags), |
312 | 'onlyShowTagsIsNull':onlyShowTagsIsNull | 314 | 'onlyShowTagsIsNull':onlyShowTagsIsNull |
313 | }); | 315 | }); |
@@ -351,7 +353,21 @@ | @@ -351,7 +353,21 @@ | ||
351 | tags += $(this).attr('value')+','; | 353 | tags += $(this).attr('value')+','; |
352 | } | 354 | } |
353 | }); | 355 | }); |
354 | - var cloudType = $("#hostInfoForm #cloudType").val(); | 356 | + var cloudDetailType = $("#hostInfoForm #cloudDetailType").val(); |
357 | + var cloudType=0; | ||
358 | + if(cloudDetailType==1){ | ||
359 | + cloudType=1; | ||
360 | + }else if(cloudDetailType==21||cloudDetailType==22){ | ||
361 | + cloudType= cloudDetailType - 20 ; | ||
362 | + } | ||
363 | + | ||
364 | + if(cloudType<=0){ | ||
365 | + $("#hostInfoForm #messageAlert").alerts({ | ||
366 | + content : "请选择正确的云可用区类型!", | ||
367 | + type : "danger" | ||
368 | + }); | ||
369 | + } | ||
370 | + | ||
355 | var alias = $("#hostInfoForm #alias").val(); | 371 | var alias = $("#hostInfoForm #alias").val(); |
356 | 372 | ||
357 | 373 | ||
@@ -366,6 +382,7 @@ | @@ -366,6 +382,7 @@ | ||
366 | tags:tags, | 382 | tags:tags, |
367 | hostIp:hostIp, | 383 | hostIp:hostIp, |
368 | cloudType:cloudType, | 384 | cloudType:cloudType, |
385 | + cloudDetailType:cloudDetailType, | ||
369 | alias:alias | 386 | alias:alias |
370 | }; | 387 | }; |
371 | 388 |
-
Please register or login to post a comment