...
|
...
|
@@ -143,6 +143,7 @@ |
|
|
<label class="control-label" style="float: left;">名称</label>
|
|
|
<div class="controls">
|
|
|
<input type="text" id="moName"/>
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="control-group">
|
...
|
...
|
@@ -154,7 +155,7 @@ |
|
|
<div class="control-group">
|
|
|
<label class="control-label" style="float: left;">类型</label>
|
|
|
<div class="controls">
|
|
|
<input type="text" readonly="readonly" id="moTypeName"/>
|
|
|
<input type="text" readonly="readonly" id="moTypeName"/>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="control-group">
|
...
|
...
|
@@ -201,10 +202,10 @@ |
|
|
<form action="#" method="post" class="form-horizontal" id="deleteForm">
|
|
|
<div class="control-group" typeof="hidden" id="moId">
|
|
|
</div>
|
|
|
</form>
|
|
|
</div>
|
|
|
</form>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<button type="button" class="btn btn-default" style="margin-right: auto" data-dismiss="modal">取消
|
|
|
</button>
|
|
|
|
...
|
...
|
@@ -249,9 +250,9 @@ |
|
|
|
|
|
//修改
|
|
|
var editBtn = $("<button data-target='#updateModal' data-toggle='modal'>").addClass("btn btn-primary btn-mini").html("修改").appendTo(div);
|
|
|
editBtn.click( function () {
|
|
|
updateMObject(rowData);
|
|
|
});
|
|
|
editBtn.click(function () {
|
|
|
updateMObject(rowData);
|
|
|
});
|
|
|
|
|
|
div.append(" ");
|
|
|
div.append(" ");
|
...
|
...
|
@@ -259,11 +260,10 @@ |
|
|
|
|
|
//删除
|
|
|
var delBtn = $("<button data-target='#deleteModal' data-toggle='modal'>").addClass("btn btn-danger btn-mini").html("删除").appendTo(div);
|
|
|
delBtn.click( function() {
|
|
|
deleteMObject(rowData);
|
|
|
}
|
|
|
|
|
|
);
|
|
|
delBtn.click(function () {
|
|
|
deleteMObject(rowData);
|
|
|
}
|
|
|
);
|
|
|
return div;
|
|
|
}
|
|
|
}],
|
...
|
...
|
@@ -350,32 +350,71 @@ |
|
|
$("#updateModal #moId").val(rowData.moId);
|
|
|
|
|
|
$("#updateModal #moTypeId").val(rowData.moTypeId);
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$("#updateModal #updateSubmit").click(function () {
|
|
|
|
|
|
if(!validEmpty($("#updateModal #moName").val()))
|
|
|
{
|
|
|
alert("必须填写监控对象名称!");
|
|
|
return;
|
|
|
}
|
|
|
if (!validIp($("#updateModal #moHostIp").val())) {
|
|
|
alert("Ip 填写错误!");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
url:contextPath + "/mobject/update",
|
|
|
type:"post",
|
|
|
dataType:"json",
|
|
|
data:{
|
|
|
url: contextPath + "/mobject/update",
|
|
|
type: "post",
|
|
|
dataType: "json",
|
|
|
data: {
|
|
|
moId: $("#updateModal #moId").val(),
|
|
|
moName: $("#updateModal #moName").val(),
|
|
|
moHostIp: $("#updateModal #moHostIp").val(),
|
|
|
moTypeId: $("#updateModal #moTypeId").val(),
|
|
|
moTypeName:$("#updateModal #moTypeName").val(),
|
|
|
moTags:$("#updateModal #moTags").val(),
|
|
|
moUrl:$("#updateModal #moUrl").val()
|
|
|
}
|
|
|
moTypeName: $("#updateModal #moTypeName").val(),
|
|
|
moTags: $("#updateModal #moTags").val(),
|
|
|
moUrl: $("#updateModal #moUrl").val()
|
|
|
},
|
|
|
success: function () {
|
|
|
var div = document.getElementById("updateModal");
|
|
|
div.style.display = "none";
|
|
|
|
|
|
},
|
|
|
error: function () {
|
|
|
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
function validIp(ip) {
|
|
|
var iPattern = /^([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$/;
|
|
|
if ("" != ip && iPattern.test(ip)) {
|
|
|
return true;
|
|
|
}
|
|
|
else {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function validEmpty(str) {
|
|
|
if ("" != str) {
|
|
|
return true;
|
|
|
}
|
|
|
else {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
$("#deleteModal #deleteSubmit").click(function () {
|
|
|
$.ajax({
|
|
|
url:contextPath+"/mobject/delete",
|
|
|
type:"post",
|
|
|
dataType:"json",
|
|
|
data:{
|
|
|
url: contextPath + "/mobject/delete",
|
|
|
type: "post",
|
|
|
dataType: "json",
|
|
|
data: {
|
|
|
moId: $("#deleteModal #moId").val()
|
|
|
}
|
|
|
});
|
...
|
...
|
|