summaryrefslogtreecommitdiff
path: root/src/main/webapp/WEB-INF/jsp/show_performance_digest.jsp
blob: 224d8474ea89679e078d0493b23e0d43f0be2426 (plain)
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
<%--
  ~ Copyright (c) 2016 Google Inc. All Rights Reserved.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License"); you
  ~ may not use this file except in compliance with the License. You may
  ~ obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  ~ implied. See the License for the specific language governing
  ~ permissions and limitations under the License.
  --%>
<%@ page contentType='text/html;charset=UTF-8' language='java' %>
<%@ taglib prefix='fn' uri='http://java.sun.com/jsp/jstl/functions' %>
<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core'%>

<html>
  <%@ include file="header.jsp" %>
  <link type='text/css' href='/css/datepicker.css' rel='stylesheet'>
  <link type='text/css' href='/css/show_performance_digest.css' rel='stylesheet'>
  <link rel='stylesheet' href='https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.0/jquery-ui.css'>
  <script src='https://www.gstatic.com/external_hosted/moment/min/moment-with-locales.min.js'></script>
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
  <body>
    <script type='text/javascript'>
        ONE_DAY = 86400000000;
        MICRO_PER_MILLI = 1000;

        function load() {
            var time = $('#date').datepicker('getDate').getTime() - 1;
            time = time * MICRO_PER_MILLI + ONE_DAY;  // end of day
            var ctx = '${pageContext.request.contextPath}';
            var link = ctx + '/show_performance_digest?profilingPoint=${profilingPointName}' +
                '&testName=${testName}' +
                '&startTime=' + time;
            if ($('#device-select').prop('selectedIndex') > 1) {
                link += '&device=' + $('#device-select').val();
            }
            window.open(link,'_self');
        }

        $(function() {
            var date = $('#date').datepicker({
                showAnim: "slideDown",
                maxDate: new Date()
            });
            date.datepicker('setDate', new Date(${startTime} / MICRO_PER_MILLI));
            $('#load').click(load);

            $('.date-label').each(function(i) {
                var label = $(this);
                label.html(moment(parseInt(label.html())).format('M/D/YY'));
            });
            $('select').material_select();
        });
    </script>
    <div class='wide container'>
      <div class='row card'>
        <div id='header-container' class='col s12'>
          <div class='col s12'>
            <h4>Daily Performance Digest</h4>
          </div>
          <div id='device-select-wrapper' class='input-field col s6 m3 offset-m6'>
            <select id='device-select'>
              <option value='' disabled>Select device</option>
              <option value='0' ${empty selectedDevice ? 'selected' : ''}>All Devices</option>
              <c:forEach items='${devices}' var='device' varStatus='loop'>
                <option value=${device} ${selectedDevice eq device ? 'selected' : ''}>${device}</option>
              </c:forEach>
            </select>
          </div>
          <input type='text' id='date' name='date' class='col s5 m2'>
          <a id='load' class='btn-floating btn-medium red right waves-effect waves-light'>
            <i class='medium material-icons'>cached</i>
          </a>
        </div>
      </div>
      <div class='row'>
        <c:forEach items='${tables}' var='table' varStatus='loop'>
          <div class='col s12 card summary'>
            <div class='col s3 valign'>
              <h5>Profiling Point:</h5>
            </div>
            <div class='col s9 right-align valign'>
              <h5 class="profiling-name truncate">${tableTitles[loop.index]}</h5>
            </div>
            ${table}
            <span class='profiling-subtitle'>
              ${tableSubtitles[loop.index]}
            </span>
          </div>
        </c:forEach>
      </div>
    </div>
    <%@ include file="footer.jsp" %>
  </body>
</html>