app.jsp 10.2 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 62 63
		var command1Change = function command1Change() {
			var key = $("#command").val();
			var value = commandInfo[key];
			var code = document.getElementById("code");
			code.length = 0;
			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");
			code.length = 0;
			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 已提交
64

Y
youyong205 已提交
65 66
		function query() {
			var time = $("#time").val();
Y
youyong205 已提交
67
			var command = $("#command").val();
Y
youyong205 已提交
68 69 70 71 72 73 74 75 76 77 78 79
			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 已提交
80
			var value = document.getElementById("checkbox").checked;
Y
youyong205 已提交
81 82

			if (value == true) {
Y
youyong205 已提交
83 84
				var time2 = $("#time2").val();
				var command2 = $("#command2").val();
Y
youyong205 已提交
85 86 87 88 89 90 91 92 93 94 95
				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 已提交
96
			}
J
resolve  
jialinsun 已提交
97 98 99 100 101 102 103 104 105 106
			
			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 已提交
107

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

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

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

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

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

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

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

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

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

Y
youyong205 已提交
154
				$("#command2").val(words[1]);
Y
youyong205 已提交
155
				command2Change();
Y
youyong205 已提交
156 157 158 159
				$("#code2").val(words[2]);
				$("#network2").val(words[3]);
				$("#version2").val(words[4]);
				$("#channel2").val(words[5]);
Y
youyong205 已提交
160
				$("#platform2").val(words[6]);
Y
youyong205 已提交
161 162
				$("#city2").val(words[7]);
				$("#operator2").val(words[8]);
J
resolve  
jialinsun 已提交
163
			} else {
Y
youyong205 已提交
164
				$("#time2").val(getDate());
Y
youyong205 已提交
165
			}
J
resolve  
jialinsun 已提交
166 167 168 169 170 171 172 173 174 175 176 177 178
			
			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};
			graphMetricChart2(document.getElementById('${model.lineChart.id}'), data);
			
Y
youyong205 已提交
179
		});
Y
youyong205 已提交
180 181 182 183
	</script>
	<div class="report">
		<table>
			<tr>
Y
youyong205 已提交
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
				<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;">
						<c:forEach var="item" items="${model.commands}" varStatus="status">
							<option value='${item.id}'>${item.name}</option>
						</c:forEach>
				</select> 返回码 <select id="code" style="width: 120px;">
				</select> 网络类型 <select id="network" style="width: 80px;">
						<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 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
				<th align=left>版本 <select id="version" style="width: 100px;">
						<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;">
						<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;">
						<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;">
						<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;">
						<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 已提交
232 233 234
				</th>
			</tr>
		</table>
Y
youyong205 已提交
235
		<table id="history" style="display: none">
Y
youyong205 已提交
236
			<tr>
Y
youyong205 已提交
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
				<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;">
						<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;">
				</select> 网络类型 <select id="network2" style="width: 80px;">
						<c:forEach var="item" items="${model.networks}" varStatus="status">
							<option value='${item.id}'>${item.name}</option>
						</c:forEach>
Y
youyong205 已提交
254
				</select>
Y
youyong205 已提交
255 256 257
				</th>
			</tr>
			<tr>
Y
youyong205 已提交
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279
				<th align=left>版本 <select id="version2" style="width: 100px;">
						<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;">
						<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;">
						<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;">
						<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;">
						<c:forEach var="item" items="${model.operators}"
							varStatus="status">
							<option value='${item.id}'>${item.name}</option>
						</c:forEach>
Y
youyong205 已提交
280
				</select>
Y
youyong205 已提交
281 282 283 284
				</th>
			</tr>
		</table>

J
resolve  
jialinsun 已提交
285 286 287 288 289 290 291 292 293 294 295 296 297 298
		<div class="btn-group" data-toggle="buttons">
			<label class="btn btn-info"> <input type="radio"
				name="typeCheckbox" value="successRatio">成功率
			</label> <label class="btn btn-info"> <input type="radio"
				name="typeCheckbox" value="requestCount">总请求数
			</label> <label class="btn btn-info"> <input type="radio"
				name="typeCheckbox" value="delayAvg">成功延时(ms)
			</label>
		</div>

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

Y
youyong205 已提交
299 300 301 302 303 304 305
		<table class="footer">
			<tr>
				<td>[ end ]</td>
			</tr>
		</table>
	</div>
</a:body>