metric.jsp
5.18 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
<%@ 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.metric.Context" scope="request"/>
<jsp:useBean id="payload" type="com.dianping.cat.report.page.metric.Payload" scope="request"/>
<jsp:useBean id="model" type="com.dianping.cat.report.page.metric.Model" scope="request"/>
<c:choose>
<c:when test="${payload.fullScreen}">
<res:bean id="res" />
<res:useCss value='${res.css.local.body_css}' target="head-css" />
<res:useCss value="${res.css.local['bootstrap.css']}" target="head-css" />
<script src='${model.webapp}/assets/js/jquery.min.js'> </script>
<res:useJs value="${res.js.local['bootstrap.min.js']}" target="head-js" />
<res:useJs value="${res.js.local['highcharts.js']}" target="head-js"/>
<res:useJs value="${res.js.local['baseGraph.js']}" target="head-js"/>
<c:forEach var="item" items="${model.lineCharts}" varStatus="status">
<div style="float:left;">
<div id="${item.id}" class="metricGraph"></div>
</div>
</c:forEach>
</c:when>
<c:otherwise>
<a:body>
<res:useJs value="${res.js.local['baseGraph.js']}" target="head-js"/>
<div class="report">
<div class="breadcrumbs" id="breadcrumbs">
<span class="text-danger title">【报表时间】</span><span class="text-success"> ${w:format(model.startTime,'yyyy-MM-dd HH:mm:ss')} to ${w:format(model.endTime,'yyyy-MM-dd HH:mm:ss')}</span>
<!-- #section:basics/content.searchbox -->
<div class="nav-search nav" id="nav-search">
<c:forEach var="nav" items="${model.navs}">
[ <a href="${model.baseUri}?op=view&tag=${payload.tag}&date=${model.date}&domain=${model.domain}&step=${nav.hours}&timeRange=${payload.timeRange}&product=${payload.product}&${navUrlPrefix}">${nav.title}</a> ]
</c:forEach>
[ <a href="${model.baseUri}?op=view&tag=${payload.tag}&${navUrlPrefix}&product=${payload.product}&timeRange=${payload.timeRange}">now</a> ]
</div></div>
<table>
<tr style="text-align: left">
<th> 业务
<select id="productId" onchange="productChange()">
<c:forEach var="item" items="${model.tags}" varStatus="status">
<option value="t_${item}">标签_${item}</option>
</c:forEach>
<c:forEach var="item" items="${model.productLines}" varStatus="status">
<option value="p_${item.id}">产品线_${item.title}</option>
</c:forEach>
</select>
时间段
<c:forEach var="range" items="${model.allRange}">
<c:choose>
<c:when test="${payload.timeRange eq range.duration}">
[ <a href="?op=view&tag=${payload.tag}&date=${model.date}&domain=${model.domain}&product=${payload.product}&timeRange=${range.duration}" class="current">${range.title}</a> ]
</c:when>
<c:otherwise>
[ <a href="?op=view&tag=${payload.tag}&date=${model.date}&domain=${model.domain}&product=${payload.product}&timeRange=${range.duration}">${range.title}</a> ]
</c:otherwise>
</c:choose>
</c:forEach>
</th>
<th class="text-right">
</th>
</tr>
</table>
<div class="col-xs-12">
<c:forEach var="item" items="${model.lineCharts}" varStatus="status">
<div style="float:left;">
<div id="${item.id}" class="metricGraph" style="width:450px;height:350px;"></div>
</div>
</c:forEach></div>
</div>
</a:body>
</c:otherwise>
</c:choose>
<%@ include file="metricOpNav.jsp" %>
<script type="text/javascript">
function productChange(){
var date='${model.date}';
var domain='${model.domain}';
var product=$('#productId').val();
var timeRange=${payload.timeRange};
var newProduct = product.substring(2,product.length);
if(product.charAt(0)=='t'){
href = "?date="+date+"&domain="+domain+"&timeRange="+timeRange+"&tag="+newProduct;
}else{
href = "?date="+date+"&domain="+domain+"&product="+newProduct+"&timeRange="+timeRange;
}
window.location.href=href;
}
$(document).ready(function() {
<c:forEach var="item" items="${model.lineCharts}" varStatus="status">
var data = ${item.jsonString};
graphMetricChart(document.getElementById('${item.id}'), data);
</c:forEach>
var tag= '${payload.tag}';
if(tag!=null&&tag!=''){
$('#productId').val('t_'+tag);
}else{
var product = '${payload.product}';
$('#productId').val('p_'+product);
}
var hide =${payload.hideNav};
if(hide){
$('.opNav').slideUp();
$('#switch').html("显示");
}
$('#Dashboard_report').addClass("open active");
$('#dashbord_metric').addClass("active");
});
function showOpNav() {
var b = $('#switch').html();
if (b == '隐藏') {
$('.opNav').slideUp();
$('#switch').html("显示");
} else {
$('.opNav').slideDown();
$('#switch').html("隐藏");
}
}
</script>
<style type="text/css">
.row-fluid .span2{
width:10%;
}
.row-fluid .span10{
width:87%;
}
</style>