system.jsp
6.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="a" uri="/WEB-INF/app.tld"%>
<%@ taglib prefix="w" uri="http://www.unidal.org/web/core"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="res" uri="http://www.unidal.org/webres"%>
<jsp:useBean id="ctx" type="com.dianping.cat.report.page.system.Context" scope="request" />
<jsp:useBean id="payload" type="com.dianping.cat.report.page.system.Payload" scope="request" />
<jsp:useBean id="model" type="com.dianping.cat.report.page.system.Model" scope="request" />
<a:body>
<link rel="stylesheet" type="text/css" href="${model.webapp}/js/jquery.datetimepicker.css"/>
<script src="${model.webapp}/js/jquery.datetimepicker.js"></script>
<res:useJs value="${res.js.local['baseGraph.js']}" target="head-js" />
<script type="text/javascript">
function query() {
var domain = $("#search").val();
var type = $("#type").val();
var start = $("#startTime").val();
var end = $("#endTime").val();
var ipAddrs = '';
if("${model.ipAddrs}" != "[]") {
ipAddrs = "${model.ipAddrs}".replace(/[\[\]]/g,'').split(', ');
}
var curIpAddrs = '';
var num = 0;
if(document.getElementById("ipAll").checked == false && ipAddrs.length > 0) {
for( var i=0; i<ipAddrs.length; i++){
var ip = "ip_" + ipAddrs[i];
if(document.getElementById(ip).checked){
curIpAddrs += ipAddrs[i] + "_";
}
}
curIpAddrs = curIpAddrs.substring(0, curIpAddrs.length-1);
}else{
curIpAddrs = "All";
}
window.location.href = "?domain=" + domain + "&type=" + type
+ "&ipAddrs=" + curIpAddrs + "&startDate=" + start + "&endDate="
+ end;
}
function clickAll() {
var ipAddrs = '';
if("${model.ipAddrs}" != "[]"){
var ipAddrs = "${model.ipAddrs}".replace(/[\[\]]/g,'').split(', ');
}
for( var i=0; i<ipAddrs.length; i++){
var ip = "ip_" + ipAddrs[i];
document.getElementById(ip).checked = document.getElementById("ipAll").checked;
}
}
function clickIp() {
var ipAddrs = '';
if("${model.ipAddrs}" != "[]") {
ipAddrs = "${model.ipAddrs}".replace(/[\[\]]/g,'').split(', ');
}
var num = 0;
for( var i=0; i<ipAddrs.length; i++){
var ip = "ip_" + ipAddrs[i];
if(document.getElementById(ip).checked){
num ++;
}else{
document.getElementById("ipAll").checked = false;
break;
}
}
if(num == ipAddrs.length) {
document.getElementById("ipAll").checked = true;
}
}
$(document).ready(
function() {
$('#startTime').datetimepicker({
format:'Y-m-d H:i',
step:30,
maxDate:0
});
$('#endTime').datetimepicker({
format:'Y-m-d H:i',
step:30,
maxDate:0
});
$('#startTime').val("${w:format(model.startTime,'yyyy-MM-dd HH:mm')}");
$('#endTime').val("${w:format(model.endTime,'yyyy-MM-dd HH:mm')}");
$('#type').val('${payload.type}');
$('#domain').val('${payload.domain}');
$('#System_report').addClass('active open');
$('#system_paas').addClass('active');
var curIpAddrs = '';
if("${payload.ipAddrs}" == ''){
document.getElementById("ipAll").checked = false;
}else if("${payload.ipAddrs}" == 'All'){
if("${model.ipAddrs}" != "[]"){
curIpAddrs = "${model.ipAddrs}".replace(/[\[\]]/g,'').split(', ');
document.getElementById("ipAll").checked = true;
}
}else{
var curIpAddrStr = "${payload.ipAddrs}";
curIpAddrs = curIpAddrStr.split("_");
}
for(var i=0; i<curIpAddrs.length; i++) {
document.getElementById("ip_" + curIpAddrs[i]).checked = true;
}
$.widget( "custom.catcomplete", $.ui.autocomplete, {
_renderMenu: function( ul, items ) {
var that = this,
currentCategory = "";
$.each( items, function( index, item ) {
if ( item.category != currentCategory ) {
ul.append( "<li class='ui-autocomplete-category'>" + item.category + "</li>" );
currentCategory = item.category;
}
that._renderItemData( ul, item );
});
}
});
var data = [];
<c:forEach var="item" items="${model.productLines}">
var item = {};
item['label'] = '${item}';
item['category'] = '产品线';
data.push(item);
</c:forEach>
$( "#search" ).catcomplete({
delay: 0,
source: data
});
$("#search_go").bind("click",function(e){
query();
});
$('#wrap_search').submit(
function(){
query();
return false;
}
);
var domain = '${payload.domain}';
if(domain != ''){
$('#search').val(domain);
}
var type = '${payload.type}';
if(type != ''){
$('#type').val(type);
}
<c:forEach var="item" items="${model.lineCharts}" varStatus="status">
var data = ${item.jsonString};
graphMetricChart(document.getElementById('${item.id}'), data);
</c:forEach>
});
</script>
<table>
<tr>
<th class="left">
<div style="float:left;">
开始
<input type="text" id="startTime" style="width:150px;"/>
结束
<input type="text" id="endTime" style="width:150px;"/></div>
查询类型<select style="width: 100px;" name="type" id="type" >
<option value="paasSystem">Paas系统</option>
<!-- option value="system">系统</option>
<option value="jvm">JVM</option>
<option value="nginx">Nginx</option> -->
</select>
</th>
<th> </th>
<th>
<div class="navbar-header pull-left position" style="width:350px;">
<form id="wrap_search" style="margin-bottom:0px;">
<div class="input-group">
<input id="search" type="text" class="search-input form-control ui-autocomplete-input" placeholder="input domain for search" autocomplete="off"/>
<span class="input-group-btn">
<button class="btn btn-sm btn-primary" type="button" id="search_go">
Go
</button>
</span>
</div>
</form>
</div>
</th>
</tr>
</table>
<div>
<label class="btn btn-sm btn-info"><input type="checkbox" id="ipAll" onclick="clickAll()" unchecked>All</label><c:forEach var="item" items="${model.ipAddrs}" varStatus="status"><label class="btn btn-sm btn-info"><input type="checkbox" id="ip_${item}" value="${item}" onclick="clickIp()" unchecked>${item}</label></c:forEach>
</div>
<div>
<c:forEach var="item" items="${model.lineCharts}" varStatus="status">
<div style="float:left;">
<div id="${item.id}" class="metricGraph"></div>
</div>
</c:forEach>
</div>
</a:body>