Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ops
/
monitor-ui
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
simba
9 years ago
Commit
bfd49e9103ec8b4bead7e2c02ed4bbc192fd7392
2 parents
0163a459
9d1e7d38
master
...
dev-sk
dev1019
dev_addtag_ui
dev_autoscal_java
dev_config_center
dev_degrade
dev_deploy_image_ui
dev_deploy_node
dev_deploy_uic_ui
dev_deploy_yohosearchservice
dev_dock_release_ui
dev_docker2_ui
dev_host_topo_ui
dev_linlong
dev_master
dev_mip_hbasesource
dev_mysql_ui
dev_nginx_checkbox
dev_nginx_ui
dev_sql分页
dev_store_ui
dev_switch_nginx
dev_ui_topo
feature/add-footer-div-20220127
ge_search_compare
monitor-ui-fyzh
monitor_ui
qcloudOnly
ralph
zyw
短信
Merge branch 'master' of
http://git.yoho.cn/ops/monitor-ui
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
112 additions
and
108 deletions
monitor-ui-ctrl/src/main/java/com/ui/ctrl/JavaAPICtrl.java
monitor-ui-ctrl/src/main/java/com/ui/ctrl/MObjectInfoCtrl.java
monitor-ui-web/src/main/webapp/index.jsp
monitor-ui-web/src/main/webapp/jsp/host/hostGroupList.jsp
monitor-ui-web/src/main/webapp/jsp/mobject/mobjectInfo.jsp
monitor-ui-web/src/main/webapp/script/yoho.type.tree.js
monitor-ui-ctrl/src/main/java/com/ui/ctrl/JavaAPICtrl.java
0 → 100644
View file @
bfd49e9
package
com
.
ui
.
ctrl
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
/**
* Created by fruwei on 2016/6/17.
*/
@Controller
@RequestMapping
(
"javaapi"
)
public
class
JavaAPICtrl
{
}
...
...
monitor-ui-ctrl/src/main/java/com/ui/ctrl/MObjectInfoCtrl.java
View file @
bfd49e9
...
...
@@ -18,7 +18,7 @@ public class MObjectInfoCtrl {
//前台提供currentpage,pagesize,isType,typeIds,hostIps
@RequestMapping
(
value
=
"/query"
,
method
=
RequestMethod
.
POST
)
public
BaseResponse
queryAllMObjectInfo
(
MObjectInfoReq
request
)
{
public
BaseResponse
queryAllMObjectInfo
(
@RequestBody
MObjectInfoReq
request
)
{
BaseResponse
response
=
httpRestClient
.
defaultPost
(
"/mobject/query"
,
request
,
BaseResponse
.
class
);
...
...
@@ -28,7 +28,7 @@ public class MObjectInfoCtrl {
//前台提供mo_id
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
public
BaseResponse
deleteMObjectInfo
(
MObjectInfoReq
request
)
{
public
BaseResponse
deleteMObjectInfo
(
@RequestBody
MObjectInfoReq
request
)
{
BaseResponse
response
=
httpRestClient
.
defaultPost
(
"/mobject/delete"
,
request
,
BaseResponse
.
class
);
...
...
@@ -37,7 +37,7 @@ public class MObjectInfoCtrl {
//前台提供 mo_id,mo_name,mo_typeId,mo_hostIP,mo_tags,mo_url
@RequestMapping
(
value
=
"/update"
,
method
=
RequestMethod
.
POST
)
public
BaseResponse
updateMObjectInfo
(
MObjectInfoReq
request
)
{
public
BaseResponse
updateMObjectInfo
(
@RequestBody
MObjectInfoReq
request
)
{
BaseResponse
response
=
httpRestClient
.
defaultPost
(
"/mobject/update"
,
request
,
BaseResponse
.
class
);
...
...
@@ -46,7 +46,7 @@ public class MObjectInfoCtrl {
//前台提供 mo_name,mo_typeId,mo_hostIp,mo_tags,mo_url
@RequestMapping
(
value
=
"/add"
,
method
=
RequestMethod
.
POST
)
public
BaseResponse
addMObjectInfo
(
MObjectInfoReq
request
)
{
public
BaseResponse
addMObjectInfo
(
@RequestBody
MObjectInfoReq
request
)
{
BaseResponse
response
=
httpRestClient
.
defaultPost
(
"/mobject/add"
,
request
,
BaseResponse
.
class
);
...
...
monitor-ui-web/src/main/webapp/index.jsp
View file @
bfd49e9
...
...
@@ -69,11 +69,27 @@
<script
type=
"text/javascript"
>
function
clickMenuToPage
(
page
){
var
g
=
page
.
replace
(
/
\/
/g
,
""
).
replace
(
"."
,
""
);
$
(
"#"
+
g
).
addClass
(
"active"
).
siblings
().
removeClass
(
"active"
);
//加载左侧内容
$
(
"#content"
).
load
(
contextPath
+
page
);
}
var
g
=
page
.
replace
(
/
\/
/g
,
""
).
replace
(
"."
,
""
);
$
(
"#"
+
g
).
addClass
(
"active"
).
siblings
().
removeClass
(
"active"
);
//加载左侧内容
$
(
"#content"
).
load
(
contextPath
+
page
);
}
function
localAlert
(
title
,
message
){
var
dialog
=
$
(
"<div>"
).
appendTo
(
$
(
"body"
));
dialog
.
dialog
({
title
:
title
,
backdrop
:
"static"
,
content
:
message
,
buttons
:
[{
text
:
"确定"
,
className
:
"btn-danger"
,
onclick
:
function
()
{
$
(
dialog
).
dialog
(
"hide"
);
}
}]
});
}
</script>
</body>
</html>
\ No newline at end of file
...
...
monitor-ui-web/src/main/webapp/jsp/host/hostGroupList.jsp
View file @
bfd49e9
...
...
@@ -134,11 +134,15 @@
data: param,
dataType: 'json',
success: function (data) {
$("#myModal").modal('hide');
$("#hostGroupTable").table("load");
if (!data || data.code != 200) {
localAlert('删除失败',data.message);
}else{
$("#myModal").modal('hide');
$("#hostGroupTable").table("load");
}
},
error: function (data) {
l
ayer.msg("系统异常", {icon: 2}
);
l
ocalAlert('系统异常',data.message
);
}
});
}
...
...
@@ -171,19 +175,7 @@
dataType : "json",
success : function(data) {
if (!data || data.code != 200) {
var dialog = $("<div>").appendTo($("body"));
dialog.dialog({
title : "删除失败",
backdrop : "static",
content : '系统异常',
buttons : [{
text : "确定",
className : "btn-danger",
onclick : function() {
$(dialog).dialog("hide");
}
}]
});
localAlert('删除失败',data.message);
}
$("#hostGroupTable").table("load");
}
...
...
monitor-ui-web/src/main/webapp/jsp/mobject/mobjectInfo.jsp
View file @
bfd49e9
...
...
@@ -18,7 +18,6 @@
<h5>Dynamic table</h5>
</div>
<!-- 树 -->
<div style="float: left;border: dashed;width: 300px;color: #D3D3D3;height: 600px;">
<div class="widget-title" style="height: 50px;">
...
...
@@ -31,6 +30,22 @@
</div>
<!-- 列表 -->
<div class="widget-content nopadding" style="margin-left: 300px;">
<div class="widget-title" style="height: 53px;">
<div>
<div class="form-inline" role="form" id="inBoxQueryDiv"
style=" margin-top: 12px;margin-left: 25px;float: left;">
<div class="input-group" style="float: left;">
<span class="input-group-addon">名称:</span>
<input type="text" id="alias" name="alias" class="form-control" placeholder=""/>
</div>
<div class="input-group" style="float: left;">
<span class="input-group-addon">主机:</span>
<input type="text" id="hostIp" name="hostIp" class="form-control" placeholder=""/>
</div>
<button id="btn_search_type" class="btn btn-default">搜索</button>
</div>
</div>
</div>
<div id="table"></div>
</div>
</div>
...
...
@@ -102,7 +117,6 @@
</div>
<!-- /.modal -->
</div>
</div>
<div class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
...
...
@@ -169,7 +183,6 @@
</div>
<!-- /.modal -->
</div>
</div>
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
...
...
@@ -177,30 +190,25 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">
确定删除?
</h4>
<h4 class="modal-title" id="myModalLabel">
删除
</h4>
</div>
<div class="modal-body">
<div class="row-fluid">
<div class="span12">
<div class="widget-content nopadding">
<form action="#" method="post" class="form-horizontal" id="deleteForm">
<div class="control-group" typeof="hidden" id="moId">
</div>
</form>
</div>
</div>
<div class="control-group" typeof="hidden" id="moId">
</div>
<div class="modal-body">
<p>是否确定删除该信息?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" style="margin-right: auto" data-dismiss="modal">关闭
</button>
<button type="submit" class="btn btn-success" style="margin-left: auto" id="deleteSubmit">提交</button>
</div>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal -->
</div>
</div>
<script>
$(function () {
$("#table").table({
...
...
@@ -256,53 +264,6 @@
});
//模拟数据
var jsonData = [
{"id": "1", "name": "父节点1", "url": "www.baidu.com", "pid": "0"},
{"id": "4", "name": "父节点11", "url": "", "pid": "1"},
{"id": "14", "name": "父节点112", "url": "", "pid": "4"},
{"id": "5", "name": "父节点12", "url": "", "pid": "1"},
{"id": "6", "name": "父节点13", "url": "", "pid": "1"},
{"id": "2", "name": "父节点4", "url": "", "pid": "0"},
{"id": "7", "name": "父节点41", "url": "", "pid": "2"},
{"id": "8", "name": "父节点42", "url": "", "pid": "2"},
{"id": "9", "name": "父节点43", "url": "", "pid": "2"},
{"id": "3", "name": "父节点5", "url": "", "pid": "0"},
{"id": "10", "name": "父节点51", "url": "", "pid": "3"},
{"id": "13", "name": "父节点111", "url": "", "pid": "4"},
{"id": "11", "name": "父节点52", "url": "", "pid": "3"},
{"id": "12", "name": "父节点53", "url": "", "pid": "3"}
];
//主方法,运用递归实现
function createTree(jsons, pid) {
if (jsons != null) {
var ul = '<ul class="" style="width: 120px;" >';
for (var i = 0; i < jsons.length; i++) {
if (jsons[i].pid == pid) {
ul += '<input type="checkbox" name="checkBox" value=' + jsons[i].id + ' style="float: left;margin-top: 6px;width:10px;height:10px;"><li class="tree" value=' + jsons[i].id + '><a href="#">' + jsons[i].name + "</a></li>";
ul += createTree(jsons, jsons[i].id);
}
}
ul += "</ul>";
}
return ul;
}
$(function () {
var ul = createTree(jsonData, 0);
$("#continer").append(ul);
//控制菜单的隐藏显示
$("ul[class] li").each(function () {
$(this).click(function () {
$(this).next().toggle();
});
});
});
function deleteMObject(rowData) {
$("#deleteModal #moId").val(rowData.moId);
}
...
...
@@ -328,11 +289,11 @@
$("#updateModal #updateSubmit").click(function () {
if (!validEmpty($("#updateModal #moName").val())) {
alert("必须填写监控对象名称!"
);
layer.message("必须填写监控对象名称",{icon:2}
);
return;
}
if (!validIp($("#updateModal #moHostIp").val())) {
alert("Ip 填写错误!"
);
layer.message("Ip 填写错误!",{icon:2}
);
return;
}
...
...
@@ -351,11 +312,11 @@
},
success: function (response) {
if (200 != response.code) {
alert(response.message
);
layer.msg(response.message,{icon:2}
);
}
else {
var div = document.getElementById("updateModal");
div.style.display = "none";
$("#updateModal").modal("hide");
$("#table").table("load");
}
}
});
...
...
@@ -370,23 +331,25 @@
data: {
moId: $("#deleteModal #moId").val()
},
success: function () {
var div = document.getElementById("deleteModal");
div.style.display = "none";
},
error: function () {
success: function (response) {
if (200 != response.code) {
layer.msg(response.message,{icon:2});
}
else {
$("#deleteModal").modal("hide");
$("#table").table("load");
}
}
});
});
$("#addModal #addSubmit").click(function () {
if (!validEmpty($("#addModal #moName").val())) {
alert("必须填写监控对象名称!"
);
layer.msg("必须填写监控对象名称",{icon:2}
);
return;
}
if (!validIp($("#addModal #moHostIp").val())) {
alert("Ip 填写错误!"
);
layer.msg("Ip 填写错误!",{icon:2}
);
return;
}
...
...
@@ -405,14 +368,11 @@
},
success: function (response) {
if (200 != response.code) {
alert(response.message
);
layer.msg(response.message,{icon:2}
);
}
else {
var div = document.getElementById("addModal");
div.style.display = "none";
$("#table").load({
})
$("#addModal").modal("hide");
$("#table").table("load");
}
}
...
...
@@ -443,6 +403,20 @@
}
$("#btn_search_type").click(function(){
console.log("search..");
searchType();
});
var searchType=function(){
var ids=getSelectType(true);
if(ids.length<1)
$.toaster('未选择类型节点', '提示', 'info');
};
</script>
<script type="text/javascript" src="<%=basePath %>/script/yoho.type.tree.js"></script>
...
...
monitor-ui-web/src/main/webapp/script/yoho.type.tree.js
View file @
bfd49e9
...
...
@@ -106,9 +106,14 @@ var addMObjType = function (nodeid, name) {
$
(
"#addModal #moTypeId"
).
val
(
id
);
alert
(
$
(
"#addModal #moTypeName"
).
val
()
);
$
(
"#addModal #moName"
).
val
(
""
);
$
(
"#addModal #moHostIp"
).
val
(
""
);
$
(
"#addModal #moTags"
).
val
(
""
);
$
(
"#addModal #moUrl"
).
val
(
""
);
}
...
...
Please
register
or
login
to post a comment