Merge branch 'master' of http://git.yoho.cn/ops/monitor-ui into dev_master
Showing
7 changed files
with
25 additions
and
78 deletions
@@ -25,6 +25,7 @@ public class HostInfoReq extends PageRequest { | @@ -25,6 +25,7 @@ public class HostInfoReq extends PageRequest { | ||
25 | 25 | ||
26 | private int cloudDetailType; | 26 | private int cloudDetailType; |
27 | 27 | ||
28 | + private String tagids; | ||
28 | private String tags; | 29 | private String tags; |
29 | private List<String> tagsList; | 30 | private List<String> tagsList; |
30 | 31 |
@@ -8,6 +8,8 @@ import java.util.*; | @@ -8,6 +8,8 @@ import java.util.*; | ||
8 | * tag类型 | 8 | * tag类型 |
9 | */ | 9 | */ |
10 | public enum TagTypeEnum { | 10 | public enum TagTypeEnum { |
11 | + SYS("sys", "系统"), | ||
12 | + MODULE("mod", "模块"), | ||
11 | //CLOUD("cloud", "云类型"), | 13 | //CLOUD("cloud", "云类型"), |
12 | MIDDLEWARE("mid", "中间件"), | 14 | MIDDLEWARE("mid", "中间件"), |
13 | APPLICATION("app", "应用服务"), | 15 | APPLICATION("app", "应用服务"), |
@@ -39,7 +39,7 @@ public class HostGroupCtrl { | @@ -39,7 +39,7 @@ public class HostGroupCtrl { | ||
39 | HttpRestClient httpRestClient; | 39 | HttpRestClient httpRestClient; |
40 | 40 | ||
41 | @RequestMapping("/toHostGroup") | 41 | @RequestMapping("/toHostGroup") |
42 | - public ModelAndView getHostGroups(Map model) { | 42 | + public ModelAndView toHostGroup(Map model) { |
43 | model.put("tagTypeList",TagTypeEnum.getAllType()); | 43 | model.put("tagTypeList",TagTypeEnum.getAllType()); |
44 | model.put("tagTypeMapJson", JSON.toJSONString(TagTypeEnum.getAllTypeMap())); | 44 | model.put("tagTypeMapJson", JSON.toJSONString(TagTypeEnum.getAllTypeMap())); |
45 | return new ModelAndView("host/hostGroupList",model); | 45 | return new ModelAndView("host/hostGroupList",model); |
@@ -47,11 +47,11 @@ | @@ -47,11 +47,11 @@ | ||
47 | var hostIp=$("#hostInfoForm #hostIp").val(); | 47 | var hostIp=$("#hostInfoForm #hostIp").val(); |
48 | var cloudDetailType=$('#hostInfoForm #cloudDetailType option:selected').text(); | 48 | var cloudDetailType=$('#hostInfoForm #cloudDetailType option:selected').text(); |
49 | var tags=""; | 49 | var tags=""; |
50 | - $("input[name='appName']:checked").each(function(){ | 50 | + /*$("input[name='appName']:checked").each(function(){ |
51 | if(tags.indexOf($(this).attr('value')+'-')<0){ | 51 | if(tags.indexOf($(this).attr('value')+'-')<0){ |
52 | tags += $(this).attr('value')+'-'; | 52 | tags += $(this).attr('value')+'-'; |
53 | } | 53 | } |
54 | - }); | 54 | + });*/ |
55 | $("#hostInfoForm #alias").val(cloudDetailType+"-"+tags+hostIp); | 55 | $("#hostInfoForm #alias").val(cloudDetailType+"-"+tags+hostIp); |
56 | } | 56 | } |
57 | 57 | ||
@@ -61,36 +61,6 @@ | @@ -61,36 +61,6 @@ | ||
61 | } | 61 | } |
62 | 62 | ||
63 | $(function () { | 63 | $(function () { |
64 | - /*$.ajax({ | ||
65 | - url : contextPath +"/hostGroup/getAllTagsGroupByType", | ||
66 | - type : 'post', | ||
67 | - async : false, | ||
68 | - dataType : "json", | ||
69 | - success : function(data) { | ||
70 | - var contentHtml=''; | ||
71 | - contentHtml += "<table border=1>"; | ||
72 | - | ||
73 | - for (var key in tagTypes) { | ||
74 | - contentHtml += "<tr>"; | ||
75 | - contentHtml += "<td width='60'>"; | ||
76 | - contentHtml += tagTypes[key] ; | ||
77 | - contentHtml += "</td>"; | ||
78 | - contentHtml += "<td>"; | ||
79 | - $.each(data.data[key],function(n,value) { | ||
80 | - if(n>0&&n%6==0){ | ||
81 | - contentHtml+='</br>'; | ||
82 | - } | ||
83 | - contentHtml+='<input type="checkbox" name="appName" onchange="autoHostName();" value="'+value.groupName+'">' +value.groupName+' '; | ||
84 | - }); | ||
85 | - contentHtml += "</td>"; | ||
86 | - contentHtml += "</tr>"; | ||
87 | - } | ||
88 | - contentHtml += "</table>"; | ||
89 | - $("#hostInfoForm #appNameContent").html(contentHtml); | ||
90 | - } | ||
91 | - });*/ | ||
92 | - | ||
93 | - | ||
94 | $.ajax({ | 64 | $.ajax({ |
95 | url : contextPath +"/hostGroup/getAllTagsGroupTreegridByType", | 65 | url : contextPath +"/hostGroup/getAllTagsGroupTreegridByType", |
96 | type : 'post', | 66 | type : 'post', |
@@ -153,7 +123,7 @@ | @@ -153,7 +123,7 @@ | ||
153 | if(n>0&&n%6==0){ | 123 | if(n>0&&n%6==0){ |
154 | contentHtml+='</br>'; | 124 | contentHtml+='</br>'; |
155 | } | 125 | } |
156 | - contentHtml+='<input type="checkbox" name="appName" onchange="autoHostName();" value="'+value.groupName+'">' +value.groupName+' '; | 126 | + contentHtml+='<input type="checkbox" name="appName" onchange="autoHostName();" text="'+value.groupName+'" value="'+value.id+'">' +value.groupName+' '; |
157 | if(value.children!=null&&value.children.length>0){ | 127 | if(value.children!=null&&value.children.length>0){ |
158 | contentHtml += constructTr(value.children); | 128 | contentHtml += constructTr(value.children); |
159 | } | 129 | } |
@@ -351,30 +351,24 @@ | @@ -351,30 +351,24 @@ | ||
351 | btn.removeAttr("disabled"); | 351 | btn.removeAttr("disabled"); |
352 | return; | 352 | return; |
353 | } | 353 | } |
354 | + var tagids=""; | ||
354 | var tags=""; | 355 | var tags=""; |
355 | $("#hostInfoForm input[name='appName']:checked").each(function(){ | 356 | $("#hostInfoForm input[name='appName']:checked").each(function(){ |
356 | - if(tags.indexOf($(this).attr('value')+',')<0){ | ||
357 | - tags += $(this).attr('value')+','; | 357 | + if(tagids.indexOf($(this).attr('value')+',')<0){ |
358 | + tagids += $(this).attr('value')+','; | ||
359 | + } | ||
360 | + if(tags.indexOf($(this).attr('text')+',')<0){ | ||
361 | + tags += $(this).attr('text')+','; | ||
358 | } | 362 | } |
359 | }); | 363 | }); |
360 | var cloudDetailType = $("#hostInfoForm #cloudDetailType").val(); | 364 | var cloudDetailType = $("#hostInfoForm #cloudDetailType").val(); |
361 | var cloudType = 2; | 365 | var cloudType = 2; |
362 | if(cloudDetailType == 1){ | 366 | if(cloudDetailType == 1){ |
363 | cloudType = 1; | 367 | cloudType = 1; |
364 | - }/*else if(cloudDetailType == 21||cloudDetailType == 22){ | ||
365 | - cloudType= cloudDetailType - 20 ; | ||
366 | - }*/ | ||
367 | - | ||
368 | - /*if(cloudType<=0){ | ||
369 | - $("#hostInfoForm #messageAlert").alerts({ | ||
370 | - content : "请选择正确的云可用区类型!", | ||
371 | - type : "danger" | ||
372 | - }); | ||
373 | - }*/ | 368 | + } |
374 | 369 | ||
375 | var alias = $("#hostInfoForm #alias").val(); | 370 | var alias = $("#hostInfoForm #alias").val(); |
376 | 371 | ||
377 | - | ||
378 | //提交之前表单验证 | 372 | //提交之前表单验证 |
379 | if (!$("#hostInfoForm").form("validate")) { | 373 | if (!$("#hostInfoForm").form("validate")) { |
380 | btn.removeAttr("disabled"); | 374 | btn.removeAttr("disabled"); |
@@ -383,6 +377,7 @@ | @@ -383,6 +377,7 @@ | ||
383 | //提交表单--改成ajax方式 | 377 | //提交表单--改成ajax方式 |
384 | var submitData = { | 378 | var submitData = { |
385 | id : hoseInfoId, | 379 | id : hoseInfoId, |
380 | + tagids:tagids, | ||
386 | tags:tags, | 381 | tags:tags, |
387 | hostIp:hostIp, | 382 | hostIp:hostIp, |
388 | cloudType:cloudType, | 383 | cloudType:cloudType, |
@@ -412,33 +407,6 @@ | @@ -412,33 +407,6 @@ | ||
412 | localAlert('系统异常',data.message); | 407 | localAlert('系统异常',data.message); |
413 | } | 408 | } |
414 | }); | 409 | }); |
415 | - | ||
416 | - | ||
417 | - /* $("#hostInfoForm").form("submit", { | ||
418 | - submitUrl : "saveHostInfo.do", | ||
419 | - submitData : { | ||
420 | - id : hoseInfoId, | ||
421 | - tags:tags | ||
422 | - }, | ||
423 | - onBeforeSubmit : function() { | ||
424 | - if (!$(this).form("validate")) { | ||
425 | - btn.removeAttr("disabled"); | ||
426 | - return false; | ||
427 | - } | ||
428 | - }, | ||
429 | - success : function(data) { | ||
430 | - if (!data || data.code != 200) { | ||
431 | - btn.removeAttr("disabled"); | ||
432 | - $("#hostInfoForm #messageAlert").alerts({ | ||
433 | - content : data.message, | ||
434 | - type : "danger" | ||
435 | - }); | ||
436 | - return; | ||
437 | - } | ||
438 | - $("#hostInfoTable").table("load"); | ||
439 | - $(dialog).dialog("hide"); | ||
440 | - } | ||
441 | - });*/ | ||
442 | } | 410 | } |
443 | }] | 411 | }] |
444 | }); | 412 | }); |
@@ -480,10 +448,14 @@ | @@ -480,10 +448,14 @@ | ||
480 | className : "btn-success", | 448 | className : "btn-success", |
481 | onclick : function() { | 449 | onclick : function() { |
482 | var btn = $(this); | 450 | var btn = $(this); |
451 | + var tagids=""; | ||
483 | var tags=""; | 452 | var tags=""; |
484 | $("#tagsInfoForm input[name='appName']:checked").each(function(){ | 453 | $("#tagsInfoForm input[name='appName']:checked").each(function(){ |
485 | - if(tags.indexOf($(this).attr('value')+',')<0){ | ||
486 | - tags += $(this).attr('value')+','; | 454 | + if(tagids.indexOf($(this).attr('value')+',')<0){ |
455 | + tagids += $(this).attr('value')+','; | ||
456 | + } | ||
457 | + if(tags.indexOf($(this).attr('text')+',')<0){ | ||
458 | + tags += $(this).attr('text')+','; | ||
487 | } | 459 | } |
488 | }); | 460 | }); |
489 | if(paramObj.hostIds == null || paramObj.hostIds.length == 0){ | 461 | if(paramObj.hostIds == null || paramObj.hostIds.length == 0){ |
@@ -494,7 +466,7 @@ | @@ -494,7 +466,7 @@ | ||
494 | }); | 466 | }); |
495 | return; | 467 | return; |
496 | } | 468 | } |
497 | - if (tags == null || tags =="") { | 469 | + if (tags == null || tags ==""|| tagids ==""|| tagids =="") { |
498 | btn.removeAttr("disabled"); | 470 | btn.removeAttr("disabled"); |
499 | $("#tagsInfoForm #messageAlert").alerts({ | 471 | $("#tagsInfoForm #messageAlert").alerts({ |
500 | content : "请至少选择一个标签!", | 472 | content : "请至少选择一个标签!", |
@@ -510,6 +482,7 @@ | @@ -510,6 +482,7 @@ | ||
510 | async : false, | 482 | async : false, |
511 | data : { | 483 | data : { |
512 | hostIds : JSON.stringify(paramObj.hostIds), | 484 | hostIds : JSON.stringify(paramObj.hostIds), |
485 | + tagids:tagids, | ||
513 | tags:tags | 486 | tags:tags |
514 | }, | 487 | }, |
515 | dataType : "json", | 488 | dataType : "json", |
@@ -176,7 +176,7 @@ | @@ -176,7 +176,7 @@ | ||
176 | if(n>0&&n%6==0){ | 176 | if(n>0&&n%6==0){ |
177 | contentHtml+='</br>'; | 177 | contentHtml+='</br>'; |
178 | } | 178 | } |
179 | - contentHtml+='<input type="checkbox" name="appName" onchange="autoHostName();" value="'+value.groupName+'">' +value.groupName+' '; | 179 | + contentHtml+='<input type="checkbox" name="appName" onchange="autoHostName();" text="'+value.groupName+'" value="'+value.id+'">' +value.groupName+' '; |
180 | if(value.children!=null&&value.children.length>0){ | 180 | if(value.children!=null&&value.children.length>0){ |
181 | contentHtml += constructTr(value.children); | 181 | contentHtml += constructTr(value.children); |
182 | } | 182 | } |
-
Please register or login to post a comment