diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2016-09-29 15:23:01 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-09-29 15:23:01 +0000 |
commit | 6a082c66d6f14ba8801e0a02fe5bd193c2a32f68 (patch) | |
tree | aab4b2a46b5d3779eff91c6e4f61a80a3a5e82d7 /utils/test/reporting/functest/template/index-status-tmpl.html | |
parent | e30a45c0a8d598a4765dbd14c266271065719a70 (diff) | |
parent | b24f036bc4817ec3f8ee29593c93721f826a6264 (diff) |
Merge "Add a trend line to Functest reporting And use d3js lib rather than static images"
Diffstat (limited to 'utils/test/reporting/functest/template/index-status-tmpl.html')
-rw-r--r-- | utils/test/reporting/functest/template/index-status-tmpl.html | 96 |
1 files changed, 60 insertions, 36 deletions
diff --git a/utils/test/reporting/functest/template/index-status-tmpl.html b/utils/test/reporting/functest/template/index-status-tmpl.html index 67c23491a..2beb9128e 100644 --- a/utils/test/reporting/functest/template/index-status-tmpl.html +++ b/utils/test/reporting/functest/template/index-status-tmpl.html @@ -3,17 +3,65 @@ <meta charset="utf-8"> <!-- Bootstrap core CSS --> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"> - <link href="default.css" rel="stylesheet"> + <link href="../../../css/default.css" rel="stylesheet"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> - <script type="text/javascript"> - $(document).ready(function (){ - $(".btn-more").click(function() { - $(this).hide(); - $(this).parent().find(".panel-default").show(); + <script type="text/javascript" src="http://d3js.org/d3.v2.min.js"></script> + <script type="text/javascript" src="../../../js/gauge.js"></script> + <script type="text/javascript" src="../../../js/trend.js"></script> + <script> + function onDocumentReady() { + // Gauge management + {% for scenario in scenario_stats.iteritems() -%} + var gaugeScenario{{loop.index}} = gauge('#gaugeScenario{{loop.index}}'); + {%- endfor %} + + // assign success rate to the gauge + function updateReadings() { + {% for scenario,iteration in scenario_stats.iteritems() -%} + gaugeScenario{{loop.index}}.update({{scenario_results[scenario].getScorePercent()}}); + {%- endfor %} + } + updateReadings(); + } + + // trend line management + d3.csv("./scenario_history.txt", function(data) { + // *************************************** + // Create the trend line + {% for scenario,iteration in scenario_stats.iteritems() -%} + // for scenario {{scenario}} + // Filter results + var trend{{loop.index}} = data.filter(function(row) { + return row["scenario"]=="{{scenario}}" && row["installer"]=="{{installer}}"; + }) + // Parse the date + trend{{loop.index}}.forEach(function(d) { + d.date = parseDate(d.date); + d.score = +d.score }); - }) - </script> + // Draw the trend line + var mytrend = trend("#trend_svg{{loop.index}}",trend{{loop.index}}) + // **************************************** + {%- endfor %} + }); + if ( !window.isLoaded ) { + window.addEventListener("load", function() { + onDocumentReady(); + }, false); + } else { + onDocumentReady(); + } +</script> +<script type="text/javascript"> +$(document).ready(function (){ + $(".btn-more").click(function() { + $(this).hide(); + $(this).parent().find(".panel-default").show(); + }); +}) +</script> + </head> <body> <div class="container"> @@ -40,41 +88,17 @@ <div class="panel-heading"><h4><b>List of last scenarios ({{version}}) run over the last {{period}} days </b></h4></div> <table class="table"> <tr> - <th width="60%">Scenario</th> + <th width="40%">Scenario</th> <th width="20%">Status</th> + <th width="20%">Trend</th> <th width="10%">Score</th> <th width="10%">Iteration</th> </tr> {% for scenario,iteration in scenario_stats.iteritems() -%} <tr class="tr-ok"> <td><a href={{scenario_results[scenario].getUrlLastRun()}}>{{scenario}}</a></td> - <td>{%if scenario_results[scenario].getScorePercent() < 8.3 -%} - <img src="../../img/gauge_0.png"> - {%elif scenario_results[scenario].getScorePercent() < 16.7 -%} - <img src="../../img/gauge_8.3.png"> - {%elif scenario_results[scenario].getScorePercent() < 25 -%} - <img src="../../img/gauge_16.7.png"> - {%elif scenario_results[scenario].getScorePercent() < 33.3 -%} - <img src="../../img/gauge_25.png"> - {%elif scenario_results[scenario].getScorePercent() < 41.7 -%} - <img src="../../img/gauge_33.3.png"> - {%elif scenario_results[scenario].getScorePercent() < 50 -%} - <img src="../../img/gauge_41.7.png"> - {%elif scenario_results[scenario].getScorePercent() < 58.3 -%} - <img src="../../img/gauge_50.png"> - {%elif scenario_results[scenario].getScorePercent() < 66.7 -%} - <img src="../../img/gauge_58.3.png"> - {%elif scenario_results[scenario].getScorePercent() < 75 -%} - <img src="../../img/gauge_66.7.png"> - {%elif scenario_results[scenario].getScorePercent() < 83.3 -%} - <img src="../../img/gauge_75.png"> - {%elif scenario_results[scenario].getScorePercent() < 91.7 -%} - <img src="../../img/gauge_83.3.png"> - {%elif scenario_results[scenario].getScorePercent() < 100 -%} - <img src="../../img/gauge_91.7.png"> - {%- else -%} - <img src="../../img/gauge_100.png"> - {%- endif %}</td> + <td><div id="gaugeScenario{{loop.index}}"></div></td> + <td><div id="trend_svg{{loop.index}}"></div></td> <td>{{scenario_results[scenario].getScore()}}</td> <td>{{iteration}}</td> </tr> |