app.jsp 10.8 KB
Newer Older
Y
youyong205 已提交
1
<%@ page contentType="text/html; charset=utf-8"%>
Y
youyong205 已提交
2 3 4 5
<%@ 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"%>
J
resolve  
jialinsun 已提交
6 7 8
<jsp:useBean id="ctx" type="com.dianping.cat.report.page.app.Context" scope="request" />
<jsp:useBean id="payload" type="com.dianping.cat.report.page.app.Payload" scope="request" />
<jsp:useBean id="model" type="com.dianping.cat.report.page.app.Model" scope="request" />
Y
youyong205 已提交
9 10 11

<a:body>
	<res:useCss value="${res.css.local['select2.css']}" target="head-css" />
J
resolve  
jialinsun 已提交
12 13 14
	<res:useCss
		value="${res.css.local['bootstrap-datetimepicker.min.css']}"
		target="head-css" />
Y
youyong205 已提交
15
	<res:useJs value="${res.js.local['select2.min.js']}" target="head-js" />
J
resolve  
jialinsun 已提交
16 17
	<res:useJs value="${res.js.local['bootstrap-datetimepicker.min.js']}"
		target="head-js" />
Y
youyong205 已提交
18 19
	<res:useJs value="${res.js.local['baseGraph.js']}" target="head-js" />
	<script type="text/javascript">
Y
youyong205 已提交
20 21
		var commandInfo = ${model.command};
		function check() {
Y
youyong205 已提交
22
			var value = document.getElementById("checkbox").checked;
Y
youyong205 已提交
23 24

			if (value == true) {
Y
youyong205 已提交
25
				$('#history').slideDown();
Y
youyong205 已提交
26 27
				command2Change();
			} else {
Y
youyong205 已提交
28 29
				$('#history').slideUp();
			}
Y
youyong205 已提交
30
		}
Y
youyong205 已提交
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
		var command1Change = function command1Change() {
			var key = $("#command").val();
			var value = commandInfo[key];
			var code = document.getElementById("code");
			for ( var prop in value) {
				var opt = $('<option />');

				opt.html(value[prop].name);
				opt.val(value[prop].id);
				opt.appendTo(code);
			}
		}
		var command2Change = function command2Change() {
			var key = $("#command2").val();
			var value = commandInfo[key];
			var code = document.getElementById("code2");
			for ( var prop in value) {
				var opt = $('<option />');

				opt.html(value[prop].name);
				opt.val(value[prop].id);
				opt.appendTo(code);
			}
		}

		function getDate() {
			var myDate = new Date();

			return myDate.getFullYear() + "-" + myDate.getMonth() + "-"
					+ myDate.getDate();
		}
J
resolve  
jialinsun 已提交
62

