Authored by simba

Merge branch 'master' of http://git.yoho.cn/ops/monitor-ui

@@ -5,14 +5,18 @@ package com.ui.contants; @@ -5,14 +5,18 @@ package com.ui.contants;
5 */ 5 */
6 public class HttpUriContants { 6 public class HttpUriContants {
7 7
8 - /*** 机组信息 ****/ 8 + /***
  9 + * 机组信息
  10 + ****/
9 public static final String HOST_GROUP_GETALL = "/hostGroup/getHostGroups"; 11 public static final String HOST_GROUP_GETALL = "/hostGroup/getHostGroups";
10 public static final String HOST_GROUP_SAVE = "/hostGroup/saveHostGroup"; 12 public static final String HOST_GROUP_SAVE = "/hostGroup/saveHostGroup";
11 public static final String HOST_GROUP_DELETE = "/hostGroup/delHostGroup"; 13 public static final String HOST_GROUP_DELETE = "/hostGroup/delHostGroup";
12 14
13 public static final String HOST_ALL_GROUPS = "/hostGroup/getAllGroups"; 15 public static final String HOST_ALL_GROUPS = "/hostGroup/getAllGroups";
14 16
15 - /*** 机组信息 ****/ 17 + /***
  18 + * 机组信息
  19 + ****/
16 20
17 //类型信息 21 //类型信息
18 public static String TYPE_GET_ALL = "/type/query"; 22 public static String TYPE_GET_ALL = "/type/query";
@@ -22,7 +26,9 @@ public class HttpUriContants { @@ -22,7 +26,9 @@ public class HttpUriContants {
22 public static String TYPE_QUERY_NODE = "/type/queryNode"; 26 public static String TYPE_QUERY_NODE = "/type/queryNode";
23 public static String TYPE_QUERY_JAVAAPI = "/type/queryJavaApi"; 27 public static String TYPE_QUERY_JAVAAPI = "/type/queryJavaApi";
24 28
25 - /*** 主机信息 ****/ 29 + /***
  30 + * 主机信息
  31 + ****/
26 public static final String GET_HOST_INFOS = "/hostInfo/getHostInfos"; 32 public static final String GET_HOST_INFOS = "/hostInfo/getHostInfos";
27 33
28 public static final String SAVE_HOST_INFOS = "/hostInfo/saveHostInfo"; 34 public static final String SAVE_HOST_INFOS = "/hostInfo/saveHostInfo";
@@ -30,7 +36,9 @@ public class HttpUriContants { @@ -30,7 +36,9 @@ public class HttpUriContants {
30 public static final String DEL_HOST_INFOS = "/hostInfo/delHostInfo"; 36 public static final String DEL_HOST_INFOS = "/hostInfo/delHostInfo";
31 37
32 public static final String GET_HOST_INFO_BY_ID = "/hostInfo/getHostInfoById"; 38 public static final String GET_HOST_INFO_BY_ID = "/hostInfo/getHostInfoById";
33 - /*** 主机信息 ****/ 39 + /***
  40 + * 主机信息
  41 + ****/
34 42
35 43
36 //java服务信息 44 //java服务信息
@@ -38,8 +46,10 @@ public class HttpUriContants { @@ -38,8 +46,10 @@ public class HttpUriContants {
38 public static final String JAVA_API_DEL = "/javaApi/del"; 46 public static final String JAVA_API_DEL = "/javaApi/del";
39 public static final String JAVA_API_SAVE = "/javaApi/save"; 47 public static final String JAVA_API_SAVE = "/javaApi/save";
40 public static final String JAVA_API_STATUS = "/javaApiStatus/query"; 48 public static final String JAVA_API_STATUS = "/javaApiStatus/query";
  49 + public static final String JAVA_API_HIS = "/javaApiStatus/queryhis";
41 50
42 -  
43 - /*** ZK监控信息查询 ****/ 51 + /***
  52 + * ZK监控信息查询
  53 + ****/
44 public static final String GET_ZK_INFO = "/zkMonitor/getZkMonitorRecords"; 54 public static final String GET_ZK_INFO = "/zkMonitor/getZkMonitorRecords";
45 } 55 }
@@ -18,7 +18,9 @@ import org.springframework.web.bind.annotation.RequestParam; @@ -18,7 +18,9 @@ import org.springframework.web.bind.annotation.RequestParam;
18 import org.springframework.web.bind.annotation.ResponseBody; 18 import org.springframework.web.bind.annotation.ResponseBody;
19 19
20 import java.util.ArrayList; 20 import java.util.ArrayList;
  21 +import java.util.HashMap;
21 import java.util.List; 22 import java.util.List;
  23 +import java.util.Map;
22 24
23 /** 25 /**
24 * Created by fruwei on 2016/6/17. 26 * Created by fruwei on 2016/6/17.
@@ -88,5 +90,30 @@ public class JavaAPICtrl { @@ -88,5 +90,30 @@ public class JavaAPICtrl {
88 return rep; 90 return rep;
89 } 91 }
90 92
  93 + @RequestMapping("/history")
  94 + @ResponseBody
  95 + public BaseResponse getHistory(@RequestParam(required = false, defaultValue = "0") int api_id,
  96 + @RequestParam(required = false, defaultValue = "0") int mobj_id,
  97 + @RequestParam(required = false, defaultValue = "0") long start_time,
  98 + @RequestParam(required = false, defaultValue = "0") long end_time,
  99 + @RequestParam(required = false, defaultValue = "0") int page) {
  100 +
  101 + Map<String, String> param = new HashMap<String, String>();
  102 + param.put("api_id", "" + api_id);
  103 + param.put("mobj_id", "" + mobj_id);
  104 + param.put("start_time", "" + start_time);
  105 + param.put("end_time", "" + end_time);
  106 + param.put("page", "" + page);
  107 +
  108 + BaseResponse rep;
  109 + try {
  110 + rep = httpClient.defaultGet(HttpUriContants.JAVA_API_HIS, BaseResponse.class, param);
91 111
  112 + } catch (Exception e) {
  113 + rep = new BaseResponse(400);
  114 + rep.setMessage("list format error");
  115 +
  116 + }
  117 + return rep;
  118 + }
92 } 119 }
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 </select> 27 </select>
28 </div> 28 </div>
29 <div class="input-group" style="float: left;"> 29 <div class="input-group" style="float: left;">
30 - <span class="input-group-addon">请求类型:</span> 30 + <span class="input-g roup-addon">请求类型:</span>
31 <select id="searchApiReqMethod" name="searchApiReqMethod" class="form-control"> 31 <select id="searchApiReqMethod" name="searchApiReqMethod" class="form-control">
32 <option value="2">ALL</option> 32 <option value="2">ALL</option>
33 <option value="0">GET</option> 33 <option value="0">GET</option>
@@ -5,7 +5,12 @@ @@ -5,7 +5,12 @@
5 + request.getServerName() + ":" + request.getServerPort() 5 + request.getServerName() + ":" + request.getServerPort()
6 + path + "/"; 6 + path + "/";
7 7
8 - String id = request.getParameter("id"); 8 + String api_id = request.getParameter("api_id");
  9 + if (api_id == null)
  10 + api_id = "0";
  11 + String mobj_id = request.getParameter("mobj_id");
  12 + if (mobj_id == null)
  13 + mobj_id = "0";
9 %> 14 %>
10 15
11 16
@@ -62,38 +67,64 @@ @@ -62,38 +67,64 @@
62 </style> 67 </style>
63 </head> 68 </head>
64 <body> 69 <body>
65 -<div class="container-fluid">  
66 - <div class="row">  
67 - <div id="info" class="content" >  
68 - <div class="form-group">  
69 - <label class="col-sm-2">服务名:</label> 70 +<div id="breadcrumb">
  71 + <a href="#" title="Go to Home" class="tip-bottom"><i
  72 + class="icon-home"></i> Java服务</a> <a href="#" class="current">服务历史信息</a>
  73 +</div>
70 74
71 - <div class="col-sm-8">  
72 - <input type="text" id="apiName" name="apiName" maxlength="30"  
73 - size="40"/> 75 +<div class="container-fluid">
  76 + <div class="widget-box">
  77 + <div class="widget-title">
  78 + <h5>Java服务历史</h5>
  79 + </div>
  80 + <div class="widget-content nopadding">
  81 + <div class="widget-title" style="height: 53px;">
  82 + <div>
  83 + <div class="form-inline" role="form" id="inBoxQueryDiv"
  84 + style=" margin-top: 12px;margin-left: 25px;float: left;">
  85 + <div class="input-group" style="float: left;">
  86 + <span class="input-group-addon">服务名:</span>
  87 + <input type="text" id="searchApiName" name="apiName" class="form-control" placeholder=""/>
  88 + </div>
  89 + <%--<div class="input-group" style="float: left;">--%>
  90 + <%--<span class="input-group-addon">服务类型:</span>--%>
  91 + <%--<select id="searchApiType" name="searchApiType" class="form-control" placeholder="">--%>
  92 + <%--<option value="0">ALL</option>--%>
  93 + <%--</select>--%>
  94 + <%--</div>--%>
  95 + <%--<div class="input-group" style="float: left;">--%>
  96 + <%--<span class="input-group-addon">请求类型:</span>--%>
  97 + <%--<select id="searchApiReqMethod" name="searchApiReqMethod" class="form-control">--%>
  98 + <%--<option value="2">ALL</option>--%>
  99 + <%--<option value="0">GET</option>--%>
  100 + <%--<option value="1">POST</option>--%>
  101 + <%--</select>--%>
  102 + <%--</div>--%>
  103 + <div class="input-group" style="float: left;">
  104 + <span class="input-group-addon">url:</span>
  105 + <input type="text" id="searchapiUrl" name="apiUrl" class="form-control" placeholder=""/>
  106 + </div>
  107 + <%--<button id="searchJavaInfoBtn" class="btn btn-default">搜索</button>--%>
  108 + </div>
74 </div> 109 </div>
75 </div> 110 </div>
76 - </div>  
77 - </div>  
78 - <div class="row">  
79 - <div id="infoTable"> 111 + <div id="infoTable">
80 112
  113 + </div>
81 </div> 114 </div>
82 -  
83 </div> 115 </div>
84 </div> 116 </div>
85 </body> 117 </body>
86 </html> 118 </html>
87 <script type="text/javascript"> 119 <script type="text/javascript">
88 - var api_id =<%=id %>; 120 + var api_id =<%=api_id %>;
  121 + var mobj_id =<%=mobj_id %>;
89 //加载表格 122 //加载表格
90 $(function () { 123 $(function () {
91 -  
92 - return ;  
93 //加载表格 124 //加载表格
94 $("#infoTable").table({ 125 $("#infoTable").table({
95 columnAutoWidth: false, 126 columnAutoWidth: false,
96 - url: contextPath + "/javaApi/queryOne?id" + api_id, 127 + url: contextPath + "/javaApi/history?api_id=" + api_id + "&mobj_id=" + mobj_id,
97 striped: true, 128 striped: true,
98 title: "java服务信息历史", 129 title: "java服务信息历史",
99 dataType: "json", 130 dataType: "json",
@@ -109,41 +140,61 @@ @@ -109,41 +140,61 @@
109 // refreshJavaAppStatus(); 140 // refreshJavaAppStatus();
110 // }, 141 // },
111 columns: [{ 142 columns: [{
112 - title: "ID",  
113 - field: "serviceId",  
114 - width: "2%"  
115 - }, {  
116 - title: "start",  
117 - field: "startTime",  
118 - width: "14%" 143 + title: "time",
  144 + field: "time",
  145 + width: "8%"
119 }, 146 },
120 { 147 {
121 - title: "end",  
122 - field: "endTime", 148 + title: "IP",
  149 + field: "mIp",
123 width: "10%" 150 width: "10%"
124 }, 151 },
125 { 152 {
126 - title: "是否错误", 153 + title: "端口",
  154 + field: "mPort",
  155 + width: "4%"
  156 + },
  157 + {
  158 + title: "start",
  159 + field: "startTime",
  160 + width: "8%"
  161 + },
  162 + {
  163 + title: "响应时间",
  164 + field: "endTime",
  165 + width: "8%"
  166 + },
  167 + {
  168 + title: "耗时(ms)",
  169 + field: "costTime",
  170 + width: "6%"
  171 + },
  172 + {
  173 + title: "status",
127 field: "isException", 174 field: "isException",
128 formatter: function (value, rowData, rowIndex) { 175 formatter: function (value, rowData, rowIndex) {
  176 + if (rowData.status == 0)
  177 + return "fail";
  178 + else
  179 + return "ok";
129 }, 180 },
130 - width: "8%"  
131 -  
132 - }, {  
133 - title: "Exception",  
134 - field: "exception",  
135 width: "4%" 181 width: "4%"
136 182
137 }, { 183 }, {
138 - title: "响应结果",  
139 - field: "response",  
140 - width: "4%" 184 + title: "Result",
  185 + field: "exception",
  186 + formatter: function (value, rowData, rowIndex) {
  187 + if (rowData.status == 0)
  188 + return rowData.exception;
  189 + else
  190 + return rowData.response;
  191 + },
  192 + width: "50%"
141 193
142 }] 194 }]
143 }); 195 });
144 }); 196 });
145 197
146 -  
147 </script> 198 </script>
148 199
149 200