Merge branch 'master' of http://git.yoho.cn/ops/monitor-ui
Showing
7 changed files
with
231 additions
and
127 deletions
@@ -8,6 +8,8 @@ import lombok.Data; | @@ -8,6 +8,8 @@ import lombok.Data; | ||
8 | @Data | 8 | @Data |
9 | public class HostInfoReq extends PageRequest { | 9 | public class HostInfoReq extends PageRequest { |
10 | 10 | ||
11 | + private int id; | ||
12 | + | ||
11 | private String alias; | 13 | private String alias; |
12 | 14 | ||
13 | private String hostIp; | 15 | private String hostIp; |
1 | package com.ui.ctrl; | 1 | package com.ui.ctrl; |
2 | 2 | ||
3 | 3 | ||
4 | -import com.alibaba.fastjson.JSON; | ||
5 | import com.ui.http.HttpRestClient; | 4 | import com.ui.http.HttpRestClient; |
6 | import com.ui.model.BaseResponse; | 5 | import com.ui.model.BaseResponse; |
7 | import com.ui.model.req.HostInfoReq; | 6 | import com.ui.model.req.HostInfoReq; |
@@ -30,7 +29,29 @@ public class HostInfoCtrl { | @@ -30,7 +29,29 @@ public class HostInfoCtrl { | ||
30 | @ResponseBody | 29 | @ResponseBody |
31 | public BaseResponse getHostInfos(HostInfoReq req) throws Exception { | 30 | public BaseResponse getHostInfos(HostInfoReq req) throws Exception { |
32 | BaseResponse response=httpRestClient.defaultPost("/hostInfo/getHostInfos", req, BaseResponse.class); | 31 | BaseResponse response=httpRestClient.defaultPost("/hostInfo/getHostInfos", req, BaseResponse.class); |
33 | - System.out.println("*****************************"+ JSON.toJSON(response)); | 32 | + return response; |
33 | + } | ||
34 | + | ||
35 | + | ||
36 | + @RequestMapping("/saveHostInfo") | ||
37 | + @ResponseBody | ||
38 | + public BaseResponse saveHostInfo(HostInfoReq req) throws Exception { | ||
39 | + BaseResponse response=httpRestClient.defaultPost("/hostInfo/saveHostInfo", req, BaseResponse.class); | ||
40 | + return response; | ||
41 | + } | ||
42 | + | ||
43 | + | ||
44 | + @RequestMapping("/delHostInfo") | ||
45 | + @ResponseBody | ||
46 | + public BaseResponse<Integer> delHostInfo(int id ) throws Exception { | ||
47 | + BaseResponse response=httpRestClient.defaultGet("/hostInfo/delHostInfo?id=" + id, BaseResponse.class); | ||
48 | + return response; | ||
49 | + } | ||
50 | + | ||
51 | + @RequestMapping("/getHostInfoById") | ||
52 | + @ResponseBody | ||
53 | + public BaseResponse getHostInfoById(int id) throws Exception { | ||
54 | + BaseResponse response=httpRestClient.defaultGet("/hostInfo/getHostInfoById?id="+id, BaseResponse.class); | ||
34 | return response; | 55 | return response; |
35 | } | 56 | } |
36 | 57 |
@@ -27,6 +27,7 @@ | @@ -27,6 +27,7 @@ | ||
27 | <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.pagination.js" charset="UTF-8" type="text/javascript"></script> | 27 | <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.pagination.js" charset="UTF-8" type="text/javascript"></script> |
28 | <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.table.js" charset="UTF-8" type="text/javascript"></script> | 28 | <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.table.js" charset="UTF-8" type="text/javascript"></script> |
29 | <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.dialog.js" charset="UTF-8" type="text/javascript"></script> | 29 | <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.dialog.js" charset="UTF-8" type="text/javascript"></script> |
30 | +<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.form.js" charset="UTF-8" type="text/javascript"></script> | ||
30 | <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.panel.js" charset="UTF-8" type="text/javascript"></script> | 31 | <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.panel.js" charset="UTF-8" type="text/javascript"></script> |
31 | <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.alerts.js" charset="UTF-8" type="text/javascript"></script> | 32 | <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.alerts.js" charset="UTF-8" type="text/javascript"></script> |
32 | <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.accordion.js" charset="UTF-8" type="text/javascript"></script> | 33 | <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.accordion.js" charset="UTF-8" type="text/javascript"></script> |
@@ -52,11 +53,9 @@ | @@ -52,11 +53,9 @@ | ||
52 | <div id="sidebar"> | 53 | <div id="sidebar"> |
53 | <ul> | 54 | <ul> |
54 | <li class=""><a href="#"><i class="icon icon-home"></i> <span>Dashboard</span></a></li> | 55 | <li class=""><a href="#"><i class="icon icon-home"></i> <span>Dashboard</span></a></li> |
55 | - <li class="" id="jsptablejsp" onclick="clickMenuToPage('/jsp/table.jsp')"><a href="#" ><i class="icon icon-th"></i> <span>Tables</span></a></li> | 56 | + <li class="" id="jspmobjectmobjectInfojsp" onclick="clickMenuToPage('/jsp/mobject/mobjectInfo.jsp')"><a href="#" ><i class="icon icon-th"></i> <span>Tables</span></a></li> |
56 | <li class="" id="jsphosthostGroupListjsp" onclick="clickMenuToPage('jsp/host/hostGroupList.jsp')" ><a href="#" ><i class="icon icon-th"></i> <span>主机组</span></a></li> | 57 | <li class="" id="jsphosthostGroupListjsp" onclick="clickMenuToPage('jsp/host/hostGroupList.jsp')" ><a href="#" ><i class="icon icon-th"></i> <span>主机组</span></a></li> |
57 | <li class="" id="jsphosthostInfoListjsp" onclick="clickMenuToPage('jsp/host/hostInfoList.jsp')" ><a href="#" ><i class="icon icon-th"></i> <span>主机信息</span></a></li> | 58 | <li class="" id="jsphosthostInfoListjsp" onclick="clickMenuToPage('jsp/host/hostInfoList.jsp')" ><a href="#" ><i class="icon icon-th"></i> <span>主机信息</span></a></li> |
58 | - | ||
59 | - | ||
60 | </ul> | 59 | </ul> |
61 | </div> | 60 | </div> |
62 | <!-- 右侧具体内容 --> | 61 | <!-- 右侧具体内容 --> |
1 | <%@page language="java" contentType="text/html;charset=utf-8" %> | 1 | <%@page language="java" contentType="text/html;charset=utf-8" %> |
2 | -<form method="post" class="form-horizontal" id="smsTemplateForm" name="smsTemplateForm"> | 2 | +<form method="post" class="form-horizontal" id="hostInfoForm" name="hostInfoForm"> |
3 | 3 | ||
4 | - <div> | ||
5 | - <label> <span style="color:red">*</span>主机别名:</label> | 4 | + <div class="form-group" > |
5 | + <label class="col-sm-2 control-label"> <span style="color:red">*</span>主机别名:</label> | ||
6 | + <div class="col-sm-8"> | ||
6 | <input type="text" class="form-control" id="alias" name="alias" placeholder="输入主机别名" maxlength="30" size="40"/> | 7 | <input type="text" class="form-control" id="alias" name="alias" placeholder="输入主机别名" maxlength="30" size="40"/> |
7 | </div> | 8 | </div> |
8 | - | ||
9 | - <div> | ||
10 | - <label> <span style="color:red">*</span>主机IP:label> | ||
11 | - <input type="text" class="form-control" id="hostIP" name="hostIP" placeholder="输入IP地址" maxlength="30" size="40"/> | ||
12 | </div> | 9 | </div> |
13 | 10 | ||
14 | - <div> | ||
15 | - <label> <span style="color:red">*</span>云类型:</label> | ||
16 | - <input type="text" class="form-control" id="smsTemplateTitle" name="smsTemplateTitle" placeholder="最多30个汉字" maxlength="30" size="40"/> | 11 | + <div class="form-group" > |
12 | + <label class="col-sm-2 control-label"> <span style="color:red">*</span>主机IP:</label> | ||
13 | + <div class="col-sm-8"> | ||
14 | + <input type="text" class="form-control" id="hostIp" name="hostIp" placeholder="输入IP地址" maxlength="30" size="40"/> | ||
15 | + </div> | ||
17 | </div> | 16 | </div> |
18 | 17 | ||
18 | + <div class="form-group" > | ||
19 | + <label class="col-sm-2 control-label"> <span style="color:red">*</span>云类型:</label> | ||
20 | + <div class="col-sm-8"> | ||
21 | + <select id="cloudType" name="cloudType" class="form-control"> | ||
22 | + <option value="1">AWS</option> | ||
23 | + <option value="2">腾讯云</option> | ||
24 | + <option value="3">其他</option> | ||
25 | + </select> | ||
26 | + </div> | ||
27 | + </div> | ||
19 | 28 | ||
20 | - | ||
21 | - <br/> | ||
22 | - | ||
23 | - <div class="form-group"> | ||
24 | - <input type="button" class="btn btn-primary" style="margin-left:100px" id="saveSmsTemplateBtn" value="保存" /> | 29 | + <div class="form-group" > |
30 | + <label class="col-sm-2 control-label"> <span style="color:red">*</span>主机组:</label> | ||
31 | + <div class="col-sm-8"> | ||
32 | + <select id="groupId" name="groupId" class="form-control"> | ||
33 | + <option value="1">AWS</option> | ||
34 | + <option value="2">腾讯云</option> | ||
35 | + <option value="3">其他</option> | ||
36 | + </select> | ||
37 | + </div> | ||
25 | </div> | 38 | </div> |
26 | 39 | ||
40 | + <div class="form-group" > | ||
41 | + <label class="col-sm-2 control-label"> <span style="color:red">*</span>安装软件:</label> | ||
42 | + <div class="col-sm-8"> | ||
43 | + <input type="checkbox" name="appName" value="JAVA"> JAVA <input type="checkbox" name="appName" value="Redis" > Redis | ||
44 | + </div> | ||
45 | + </div> | ||
27 | 46 | ||
28 | </form> | 47 | </form> |
29 | 48 | ||
30 | 49 | ||
31 | <script> | 50 | <script> |
32 | - var TextCount = (function () { | ||
33 | - var _bind = function (that) { | ||
34 | - that.input.on('keyup', function () { | ||
35 | - that.render(); | ||
36 | - }); | ||
37 | - } | ||
38 | - | ||
39 | - var _getNum = function (that) { | ||
40 | - return that.input.val().length; | ||
41 | - } | ||
42 | - | ||
43 | - var TextCountFun = function (config) { | ||
44 | - this.id = config.id; | ||
45 | - } | ||
46 | - | ||
47 | - TextCountFun.prototype.init = function () { | ||
48 | - this.input = $(this.id); | ||
49 | - this.render(); | ||
50 | - _bind(this); | ||
51 | - }; | ||
52 | - | ||
53 | - TextCountFun.prototype.render = function () { | ||
54 | - var num = _getNum(this); | ||
55 | - if ($('#_test_count').length == 0) { | ||
56 | - $('#countDiv').append('<span id="_test_count"></span>'); | ||
57 | - }; | ||
58 | - | ||
59 | - if (num < 71) { | ||
60 | - $('#_test_count').html(num + '/990'); | ||
61 | - } else if (num <= 990) { | ||
62 | - var message = "共" + num + "字符,含短信签名,将被做" + Math.ceil(num / 70) + "条短信计价。每条短信最多70个字符"; | ||
63 | - $('#_test_count').html(num + '/990' + ' <span style="color: red">' + message + '</span>'); | ||
64 | - } else { | ||
65 | - $('#_test_count').html('990/990'); | ||
66 | - } | ||
67 | - }; | ||
68 | - return TextCountFun; | ||
69 | - })(); | ||
70 | - | ||
71 | - | ||
72 | - | ||
73 | 51 | ||
74 | $(function () { | 52 | $(function () { |
75 | - $("#smsTemplateForm #smsTemplateTitle").validate({ | ||
76 | - required: true, | ||
77 | - validateOnBlur : false | ||
78 | - }); | ||
79 | - | ||
80 | - $("form #smsTemplateContent").validate({ | ||
81 | - required: true, | ||
82 | - validateOnBlur : false | ||
83 | - }); | ||
84 | - | ||
85 | - //保存 | ||
86 | - $("#saveSmsTemplateBtn").click(function(){ | ||
87 | - var smsTemplateId = $("#smsTemplateId").val(); | ||
88 | - var btn = $(this); | ||
89 | - btn.prop("disabled", true); | ||
90 | - $("#smsTemplateForm").form("submit", { | ||
91 | - submitUrl : contextPath + "/SmsTemplateController/saveSmsTemplate.do", | ||
92 | - submitData : { | ||
93 | - smsTemplateId : paramObj.smsTemplateId | ||
94 | - }, | ||
95 | - onBeforeSubmit : function() { | ||
96 | - if (!$("#smsTemplateForm").form("validate")) { | ||
97 | - btn.removeAttr("disabled"); | ||
98 | - return false; | ||
99 | - } | ||
100 | - }, | ||
101 | - | ||
102 | - success : function(data) { | ||
103 | - btn.removeAttr("disabled"); | ||
104 | - if (!data || data.code != 200) { | ||
105 | - $.messageAlert("错误", data.message); | ||
106 | - return; | ||
107 | - }else{ | ||
108 | - $("#body").load(contextPath + "/html/chatChannel/smsTemplate/smsTemplateList.html") | ||
109 | - } | ||
110 | - } | ||
111 | - }); | ||
112 | - }); | ||
113 | - | ||
114 | - | 53 | + if(paramObj.hoseInfoId > 0){ |
115 | 54 | ||
116 | //加载form | 55 | //加载form |
117 | - $("#smsTemplateForm").form({ | ||
118 | - loadUrl : contextPath + "/SmsTemplateController/getTemplateById.do", | 56 | + $("#hostInfoForm").form({ |
57 | + loadUrl : contextPath + "/hostInfo/getHostInfoById.do", | ||
119 | loadParams : { | 58 | loadParams : { |
120 | - smsTemplateId : paramObj.smsTemplateId | 59 | + id : paramObj.hoseInfoId |
121 | }, | 60 | }, |
122 | loadFilter : function(data) { | 61 | loadFilter : function(data) { |
123 | return defaultLoadFilter(data); | 62 | return defaultLoadFilter(data); |
124 | }, | 63 | }, |
125 | onBeforeLoad : function(loadParams) { | 64 | onBeforeLoad : function(loadParams) { |
126 | - if (loadParams.smsTemplateId == 0) { | 65 | + if (loadParams.hoseInfoId == 0) { |
127 | return false; | 66 | return false; |
128 | } | 67 | } |
129 | }, | 68 | }, |
130 | onLoadSuccess : function(data) { | 69 | onLoadSuccess : function(data) { |
131 | - new TextCount({id: '#smsTemplateContent'}).init(); | 70 | + |
132 | } | 71 | } |
133 | }); | 72 | }); |
134 | - | ||
135 | - | ||
136 | - | ||
137 | - | ||
138 | - | ||
139 | - new TextCount({id: '#smsTemplateContent'}).init(); | 73 | + } |
140 | }); | 74 | }); |
141 | </script> | 75 | </script> |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> | 2 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> |
3 | <div id="breadcrumb"> | 3 | <div id="breadcrumb"> |
4 | <a href="#" title="Go to Home" class="tip-bottom"><i | 4 | <a href="#" title="Go to Home" class="tip-bottom"><i |
5 | - class="icon-home"></i> Home</a> <a href="#" class="current">Tables</a> | 5 | + class="icon-home"></i> 主机组</a> <a href="#" class="current">主机信息</a> |
6 | </div> | 6 | </div> |
7 | 7 | ||
8 | <div class="container-fluid"> | 8 | <div class="container-fluid"> |
@@ -26,17 +26,21 @@ | @@ -26,17 +26,21 @@ | ||
26 | <input type="text" id="hostIp" name="hostIp" class="form-control" placeholder=""/> | 26 | <input type="text" id="hostIp" name="hostIp" class="form-control" placeholder=""/> |
27 | </div> | 27 | </div> |
28 | <div class="input-group" style="float: left;"> | 28 | <div class="input-group" style="float: left;"> |
29 | + <span class="input-group-addon">安装软件:</span> | ||
30 | + <input type="text" id="tags" name="tags" class="form-control" placeholder=""/> | ||
31 | + </div> | ||
32 | + <div class="input-group" style="float: left;"> | ||
29 | <span class="input-group-addon">云类型:</span> | 33 | <span class="input-group-addon">云类型:</span> |
30 | <select id="cloudType" name="cloudType" class="form-control"> | 34 | <select id="cloudType" name="cloudType" class="form-control"> |
31 | - <option value="">全部</option> | 35 | + <option value="0">全部</option> |
32 | <option value="1">AWS</option> | 36 | <option value="1">AWS</option> |
33 | <option value="2">腾讯云</option> | 37 | <option value="2">腾讯云</option> |
34 | - <option value="2">其他</option> | 38 | + <option value="3">其他</option> |
35 | </select> | 39 | </select> |
36 | </div> | 40 | </div> |
37 | <button id="searchHostInfoBtn" class="btn btn-default">搜索</button> | 41 | <button id="searchHostInfoBtn" class="btn btn-default">搜索</button> |
38 | </div> | 42 | </div> |
39 | - <button id="addHostInfoBtn" class="btn btn-primary" style="margin-top: 12px;margin-left: 900px;">新增</button> | 43 | + <button id="addHostInfoBtn" class="btn btn-primary" style="margin-top: 12px;margin-left: 100px;">新增</button> |
40 | </div> | 44 | </div> |
41 | </div> | 45 | </div> |
42 | <div id="hostInfoTable"> | 46 | <div id="hostInfoTable"> |
@@ -91,8 +95,76 @@ | @@ -91,8 +95,76 @@ | ||
91 | }, | 95 | }, |
92 | width : "12%" | 96 | width : "12%" |
93 | }, { | 97 | }, { |
98 | + title : "安装软件", | ||
99 | + field : "tags", | ||
100 | + formatter : function(value, rowData, rowIndex) { | ||
101 | + if(value != null && value != ""){ | ||
102 | + return value.substr(0,value.length-1); | ||
103 | + } | ||
104 | + | ||
105 | + }, | ||
106 | + width : "12%" | ||
107 | + }, { | ||
94 | title : "操作", | 108 | title : "操作", |
95 | field : "op", | 109 | field : "op", |
110 | + formatter : function(value, rowData, rowIndex) { | ||
111 | + var div = $("<div>"); | ||
112 | + var editBtn = $("<button>").addClass("btn btn-xs btn-success").html("修改").appendTo(div); | ||
113 | + editBtn.click(function() { | ||
114 | + editHostInfo(rowData.id); | ||
115 | + }); | ||
116 | + div.append(" "); | ||
117 | + var delBtn = $("<button>").addClass("btn btn-xs btn-danger").html("删除").appendTo(div); | ||
118 | + delBtn.click(function() { | ||
119 | + var dialog = $("<div>").appendTo($("body")); | ||
120 | + dialog.dialog({ | ||
121 | + title : "你确定删除吗", | ||
122 | + backdrop : "static", | ||
123 | + content : "你确定要删除该主机信息吗?", | ||
124 | + buttons : [{ | ||
125 | + text : "否", | ||
126 | + className : "btn-danger", | ||
127 | + onclick : function() { | ||
128 | + $(dialog).dialog("hide"); | ||
129 | + } | ||
130 | + }, { | ||
131 | + text : "是", | ||
132 | + className : "btn-success", | ||
133 | + onclick : function() { | ||
134 | + $(dialog).dialog("hide"); | ||
135 | + $.ajax({ | ||
136 | + url : contextPath +"/hostInfo/delHostInfo.do", | ||
137 | + type : 'post', | ||
138 | + async : false, | ||
139 | + data : { | ||
140 | + id : rowData.id | ||
141 | + }, | ||
142 | + dataType : "json", | ||
143 | + success : function(data) { | ||
144 | + if (!data || data.code != 200) { | ||
145 | + var dialog = $("<div>").appendTo($("body")); | ||
146 | + dialog.dialog({ | ||
147 | + title : "删除失败", | ||
148 | + backdrop : "static", | ||
149 | + content : data.message, | ||
150 | + buttons : [{ | ||
151 | + text : "确定", | ||
152 | + className : "btn-danger", | ||
153 | + onclick : function() { | ||
154 | + $(dialog).dialog("hide"); | ||
155 | + } | ||
156 | + }] | ||
157 | + }); | ||
158 | + } | ||
159 | + $("#smsListTable").table("load"); | ||
160 | + } | ||
161 | + }); | ||
162 | + } | ||
163 | + }] | ||
164 | + }); | ||
165 | + }); | ||
166 | + return div; | ||
167 | + }, | ||
96 | width : "15%" | 168 | width : "15%" |
97 | }] | 169 | }] |
98 | }); | 170 | }); |
@@ -107,17 +179,18 @@ | @@ -107,17 +179,18 @@ | ||
107 | var alias = $("#alias").val(); | 179 | var alias = $("#alias").val(); |
108 | var hostIp = $("#hostIp").val(); | 180 | var hostIp = $("#hostIp").val(); |
109 | var cloudType = $("#cloudType").val(); | 181 | var cloudType = $("#cloudType").val(); |
182 | + var tags=$("#tags").val(); | ||
110 | $("#hostInfoTable").table("load", { | 183 | $("#hostInfoTable").table("load", { |
111 | 'alias': alias, | 184 | 'alias': alias, |
112 | 'hostIp': hostIp, | 185 | 'hostIp': hostIp, |
113 | - 'cloudType': cloudType | 186 | + 'cloudType': cloudType, |
187 | + 'tags':tags | ||
114 | }); | 188 | }); |
115 | }); | 189 | }); |
116 | 190 | ||
117 | 191 | ||
118 | //打开新增或修改页面 | 192 | //打开新增或修改页面 |
119 | function editHostInfo(hoseInfoId) { | 193 | function editHostInfo(hoseInfoId) { |
120 | - alert(1); | ||
121 | paramObj.hoseInfoId = hoseInfoId; | 194 | paramObj.hoseInfoId = hoseInfoId; |
122 | var dialog = $("<div>").appendTo($("body")); | 195 | var dialog = $("<div>").appendTo($("body")); |
123 | dialog.dialog({ | 196 | dialog.dialog({ |
@@ -137,10 +210,15 @@ | @@ -137,10 +210,15 @@ | ||
137 | onclick : function() { | 210 | onclick : function() { |
138 | var btn = $(this); | 211 | var btn = $(this); |
139 | this.prop("disabled", "disabled"); | 212 | this.prop("disabled", "disabled"); |
140 | - $("#smsTmplateEditForm").form("submit", { | 213 | + var tags=""; |
214 | + $("input[name='appName']:checked").each(function(){ | ||
215 | + tags += $(this).attr('value')+','; | ||
216 | + }); | ||
217 | + $("#hostInfoForm").form("submit", { | ||
141 | submitUrl : contextPath + "/hostInfo/saveHostInfo.do", | 218 | submitUrl : contextPath + "/hostInfo/saveHostInfo.do", |
142 | submitData : { | 219 | submitData : { |
143 | - smTemplateId : hoseInfoId | 220 | + id : hoseInfoId, |
221 | + tags:tags | ||
144 | }, | 222 | }, |
145 | onBeforeSubmit : function() { | 223 | onBeforeSubmit : function() { |
146 | if (!$(this).form("validate")) { | 224 | if (!$(this).form("validate")) { |
@@ -151,13 +229,13 @@ | @@ -151,13 +229,13 @@ | ||
151 | success : function(data) { | 229 | success : function(data) { |
152 | if (!data || data.code != 200) { | 230 | if (!data || data.code != 200) { |
153 | btn.removeAttr("disabled"); | 231 | btn.removeAttr("disabled"); |
154 | - $("#smsTmplateEditForm #messageAlert").alerts({ | 232 | + $("#hostInfoForm #messageAlert").alerts({ |
155 | content : data.message, | 233 | content : data.message, |
156 | type : "danger" | 234 | type : "danger" |
157 | }); | 235 | }); |
158 | return; | 236 | return; |
159 | } | 237 | } |
160 | - $("#smsListTable").table("load"); | 238 | + $("#hostInfoTable").table("load"); |
161 | $(dialog).dialog("hide"); | 239 | $(dialog).dialog("hide"); |
162 | } | 240 | } |
163 | }); | 241 | }); |
@@ -49,13 +49,75 @@ | @@ -49,13 +49,75 @@ | ||
49 | </div> | 49 | </div> |
50 | <button id="submit" class="btn btn-default">搜索</button> | 50 | <button id="submit" class="btn btn-default">搜索</button> |
51 | </div> | 51 | </div> |
52 | - <button id="addBtn" class="btn btn-primary" style="margin-top: 12px;margin-left: 500px;">新增</button> | 52 | + <button id="addBtn" class="btn btn-primary" style="margin-top: 12px;margin-left: 500px;" data-target="#myModal" data-toggle="modal">新增</button> |
53 | </div> | 53 | </div> |
54 | </div> | 54 | </div> |
55 | <div id="table"></div> | 55 | <div id="table"></div> |
56 | </div> | 56 | </div> |
57 | </div> | 57 | </div> |
58 | </div> | 58 | </div> |
59 | + | ||
60 | + | ||
61 | + | ||
62 | +<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> | ||
63 | + <div class="modal-dialog"> | ||
64 | + <div class="modal-content"> | ||
65 | + <div class="modal-header"> | ||
66 | + <button type="button" class="close" data-dismiss="modal" | ||
67 | + aria-hidden="true">×</button> | ||
68 | + <h4 class="modal-title" id="myModalLabel">新增</h4> | ||
69 | + </div> | ||
70 | + <div class="modal-body"> | ||
71 | + <div class="row-fluid"> | ||
72 | + <div class="span12"> | ||
73 | + <div class="widget-content nopadding"> | ||
74 | + <form action="/mobject/add" method="post" class="form-horizontal"> | ||
75 | + <div class="control-group"> | ||
76 | + <label class="control-label" style="float: left;">名称</label> | ||
77 | + <div class="controls"> | ||
78 | + <input type="text" /> | ||
79 | + </div> | ||
80 | + </div> | ||
81 | + <div class="control-group"> | ||
82 | + <label class="control-label" style="float: left;">所属主机</label> | ||
83 | + <div class="controls"> | ||
84 | + <input type="text" placeholder="请填写主机IP" /> | ||
85 | + </div> | ||
86 | + </div> | ||
87 | + <div class="control-group"> | ||
88 | + <label class="control-label" style="float: left;">类型</label> | ||
89 | + <div class="controls"> | ||
90 | + <input type="text" value="" readonly="readonly" /> | ||
91 | + </div> | ||
92 | + </div> | ||
93 | + <div class="control-group"> | ||
94 | + <label class="control-label" style="float: left;">标签</label> | ||
95 | + <div class="controls"> | ||
96 | + <input type="text" /> | ||
97 | + </div> | ||
98 | + </div> | ||
99 | + <div class="control-group"> | ||
100 | + <label class="control-label" style="float: left;">域名</label> | ||
101 | + <div class="controls"> | ||
102 | + <input type="text" /> | ||
103 | + </div> | ||
104 | + </div> | ||
105 | + </form> | ||
106 | + </div> | ||
107 | + </div> | ||
108 | + </div> | ||
109 | + </div> | ||
110 | + <div class="modal-footer"> | ||
111 | + <button type="button" class="btn btn-default" data-dismiss="modal">关闭 | ||
112 | + </button> | ||
113 | + <button type="submit" class="btn btn-primary" value="Validate">提交</button> | ||
114 | + </div> | ||
115 | + </div> | ||
116 | + <!-- /.modal-content --> | ||
117 | + </div> | ||
118 | + <!-- /.modal --> | ||
119 | +</div> | ||
120 | +</div> | ||
59 | <script> | 121 | <script> |
60 | $(function () { | 122 | $(function () { |
61 | $("#table").table({ | 123 | $("#table").table({ |
@@ -87,10 +149,9 @@ | @@ -87,10 +149,9 @@ | ||
87 | 149 | ||
88 | formatter: function (value, rowData, rowIndex) { | 150 | formatter: function (value, rowData, rowIndex) { |
89 | var div = $("<div>"); | 151 | var div = $("<div>"); |
90 | - var editBtn = $("<button>").addClass("btn btn-inverse btn-mini").html("修改").appendTo(div); | 152 | + var editBtn = $("<button data-target='#myModal' data-toggle='modal'>").addClass("btn btn-inverse btn-mini").html("修改").appendTo(div); |
91 | //修改 | 153 | //修改 |
92 | editBtn.click(function () { | 154 | editBtn.click(function () { |
93 | - alert(rowData.moId); | ||
94 | }); | 155 | }); |
95 | div.append(" "); | 156 | div.append(" "); |
96 | var delBtn = $("<button>").addClass("btn btn-danger btn-mini").html("删除").appendTo(div); | 157 | var delBtn = $("<button>").addClass("btn btn-danger btn-mini").html("删除").appendTo(div); |
@@ -163,5 +224,16 @@ | @@ -163,5 +224,16 @@ | ||
163 | function editbtn() { | 224 | function editbtn() { |
164 | alert(2); | 225 | alert(2); |
165 | } | 226 | } |
227 | + | ||
228 | + | ||
166 | </script> | 229 | </script> |
167 | 230 | ||
231 | +<script src="js/jquery.min.js"></script> | ||
232 | +<script src="js/jquery.ui.custom.js"></script> | ||
233 | +<script src="js/bootstrap.min.js"></script> | ||
234 | +<script src="js/jquery.uniform.js"></script> | ||
235 | +<script src="js/select2.min.js"></script> | ||
236 | +<script src="js/jquery.validate.js"></script> | ||
237 | +<script src="js/unicorn.js"></script> | ||
238 | +<script src="js/unicorn.form_validation.js"></script> | ||
239 | + |
@@ -289,8 +289,6 @@ | @@ -289,8 +289,6 @@ | ||
289 | alert("请选择节点"); | 289 | alert("请选择节点"); |
290 | } | 290 | } |
291 | var checkValue = []; | 291 | var checkValue = []; |
292 | - $.each(data, function(i,val){ | ||
293 | - }); | ||
294 | 292 | ||
295 | alert(checkValue); | 293 | alert(checkValue); |
296 | $("#inBoxQueryDiv").form("submit", { | 294 | $("#inBoxQueryDiv").form("submit", { |
-
Please register or login to post a comment