From 9b6d1ffbeb3c1c5d018ae27271af83e964e7976f Mon Sep 17 00:00:00 2001 From: Tim Buckley Date: Mon, 2 Nov 2015 16:19:28 -0700 Subject: [PATCH] Add summary info to home page. This patch adds basic summary information to the tempest dataset summary on the home page. Additionally, it allows users to select between all available datasets, if more than one is specified in the configuration file. Failing tests are displayed directly on the front page, and a future patch will allow direct navigation to details of failing tests. Co-Authored-By: Austin Clark Change-Id: Ic08a4dd86b36f513acf8e50c1fb7d7a102876e1c --- app/js/controllers/home.js | 1 + app/js/directives/tempest-summary.js | 7 +++- app/js/filters/seconds-time.js | 24 ++++++++++++ app/views/directives/tempest-summary.html | 46 +++++++++++++++++++++-- app/views/home.html | 26 +++++++++---- 5 files changed, 91 insertions(+), 13 deletions(-) create mode 100644 app/js/filters/seconds-time.js diff --git a/app/js/controllers/home.js b/app/js/controllers/home.js index 2368de1..c2dbee6 100644 --- a/app/js/controllers/home.js +++ b/app/js/controllers/home.js @@ -9,6 +9,7 @@ function HomeCtrl(datasetService) { // ViewModel var vm = this; + vm.focus = 0; datasetService.list().then(function(response) { vm.tempest = response.data.tempest; diff --git a/app/js/directives/tempest-summary.js b/app/js/directives/tempest-summary.js index 68809cb..18a16b1 100644 --- a/app/js/directives/tempest-summary.js +++ b/app/js/directives/tempest-summary.js @@ -7,8 +7,11 @@ var directivesModule = require('./_index.js'); */ function tempestSummary() { var controller = function($scope, $attrs, datasetService) { - // TODO get extra data here - // (may require raw details, or extra metadata inside config.json) + $scope.$watch('dataset', function(dataset) { + var stats = dataset.stats; + $scope.stats = stats; + $scope.timeDiff = (new Date(stats.end) - new Date(stats.start)) / 1000; + }); }; return { diff --git a/app/js/filters/seconds-time.js b/app/js/filters/seconds-time.js new file mode 100644 index 0000000..e0e14e6 --- /dev/null +++ b/app/js/filters/seconds-time.js @@ -0,0 +1,24 @@ +'use strict'; + +var d3 = require('d3'); + +var filtersModule = require('./_index.js'); + +var secondsToTime = function(seconds) { + var format = d3.format('02d'); + + var hours = Math.floor(seconds / 60 / 60); + seconds = seconds - (hours * 60 * 60); + + var minutes = Math.floor(seconds / 60); + seconds = Math.floor(seconds - minutes * 60); + + var ret = format(minutes) + ':' + format(seconds); + if (hours > 0) { + ret = hours + ':' + ret; + } + + return ret; +}; + +filtersModule.filter('secondsToTime', function() { return secondsToTime; }); diff --git a/app/views/directives/tempest-summary.html b/app/views/directives/tempest-summary.html index 9a8c1ab..bc1d4fa 100644 --- a/app/views/directives/tempest-summary.html +++ b/app/views/directives/tempest-summary.html @@ -1,15 +1,55 @@
-

{{ dataset.name }}

+

+ {{dataset.name}} + + {{stats.start | date:'d MMM, yyyy'}} + +

- More details go here +
+ {{timeDiff | secondsToTime}} +
+ runtime +
+
+ {{stats.count}} +
+ tests run +
+
+ {{stats.failures.length}} +
+ failed +
+
+ {{stats.skips.length}} +
+ skipped +
+ +
+
+

Failures

+
+ diff --git a/app/views/home.html b/app/views/home.html index 8899451..ff1f5a7 100644 --- a/app/views/home.html +++ b/app/views/home.html @@ -15,7 +15,7 @@
- +
@@ -23,14 +23,24 @@

Additional Datasets

- + + + {{dataset.stats.start | date:'MM/d/yyyy'}} + + + + Details + + +