Y
youyong205 已提交
63 64
		function query() {
			var time = $("#time").val();
Y
youyong205 已提交
65
			var command = $("#command").val();
Y
youyong205 已提交
66 67 68 69 70 71 72 73 74 75 76 77
			var code = $("#code").val();
			var network = $("#network").val();
			var version = $("#version").val();
			var channel = $("#channel").val();
			var palteform = $("#platform").val();
			var city = $("#city").val();
			var operator = $("#operator").val();
			var split = ";";
			var query1 = time + split + command + split + code + split
					+ network + split + version + split + channel + split
					+ palteform + split + city + split + operator;
			var query2 = "";
Y
youyong205 已提交
78
			var value = document.getElementById("checkbox").checked;
Y
youyong205 已提交
79 80

			if (value == true) {
Y
youyong205 已提交
81 82
				var time2 = $("#time2").val();
				var command2 = $("#command2").val();
Y
youyong205 已提交
83 84 85 86 87 88 89 90 91 92 93
				var code2 = $("#code2").val();
				var network2 = $("#network2").val();
				var version2 = $("#version2").val();
				var channel2 = $("#channel2").val();
				var palteform2 = $("#platform2").val();
				var city2 = $("#city2").val();
				var operator2 = $("#operator2").val();
				query2 = time2 + split + command2 + split + code2 + split
						+ network2 + split + version2 + split + channel2
						+ split + palteform2 + split + city2 + split
						+ operator2;
Y
youyong205 已提交
94
			}
J
resolve  
jialinsun 已提交
95 96 97 98 99 100 101 102 103 104
			
			var checkboxs = document.getElementsByName("typeCheckbox");
			var type = "";
			
			for(var i=0; i<checkboxs.length;i++){
				if(checkboxs[i].checked){
					type = checkboxs[i].value;
					break;
				}
			}
Y
youyong205 已提交
105

J
resolve  
jialinsun 已提交
106
			var href = "?query1=" + query1 + "&query2=" + query2 + "&type=" + type;
Y
youyong205 已提交
107
			window.location.href = href;
Y
youyong205 已提交
108 109 110 111 112
		}

		$(document).ready(function() {
			$('#datetimepicker1').datetimepicker();
			$('#datetimepicker2').datetimepicker();
Y
youyong205 已提交
113 114 115 116 117

			var query1 = '${payload.query1}';
			var query2 = '${payload.query2}';
			var command1 = $('#command');
			var command2 = $('#command2');
Y
youyong205 已提交
118
			var words = query1.split(";");
Y
youyong205 已提交
119 120 121 122

			command1.on('change', command1Change);
			command2.on('change', command2Change);

Y
youyong205 已提交
123
			$("#command").val(words[1]);
J
resolve  
jialinsun 已提交
124 125

			if (words[0] == null || words[0].length == 0) {
Y
youyong205 已提交
126
				$("#time").val(getDate());
J
resolve  
jialinsun 已提交
127
			} else {
Y
youyong205 已提交
128 129 130
				$("#time").val(words[0]);
			}
			
J
resolve  
jialinsun 已提交
131

Y
youyong205 已提交
132
			command1Change();
Y
youyong205 已提交
133 134 135 136
			$("#code").val(words[2]);
			$("#network").val(words[3]);
			$("#version").val(words[4]);
			$("#channel").val(words[5]);
Y
youyong205 已提交
137
			$("#platform").val(words[6]);
Y
youyong205 已提交
138 139 140
			$("#city").val(words[7]);
			$("#operator").val(words[8]);

Y
youyong205 已提交
141
			if (query2 != null && query2 != '') {
Y
youyong205 已提交
142 143 144
				$('#history').slideDown();
				document.getElementById("checkbox").checked = true;
				var words = query2.split(";");
Y
youyong205 已提交
145

J
resolve  
jialinsun 已提交
146
				if (words[0] == null || words[0].length == 0) {
Y
youyong205 已提交
147
					$("#time2").val(getDate());
J
resolve  
jialinsun 已提交
148
				} else {
Y
youyong205 已提交
149 150 151
					$("#time2").val(words[0]);
				}

Y
youyong205 已提交
152
				$("#command2").val(words[1]);
Y
youyong205 已提交
153
				command2Change();
Y
youyong205 已提交
154 155 156 157
				$("#code2").val(words[2]);
				$("#network2").val(words[3]);
				$("#version2").val(words[4]);
				$("#channel2").val(words[5]);
Y
youyong205 已提交
158
				$("#platform2").val(words[6]);
Y
youyong205 已提交
159 160
				$("#city2").val(words[7]);
				$("#operator2").val(words[8]);
J
resolve  
jialinsun 已提交
161
			} else {
Y
youyong205 已提交
162
				$("#time2").val(getDate());
Y
youyong205 已提交
163
			}
J
resolve  
jialinsun 已提交
164 165 166 167 168 169 170 171 172 173 174
			
			var checkboxs = document.getElementsByName("typeCheckbox");
			
			for(var i=0; i<checkboxs.length;i++){
				if(checkboxs[i].value == "${payload.type}"){
					checkboxs[i].checked = true;
					break;
				}
			}
			
			var data = ${model.lineChart.jsonString};
J
jialinsun 已提交
175
			graphMetricChartForApp(document.getElementById('${model.lineChart.id}'), data);
J
resolve  
jialinsun 已提交
176
			
Y
youyong205 已提交
177
		});
