aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/common/report.html.j2
blob: ab76510ca634b5d589925c27c18bcce3d9c3791c (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<html>

<!--
 Copyright (c) 2017 Rajesh Kudaka <4k.rajesh@gmail.com>
 Copyright (c) 2018 Intel Corporation.

 All rights reserved. This program and the accompanying materials
 are made available under the terms of the Apache License, Version 2.0
 which accompanies this distribution, and is available at
 http://www.apache.org/licenses/LICENSE-2.0
-->

    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        <script src="https://code.highcharts.com/highcharts.js"></script>

        <style>
            table {
                overflow-y: scroll;
                height: 360px;
                display: block;
            }
            header {
                font-family: Frutiger;
                clear: left;
                text-align: center;
            }
        </style>
    </head>

    <body>
        <header class="jumbotron text-center">
            <h1>Yardstick User Interface</h1>
            <h4>Report of {{task_id}} Generated</h4>
        </header>

        <div class="container">
            <div class="row">
                <div class="col-md-4">
                    <div class="table-responsive">
                        <table class="table table-hover"></table>
                    </div>
                </div>
                <div class="col-md-8">
                    <div id="container"></div>
                </div>
            </div>
        </div>

        <script>
            var arr, tab, th, tr, td, tn, row, col, thead, tbody;
            arr = {{table|safe}};
            tab = document.getElementsByTagName('table')[0];

            thead = document.createElement('thead');
            tr = document.createElement('tr');
            for (col = 0; col < Object.keys(arr).length; col++) {
                th = document.createElement('th');
                tn = document.createTextNode(Object.keys(arr).sort()[col]);
                th.appendChild(tn);
                tr.appendChild(th);
                thead.appendChild(tr);
            }
            tab.appendChild(thead);

            tbody = document.createElement('tbody');
            for (row = 0; row < arr[Object.keys(arr)[0]].length; row++) {
                tr = document.createElement('tr');
                for (col = 0; col < Object.keys(arr).length; col++) {
                    td = document.createElement('td');
                    tn = document.createTextNode(arr[Object.keys(arr).sort()[col]][row]);
                    td.appendChild(tn);
                    tr.appendChild(td);
                }
                tbody.appendChild(tr);
            }
            tab.appendChild(tbody);

            $(function() {
                $('#container').highcharts({
                    title: {
                        text: 'Yardstick test results',
                        x: -20, //center
                    },
                    subtitle: {
                        text: 'Report of {{task_id}} Task Generated',
                        x: -20,
                    },
                    xAxis: {
                        title: {
                            text: 'Timestamp',
                        },
                        categories: {{Timestamps|safe}},
                    },
                    yAxis: {
                        plotLines: [{
                            value: 0,
                            width: 1,
                            color: '#808080',
                        }],
                    },
                    tooltip: {
                        valueSuffix: '',
                    },
                    legend: {
                        layout: 'vertical',
                        align: 'right',
                        verticalAlign: 'middle',
                        borderWidth: 0,
                    },
                    series: {{series|safe}},
                });
            });
        </script>
    </body>
</html>