1<%--
2  ~ Copyright (c) 2016 Google Inc. All Rights Reserved.
3  ~
4  ~ Licensed under the Apache License, Version 2.0 (the "License"); you
5  ~ may not use this file except in compliance with the License. You may
6  ~ obtain a copy of the License at
7  ~
8  ~     http://www.apache.org/licenses/LICENSE-2.0
9  ~
10  ~ Unless required by applicable law or agreed to in writing, software
11  ~ distributed under the License is distributed on an "AS IS" BASIS,
12  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13  ~ implied. See the License for the specific language governing
14  ~ permissions and limitations under the License.
15  --%>
16<%@ page contentType='text/html;charset=UTF-8' language='java' %>
17<%@ taglib prefix='fn' uri='http://java.sun.com/jsp/jstl/functions' %>
18<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core'%>
19
20<html>
21  <%@ include file="header.jsp" %>
22  <link type='text/css' href='/css/datepicker.css' rel='stylesheet'>
23  <link type='text/css' href='/css/show_performance_digest.css' rel='stylesheet'>
24  <link rel='stylesheet' href='https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.0/jquery-ui.css'>
25  <script src='https://www.gstatic.com/external_hosted/moment/min/moment-with-locales.min.js'></script>
26  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
27  <body>
28    <script type='text/javascript'>
29        ONE_DAY = 86400000000;
30        MICRO_PER_MILLI = 1000;
31
32        function load() {
33            var time = $('#date').datepicker('getDate').getTime() - 1;
34            time = time * MICRO_PER_MILLI + ONE_DAY;  // end of day
35            var ctx = '${pageContext.request.contextPath}';
36            var link = ctx + '/show_performance_digest?profilingPoint=${profilingPointName}' +
37                '&testName=${testName}' +
38                '&startTime=' + time;
39            if ($('#device-select').prop('selectedIndex') > 1) {
40                link += '&device=' + $('#device-select').val();
41            }
42            window.open(link,'_self');
43        }
44
45        $(function() {
46            var date = $('#date').datepicker({
47                showAnim: "slideDown",
48                maxDate: new Date()
49            });
50            date.datepicker('setDate', new Date(${startTime} / MICRO_PER_MILLI));
51            $('#load').click(load);
52
53            $('.date-label').each(function(i) {
54                var label = $(this);
55                label.html(moment(parseInt(label.html())).format('M/D/YY'));
56            });
57            $('select').material_select();
58        });
59    </script>
60    <div class='wide container'>
61      <div class='row card'>
62        <div id='header-container' class='col s12'>
63          <div class='col s12'>
64            <h4>Daily Performance Digest</h4>
65          </div>
66          <div id='device-select-wrapper' class='input-field col s6 m3 offset-m6'>
67            <select id='device-select'>
68              <option value='' disabled>Select device</option>
69              <option value='0' ${empty selectedDevice ? 'selected' : ''}>All Devices</option>
70              <c:forEach items='${devices}' var='device' varStatus='loop'>
71                <option value=${device} ${selectedDevice eq device ? 'selected' : ''}>${device}</option>
72              </c:forEach>
73            </select>
74          </div>
75          <input type='text' id='date' name='date' class='col s5 m2'>
76          <a id='load' class='btn-floating btn-medium red right waves-effect waves-light'>
77            <i class='medium material-icons'>cached</i>
78          </a>
79        </div>
80      </div>
81      <div class='row'>
82        <c:forEach items='${tables}' var='table' varStatus='loop'>
83          <div class='col s12 card summary'>
84            <div class='col s3 valign'>
85              <h5>Profiling Point:</h5>
86            </div>
87            <div class='col s9 right-align valign'>
88              <h5 class="profiling-name truncate">${tableTitles[loop.index]}</h5>
89            </div>
90            ${table}
91            <span class='profiling-subtitle'>
92              ${tableSubtitles[loop.index]}
93            </span>
94          </div>
95        </c:forEach>
96      </div>
97    </div>
98    <%@ include file="footer.jsp" %>
99  </body>
100</html>
101