Y
youyong205 已提交
178 179 180 181
	</script>
	<div class="report">
		<table>
			<tr>
Y
youyong205 已提交
182 183 184 185 186 187 188 189 190
				<th align=left>时间
					<div id="datetimepicker1" class="input-append date"
						style="margin-bottom: 0px;">
						<input id="time" name="time" style="height: 30px; width: 150px;"
							data-format="yyyy-MM-dd" type="text"></input> <span
							class="add-on"> <i data-time-icon="icon-time"
							data-date-icon="icon-calendar"> </i>
						</span>
					</div> 命令字 <select id="command" style="width: 350px;">
J
jialinsun 已提交
191
						<option value='0' >All</option>
Y
youyong205 已提交
192 193 194
						<c:forEach var="item" items="${model.commands}" varStatus="status">
							<option value='${item.id}'>${item.name}</option>
						</c:forEach>
J
jialinsun 已提交
195
				</select> 返回码 <select id="code" style="width: 120px;"><option value='0' >All</option>
Y
youyong205 已提交
196
				</select> 网络类型 <select id="network" style="width: 80px;">
J
jialinsun 已提交
197
						<option value='0' >All</option>
Y
youyong205 已提交
198 199 200
						<c:forEach var="item" items="${model.networks}" varStatus="status">
							<option value='${item.id}'>${item.name}</option>
						</c:forEach>
Y
youyong205 已提交
201
				</select>
Y
youyong205 已提交
202 203 204
				</th>
			</tr>
			<tr>
Y
youyong205 已提交
205
				<th align=left>版本 <select id="version" style="width: 100px;">
J
jialinsun 已提交
206
						<option value='0' >All</option>
Y
youyong205 已提交
207 208 209 210
						<c:forEach var="item" items="${model.versions}" varStatus="status">
							<option value='${item.id}'>${item.name}</option>
						</c:forEach>
				</select> 渠道 <select id="channel" style="width: 100px;">
J
jialinsun 已提交
211
						<option value='0' >All</option>
Y
youyong205 已提交
212 213 214 215
						<c:forEach var="item" items="${model.channels}" varStatus="status">
							<option value='${item.id}'>${item.name}</option>
						</c:forEach>
				</select> 平台 <select id="platform" style="width: 100px;">
J
jialinsun 已提交
216
						<option value='0' >All</option>
Y
youyong205 已提交
217 218 219 220 221
						<c:forEach var="item" items="${model.platforms}"
							varStatus="status">
							<option value='${item.id}'>${item.name}</option>
						</c:forEach>
				</select> 地区 <select id="city" style="width: 100px;">
J
jialinsun 已提交
222
						<option value='0' >All</option>
Y
youyong205 已提交
223 224 225 226
						<c:forEach var="item" items="${model.cities}" varStatus="status">
							<option value='${item.id}'>${item.name}</option>
						</c:forEach>
				</select> 运营商 <select id="operator" style="width: 100px;">
J
jialinsun 已提交
227
						<option value='0' >All</option>
Y
youyong205 已提交
228 229 230 231 232 233 234 235 236
						<c:forEach var="item" items="${model.operators}"
							varStatus="status">
							<option value='${item.id}'>${item.name}</option>
						</c:forEach>
				</select> <input class="btn btn-primary "
					value="&nbsp;&nbsp;&nbsp;查询&nbsp;&nbsp;&nbsp;" onclick="query()"
					type="submit" /> <input class="btn btn-primary" id="checkbox"
					onclick="check()" type="checkbox" /> <label for="checkbox"
					style="display: -webkit-inline-box">选择历史对比</label>
Y
youyong205 已提交
237 238 239
				</th>
			</tr>
		</table>
Y
youyong205 已提交
240
		<table id="history" style="display: none">
Y
youyong205 已提交
241
			<tr>
Y
youyong205 已提交
242 243 244 245 246 247 248 249 250
				<th align=left>时间
					<div id="datetimepicker2" class="input-append date"
						style="margin-bottom: 0px;">
						<input id="time2" name="time2" style="height: 30px; width: 150px;"
							data-format="yyyy-MM-dd" type="text"></input> <span
							class="add-on"> <i data-time-icon="icon-time"
							data-date-icon="icon-calendar"> </i>
						</span>
					</div> 命令字 <select id="command2" style="width: 350px;">
