1 #############################################################################
2 # Copyright (c) 2017 Rajesh Kudaka
4 # Author: Rajesh Kudaka 4k.rajesh@gmail.com
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #############################################################################
15 <meta charset="utf-8">
16 <meta name="viewport" content="width=device-width, initial-scale=1">
17 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7\
18 /css/bootstrap.min.css">
19 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1\
20 /jquery.min.js"></script>
21 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7\
22 /js/bootstrap.min.js"></script>
23 <script src="https://code.highcharts.com/highcharts.js"></script>
24 <script src="jquery.min.js"></script>
25 <script src="highcharts.js"></script>
41 <header class="jumbotron text-center">
42 <h1>Yardstick User Interface</h1>
43 <h4>Report of {{task_id}} Generated</h4>
46 <div class="container">
48 <div class="col-md-4">
49 <div class="table-responsive" >
50 <table class="table table-hover" > </table>
53 <div class="col-md-8" >
54 <div id="container" ></div>
59 var arr, tab, th, tr, td, tn, row, col, thead, tbody;
61 tab = document.getElementsByTagName('table')[0];
62 thead=document.createElement('thead');
63 tr = document.createElement('tr');
64 for(row=0;row<Object.keys(arr).length;row++)
66 th = document.createElement('th');
67 tn = document.createTextNode(Object.keys(arr).sort()[row]);
70 thead.appendChild(tr);
72 tab.appendChild(thead);
73 tbody=document.createElement('tbody');
75 for (col = 0; col < arr[Object.keys(arr)[0]].length; col++){
76 tr = document.createElement('tr');
77 for(row=0;row<Object.keys(arr).length;row++)
79 td = document.createElement('td');
80 tn = document.createTextNode(arr[Object.keys(arr).sort()[row]][col]);
84 tbody.appendChild(tr);
86 tab.appendChild(tbody);
90 <script language="JavaScript">
93 $('#container').highcharts({
95 text: 'Yardstick test results',
99 text: 'Report of {{task_id}} Task Generated',
106 categories:{{Timestamp|safe}}
122 verticalAlign: 'middle',
125 series: {{series|safe}}
135 report_template = """
138 <title>Yardstick Report</title>
139 <link href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css\
140 /bootstrap.min.css" rel="stylesheet">
142 <div class="content">
143 <h3>Yardstick Report </h3>
147 <div>Task ID : {{result.task_id}} </div>
148 <div style="margin-top:5px;">Criteria :
149 <font> {{result.criteria}}</font>
153 <caption>Information</caption>
154 <table class="table table-striped">
161 {% for key, value in result.info.items() %}
163 <td>{{ loop.index }}</td>
172 <caption>Test Cases</caption>
173 <table class="table table-striped">
180 {% for key, value in result.testcases.items() %}
182 <td>{{ loop.index }}</td>
184 <td>{{value.criteria}}</td>