Dirk Vogt | 62ff7f2 | 2017-05-04 16:07:21 +0200 | [diff] [blame] | 1 | <div class="panel datatable" > |
| 2 | <h2>{{ title }}</h2> |
| 3 | <table id = "{{element_name}}" class="display table table-striped" ></table> |
| 4 | </div> |
| 5 | <script> |
| 6 | |
| 7 | $(document).ready(function() { |
| 8 | console.log("Generating report table"); |
| 9 | $.getJSON( "{% url 'hiccup_stats_api_v1_device_overview' uuid %}", function(json_response) { |
| 10 | dataSet = []; |
| 11 | dataSet.push(["UUID:", json_response.uuid]); |
Dirk Vogt | 7439ee7 | 2017-12-05 15:51:17 +0100 | [diff] [blame^] | 12 | dataSet.push(["Board Date:", new Date(json_response.board_date).toDateString()]); |
| 13 | dataSet.push(["Last Active:", new Date(json_response.last_active).toDateString()]); |
Dirk Vogt | 62ff7f2 | 2017-05-04 16:07:21 +0200 | [diff] [blame] | 14 | dataSet.push(["HeartBeats sent:", json_response.heartbeats]); |
| 15 | dataSet.push(["Prob. Crashes:", json_response.crashreports]); |
| 16 | dataSet.push(["Prob. Crashes per Day:", json_response.crashes_per_day.toFixed(2)]); |
| 17 | dataSet.push(["SMPLs:", json_response.smpls]); |
| 18 | dataSet.push(["SMPLs per Day:", json_response.smpl_per_day.toFixed(2)]); |
| 19 | $('#{{element_name}}').DataTable( { |
| 20 | data: dataSet, |
| 21 | columns: [ |
| 22 | { title: "", className: "dt_col_h1"}, |
| 23 | { title: "" }, |
| 24 | ] |
| 25 | } ); |
| 26 | }); |
| 27 | }); |
| 28 | |
| 29 | </script> |