Authored by qinchao

主机管理

... ... @@ -6,6 +6,12 @@ import lombok.Data;
public class TypeInfoReq {
private int typeId;
private String typeName;
private int typeIsLeaf;
private int typeParentId;
private String tags;//主机标签
private String descr;//节点的特殊信息
... ...
... ... @@ -4,6 +4,7 @@ import com.ui.http.HttpRestClient;
import com.ui.model.BaseResponse;
import com.ui.model.req.MObjectHostInfoReq;
import com.ui.model.req.MObjectInfoReq;
import com.ui.model.req.TypeInfoReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
... ... @@ -61,6 +62,12 @@ public class MObjectInfoCtrl {
return response;
}
@RequestMapping(value = "/asyMobjectHost")
public BaseResponse asyMobjectHost(int moTypeId) {
BaseResponse response = httpRestClient.defaultGet("/mobject/asyMobjectHost?moTypeId="+moTypeId, BaseResponse.class);
return response;
}
@RequestMapping(value = "/queryHost")
public BaseResponse queryMHostInfo(MObjectHostInfoReq request) {
... ... @@ -75,4 +82,6 @@ public class MObjectInfoCtrl {
BaseResponse response = httpRestClient.defaultGet("/mobject/javaapi", BaseResponse.class);
return response;
}
}
... ...
... ... @@ -105,7 +105,7 @@
contentHtml += "</td>";
contentHtml += "<td>";
if(key=="app"||key=="mid"){
contentHtml += constructTrLevel2(data.data[key],1);
contentHtml += constructTr(data.data[key],1);
}else{
contentHtml += constructTr(data.data[key]);
}
... ...
... ... @@ -312,6 +312,15 @@
var treeGrid = new TreeGrid(config);
treeGrid.show();
var TAG = "N";
$("#hostGroupTable").find("tr").each(function(i, e){
var id = $(e).attr('id');
var pid = $(e).attr('data-pid');
$(e).attr('data-open', TAG);
if(id != undefined && pid == 0){
showHiddenNode(id, TAG);
}
})
}
$(function () {
... ...
... ... @@ -83,7 +83,7 @@
contentHtml += "</td>";
contentHtml += "<td>";
if(key=="app"||key=="mid"){
contentHtml += constructTrLevel2(data.data[key],1);
contentHtml += constructTr(data.data[key],1);
}else{
contentHtml += constructTr(data.data[key]);
}
... ...
... ... @@ -389,6 +389,12 @@
tagUpdate(rowData);
});
//同步监控主机
var asyBtn = $("<button>").addClass("btn btn-xs btn-success").html("同步主机").appendTo(div);
asyBtn.click(function () {
asyMobjectHost(rowData);
});
div.append("&nbsp;");
div.append("&nbsp;");
div.append("&nbsp;");
... ... @@ -399,6 +405,36 @@
});
});
//同步监控主机
function asyMobjectHost(rowData){
$.ajax({
url : contextPath +"mobject/asyMobjectHost.do",
type : 'post',
async : false,
data : {
moTypeId: rowData.id,
},
dataType : "json",
success : function(data) {
if( data && data.code == 200){
$(dialog).dialog("hide");
$('#jstree').jstree().get_node("node_" + rowData.id).data.descr = $("#tagsInfoForm textarea[name='descr']").val();
$('#jstree').jstree().get_node("node_" + rowData.id).data.tags = tags;
searchType();
} else{
$("#tagsInfoForm #messageAlert").alerts({
content : "测试样式",
type : "danger"
});
return;
}
},
error: function (data) {
localAlert('系统异常',data.message);
}
});
}
function tagUpdate(rowData){
var paramObj={};
paramObj.hostIds = rowData.id;
... ...