J
jialinsun 已提交
251
						<option value='0' >All</option>
Y
youyong205 已提交
252 253 254 255
						<c:forEach var="item" items="${model.commands}" varStatus="status">
							<option value='${item.id}'>${item.name}</option>
						</c:forEach>
				</select> 返回码 <select id="code2" style="width: 120px;">
J
jialinsun 已提交
256
						<option value='0' >All</option>
Y
youyong205 已提交
257
				</select> 网络类型 <select id="network2" style="width: 80px;">
J
jialinsun 已提交
258
						<option value='0' >All</option>
Y
youyong205 已提交
259 260 261
						<c:forEach var="item" items="${model.networks}" varStatus="status">
							<option value='${item.id}'>${item.name}</option>
						</c:forEach>
Y
youyong205 已提交
262
				</select>
Y
youyong205 已提交
263 264 265
				</th>
			</tr>
			<tr>
Y
youyong205 已提交
266
				<th align=left>版本 <select id="version2" style="width: 100px;">
J
jialinsun 已提交
267
						<option value='0' >All</option>
Y
youyong205 已提交
268 269 270 271
						<c:forEach var="item" items="${model.versions}" varStatus="status">
							<option value='${item.id}'>${item.name}</option>
						</c:forEach>
				</select> 渠道 <select id="channel2" style="width: 100px;">
J
jialinsun 已提交
272
						<option value='0' >All</option>
Y
youyong205 已提交
273 274 275 276
						<c:forEach var="item" items="${model.channels}" varStatus="status">
							<option value='${item.id}'>${item.name}</option>
						</c:forEach>
				</select> 平台 <select id="platform2" style="width: 100px;">
J
jialinsun 已提交
277
						<option value='0' >All</option>
Y
youyong205 已提交
278 279 280 281 282
						<c:forEach var="item" items="${model.platforms}"
							varStatus="status">
							<option value='${item.id}'>${item.name}</option>
						</c:forEach>
				</select> 地区 <select id="city2" style="width: 100px;">
J
jialinsun 已提交
283
						<option value='0' >All</option>
Y
youyong205 已提交
284 285 286 287
						<c:forEach var="item" items="${model.cities}" varStatus="status">
							<option value='${item.id}'>${item.name}</option>
						</c:forEach>
				</select> 运营商 <select id="operator2" style="width: 100px;">
J
jialinsun 已提交
288
						<option value='0' >All</option>
Y
youyong205 已提交
289 290 291 292
						<c:forEach var="item" items="${model.operators}"
							varStatus="status">
							<option value='${item.id}'>${item.name}</option>
						</c:forEach>
Y
youyong205 已提交
293
				</select>
Y
youyong205 已提交
294 295 296 297
				</th>
			</tr>
		</table>

J
resolve  
jialinsun 已提交
298 299
		<div class="btn-group" data-toggle="buttons">
			<label class="btn btn-info"> <input type="radio"
J
jialinsun 已提交
300
				name="typeCheckbox" value="successRatio" onclick="query()" >成功率
J
resolve  
jialinsun 已提交
301
			</label> <label class="btn btn-info"> <input type="radio"
J
jialinsun 已提交
302
				name="typeCheckbox" value="requestCount" onclick="query()" >总请求数
J
resolve  
jialinsun 已提交
303
			</label> <label class="btn btn-info"> <input type="radio"
J
jialinsun 已提交
304
				name="typeCheckbox" value="delayAvg" onclick="query()" >成功延时(ms)
J
resolve  
jialinsun 已提交
305 306 307 308 309 310 311
			</label>
		</div>

		<div style="float:left;width:95%;">
			<div id="${model.lineChart.id}"></div>
		</div>

Y
youyong205 已提交
312 313 314 315 316 317 318
		<table class="footer">
			<tr>
				<td>[ end ]</td>
			</tr>
		</table>
	</div>
</a:body>