Authored by mlge

Merge branch 'master' of http://git.yoho.cn/ops/monitor-ui into dev_master

... ... @@ -25,6 +25,7 @@ public class HostInfoReq extends PageRequest {
private int cloudDetailType;
private String tagids;
private String tags;
private List<String> tagsList;
... ...
... ... @@ -9,4 +9,5 @@ import lombok.Data;
public class SetHostTagsReq {
private String hostIds;
private String tags;
private String tagids;
}
... ...
... ... @@ -8,6 +8,8 @@ import java.util.*;
* tag类型
*/
public enum TagTypeEnum {
SYS("sys", "系统"),
MODULE("mod", "模块"),
//CLOUD("cloud", "云类型"),
MIDDLEWARE("mid", "中间件"),
APPLICATION("app", "应用服务"),
... ...
... ... @@ -39,7 +39,7 @@ public class HostGroupCtrl {
HttpRestClient httpRestClient;
@RequestMapping("/toHostGroup")
public ModelAndView getHostGroups(Map model) {
public ModelAndView toHostGroup(Map model) {
model.put("tagTypeList",TagTypeEnum.getAllType());
model.put("tagTypeMapJson", JSON.toJSONString(TagTypeEnum.getAllTypeMap()));
return new ModelAndView("host/hostGroupList",model);
... ...
... ... @@ -47,11 +47,11 @@
var hostIp=$("#hostInfoForm #hostIp").val();
var cloudDetailType=$('#hostInfoForm #cloudDetailType option:selected').text();
var tags="";
$("input[name='appName']:checked").each(function(){
/*$("input[name='appName']:checked").each(function(){
if(tags.indexOf($(this).attr('value')+'-')<0){
tags += $(this).attr('value')+'-';
}
});
});*/
$("#hostInfoForm #alias").val(cloudDetailType+"-"+tags+hostIp);
}
... ... @@ -61,36 +61,6 @@
}
$(function () {
/*$.ajax({
url : contextPath +"/hostGroup/getAllTagsGroupByType",
type : 'post',
async : false,
dataType : "json",
success : function(data) {
var contentHtml='';
contentHtml += "<table border=1>";
for (var key in tagTypes) {
contentHtml += "<tr>";
contentHtml += "<td width='60'>";
contentHtml += tagTypes[key] ;
contentHtml += "</td>";
contentHtml += "<td>";
$.each(data.data[key],function(n,value) {
if(n>0&&n%6==0){
contentHtml+='</br>';
}
contentHtml+='<input type="checkbox" name="appName" onchange="autoHostName();" value="'+value.groupName+'">' +value.groupName+'&nbsp;&nbsp;';
});
contentHtml += "</td>";
contentHtml += "</tr>";
}
contentHtml += "</table>";
$("#hostInfoForm #appNameContent").html(contentHtml);
}
});*/
$.ajax({
url : contextPath +"/hostGroup/getAllTagsGroupTreegridByType",
type : 'post',
... ... @@ -153,7 +123,7 @@
if(n>0&&n%6==0){
contentHtml+='</br>';
}
contentHtml+='<input type="checkbox" name="appName" onchange="autoHostName();" value="'+value.groupName+'">' +value.groupName+'&nbsp;&nbsp;';
contentHtml+='<input type="checkbox" name="appName" onchange="autoHostName();" text="'+value.groupName+'" value="'+value.id+'">' +value.groupName+'&nbsp;&nbsp;';
if(value.children!=null&&value.children.length>0){
contentHtml += constructTr(value.children);
}
... ...
... ... @@ -351,30 +351,24 @@
btn.removeAttr("disabled");
return;
}
var tagids="";
var tags="";
$("#hostInfoForm input[name='appName']:checked").each(function(){
if(tags.indexOf($(this).attr('value')+',')<0){
tags += $(this).attr('value')+',';
if(tagids.indexOf($(this).attr('value')+',')<0){
tagids += $(this).attr('value')+',';
}
if(tags.indexOf($(this).attr('text')+',')<0){
tags += $(this).attr('text')+',';
}
});
var cloudDetailType = $("#hostInfoForm #cloudDetailType").val();
var cloudType = 2;
if(cloudDetailType == 1){
cloudType = 1;
}/*else if(cloudDetailType == 21||cloudDetailType == 22){
cloudType= cloudDetailType - 20 ;
}*/
/*if(cloudType<=0){
$("#hostInfoForm #messageAlert").alerts({
content : "请选择正确的云可用区类型!",
type : "danger"
});
}*/
}
var alias = $("#hostInfoForm #alias").val();
//提交之前表单验证
if (!$("#hostInfoForm").form("validate")) {
btn.removeAttr("disabled");
... ... @@ -383,6 +377,7 @@
//提交表单--改成ajax方式
var submitData = {
id : hoseInfoId,
tagids:tagids,
tags:tags,
hostIp:hostIp,
cloudType:cloudType,
... ... @@ -412,33 +407,6 @@
localAlert('系统异常',data.message);
}
});
/* $("#hostInfoForm").form("submit", {
submitUrl : "saveHostInfo.do",
submitData : {
id : hoseInfoId,
tags:tags
},
onBeforeSubmit : function() {
if (!$(this).form("validate")) {
btn.removeAttr("disabled");
return false;
}
},
success : function(data) {
if (!data || data.code != 200) {
btn.removeAttr("disabled");
$("#hostInfoForm #messageAlert").alerts({
content : data.message,
type : "danger"
});
return;
}
$("#hostInfoTable").table("load");
$(dialog).dialog("hide");
}
});*/
}
}]
});
... ... @@ -480,10 +448,14 @@
className : "btn-success",
onclick : function() {
var btn = $(this);
var tagids="";
var tags="";
$("#tagsInfoForm input[name='appName']:checked").each(function(){
if(tags.indexOf($(this).attr('value')+',')<0){
tags += $(this).attr('value')+',';
if(tagids.indexOf($(this).attr('value')+',')<0){
tagids += $(this).attr('value')+',';
}
if(tags.indexOf($(this).attr('text')+',')<0){
tags += $(this).attr('text')+',';
}
});
if(paramObj.hostIds == null || paramObj.hostIds.length == 0){
... ... @@ -494,7 +466,7 @@
});
return;
}
if (tags == null || tags =="") {
if (tags == null || tags ==""|| tagids ==""|| tagids =="") {
btn.removeAttr("disabled");
$("#tagsInfoForm #messageAlert").alerts({
content : "请至少选择一个标签!",
... ... @@ -510,6 +482,7 @@
async : false,
data : {
hostIds : JSON.stringify(paramObj.hostIds),
tagids:tagids,
tags:tags
},
dataType : "json",
... ...
... ... @@ -176,7 +176,7 @@
if(n>0&&n%6==0){
contentHtml+='</br>';
}
contentHtml+='<input type="checkbox" name="appName" onchange="autoHostName();" value="'+value.groupName+'">' +value.groupName+'&nbsp;&nbsp;';
contentHtml+='<input type="checkbox" name="appName" onchange="autoHostName();" text="'+value.groupName+'" value="'+value.id+'">' +value.groupName+'&nbsp;&nbsp;';
if(value.children!=null&&value.children.length>0){
contentHtml += constructTr(value.children);
}
... ...