Authored by jack.xue

123123

... ... @@ -16,22 +16,16 @@
<div class="widget-title">
<h5>Dynamic table</h5>
</div>
<!-- 树 -->
<div style="margin-top: 45px; float: left;margin-top: 54px;border: dashed;width: 300px;color: #D3D3D3;height: 580px;">
<div class="widget-title">
<h5>Tree Title</h5>
</div>
<ul class="ui-widget ui-helper-clearfix" id="icons" style="float: left;margin-left: 165px;">
<li title=".ui-icon-plusthick" class="ui-state-default ui-corner-all" onclick="deletebtn()"><span
class="ui-icon ui-icon-plusthick"></span></li>
</ul>
<ul class="ui-widget ui-helper-clearfix" id="icons" style="margin-right: 12px;">
<li title=".ui-icon-minusthick" class="ui-state-default ui-corner-all" onclick="editbtn()"><span
class="ui-icon ui-icon-minusthick"></span></li>
</ul>
<div id="continer"></div>
<div id="jstree" class="jstree jstree-default" role="tree" aria-multiselectable="true"
tabindex="0" style="height: 400px;color: black"></div>
</div>
<!-- 列表 -->
<div class="widget-content nopadding" style="margin-left: 300px;">
... ... @@ -49,9 +43,6 @@
</div>
<button id="submit" class="btn btn-default">搜索</button>
</div>
<button id="addBtn" class="btn btn-primary" style="margin-top: 12px;margin-left: 500px;"
data-target="#addModal" data-toggle="modal">新增
</button>
</div>
</div>
<div id="table"></div>
... ... @@ -66,17 +57,24 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">新增</h4>
<h4 class="modal-title" id="addModalLabel">新增</h4>
</div>
<div class="modal-body">
<div class="row-fluid">
<div class="span12">
<div class="widget-content nopadding">
<form action="/mobject/add" method="post" class="form-horizontal">
<form action="#" method="post" class="form-horizontal" id="addForm">
<div class="control-group" typeof="hidden" id="moId">
</div>
<div class="control-group" typeof="hidden" id="moTypeId">
</div>
<div class="control-group">
<label class="control-label" style="float: left;">名称</label>
<div class="controls">
<input type="text" id="moName"/>
</div>
</div>
<div class="control-group">
... ... @@ -88,19 +86,19 @@
<div class="control-group">
<label class="control-label" style="float: left;">类型</label>
<div class="controls">
<input type="text" value="" readonly="readonly" id=""/>
<input type="text" readonly="readonly" id="moTypeName"/>
</div>
</div>
<div class="control-group">
<label class="control-label" style="float: left;">标签</label>
<div class="controls">
<input type="text"/>
<input type="text" id="moTags"/>
</div>
</div>
<div class="control-group">
<label class="control-label" style="float: left;">域名</label>
<div class="controls">
<input type="text"/>
<input type="text" id="moUrl"/>
</div>
</div>
</form>
... ... @@ -111,7 +109,7 @@
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭
</button>
<button type="submit" class="btn btn-primary" value="Validate">提交</button>
<button type="submit" class="btn btn-primary" id="addSubmit">提交</button>
</div>
</div>
<!-- /.modal-content -->
... ... @@ -319,18 +317,6 @@
});
var dom = document.getElementById("icons");
var str = dom.getAttribute("style");
str = str.replace(/height\b\s*\:\s*\d+\px;?/ig, "");
dom.setAttribute("style", str);
function deletebtn() {
alert(1);
}
function editbtn() {
alert(2);
}
function deleteMObject(rowData) {
$("#deleteModal #moId").val(rowData.moId);
}
... ... @@ -355,8 +341,7 @@
$("#updateModal #updateSubmit").click(function () {
if(!validEmpty($("#updateModal #moName").val()))
{
if (!validEmpty($("#updateModal #moName").val())) {
alert("必须填写监控对象名称!");
return;
}
... ... @@ -389,6 +374,62 @@
});
});
$("#deleteModal #deleteSubmit").click(function () {
$.ajax({
url: contextPath + "/mobject/delete",
type: "post",
dataType: "json",
data: {
moId: $("#deleteModal #moId").val()
},
success: function () {
var div = document.getElementById("deleteModal");
div.style.display = "none";
},
error: function () {
}
});
});
$("#addModal #addSubmit").click(function () {
if (!validEmpty($("#addModal #moName").val())) {
alert("必须填写监控对象名称!");
return;
}
if (!validIp($("#addModal #moHostIp").val())) {
alert("Ip 填写错误!");
return;
}
$.ajax(
{
url: contextPath + "/mobject/add",
type: "post",
dataType: "json",
data: {
moName: $("#addModal #moName").val(),
moHostIp: $("#addModal #moHostIp").val(),
moTypeId: $("#addModal #moTypeId").val(),
moTypeName: $("#addModal #moTypeName").val(),
moTags: $("#addModal #moTags").val(),
moUrl: $("#addModal #moUrl").val()
},
success: function () {
var div = document.getElementById("addModal");
div.style.display = "none";
},
error: function () {
alert();
}
}
);
}
);
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)) {
... ... @@ -409,18 +450,59 @@
}
$("#deleteModal #deleteSubmit").click(function () {
$.ajax({
url: contextPath + "/mobject/delete",
type: "post",
dataType: "json",
data: {
moId: $("#deleteModal #moId").val()
}
});
});
function addMObject() {
}
</script>
<script type="text/javascript" src="<%=basePath %>/script/yoho.type.tree.js"></script>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" style="width: 300px">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">
添加类型
</h4>
</div>
<div class="modal-body">
<div id="modal_type_add">
<div class="input-group" style="padding-bottom: 5px">
<span class="input-group-addon" style="width: 100px">父节点:</span>
<input type="text" id="tx_new_type_parent" width="50" readonly="true" class="form-control"
placeholder=""/>
</div>
<div class="input-group" style="padding-bottom: 5px">
<span class="input-group-addon" style="width: 100px">Name:</span>
<input type="text" id="tx_new_type_name" width="50" class="form-control" placeholder=""/>
</div>
<div class="input-group" style="padding-bottom: 5px">
<span class="input-group-addon" style="width: 100px">子节点:</span>
<input type="checkbox" id="cb_new_type_isleaf" style="margin-left: 30px" name="appName"
value="JAVA">
</div>
</div>
<div id="modal_type_update">
<div class="input-group" style="padding-bottom: 5px">
<span class="input-group-addon" style="width: 100px">原名称:</span>
<input type="text" id="tx_update_type_name_old" readonly="true" class="form-control"
placeholder=""/>
</div>
<div class="input-group" style="padding-bottom: 5px">
<span class="input-group-addon" style="width: 100px">新名称:</span>
<input type="text" id="tx_update_type_name_new" class="form-control" placeholder=""/>
</div>
</div>
<div id="modal_type_del">
确认删除该类型节点?
</div>
</div>
<div class="modal-footer">
<input type="hidden" id="tx_type_action"/>
<input type="hidden" id="tx_type_id"/>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" id="btn4type" class="btn btn-primary">确认</button>
</div>
</div>
</div>
</div>
 
\ No newline at end of file
... ...
... ... @@ -94,6 +94,14 @@ var addMObjType = function (nodeid, name) {
console.log("id: " + id + " path: " + path + " name :" + name);
//TODO 打开新增服务对象对话框
$('#addModal').modal({keyboard: true});
$("#addModal #moTypeName").val(name);
$("#addModal #moTypeId").val(id);
alert($("#addModal #moTypeName").val());
}
... ...