Merge "Add warning for stale subunit2sql data"
This commit is contained in:
commit
136be737a6
38
app/js/directives/fresh-check.js
Normal file
38
app/js/directives/fresh-check.js
Normal file
@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
var directivesModule = require('./_index.js');
|
||||
|
||||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
function freshCheck() {
|
||||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
var controller = function($scope, healthService) {
|
||||
$scope.status = null;
|
||||
$scope.date = null;
|
||||
|
||||
healthService.getRecentGroupedRuns('build_queue', 'gate', {
|
||||
num_runs: 1
|
||||
}).then(function(response) {
|
||||
var lastRun = response.data[0];
|
||||
var today = new Date();
|
||||
var runDate = new Date(lastRun.start_date);
|
||||
var diffSecs = (today - runDate) / 1000;
|
||||
var diffDays = diffSecs / (60 * 60 * 24);
|
||||
if (diffSecs > (60 * 60 * 24)) {
|
||||
$scope.status = 'stale';
|
||||
$scope.date = runDate;
|
||||
}
|
||||
});
|
||||
};
|
||||
return {
|
||||
restrict : 'EA',
|
||||
templateUrl: 'fresh-check.html',
|
||||
scope: true,
|
||||
controller: controller
|
||||
};
|
||||
}
|
||||
|
||||
directivesModule.directive('freshCheck', freshCheck);
|
5
app/views/fresh-check.html
Normal file
5
app/views/fresh-check.html
Normal file
@ -0,0 +1,5 @@
|
||||
<div class="alert alert-warning" ng-if="status == 'stale'">
|
||||
<fa name="exclamation-triangle"></fa>
|
||||
The last data in the subunit2sql database is >1 day old. There might be an
|
||||
issue with result collection.
|
||||
</div>
|
@ -11,6 +11,7 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<loading-indicator></loading-indicator>
|
||||
<fresh-check></fresh-check>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -7,6 +7,7 @@
|
||||
show-resolution="true"
|
||||
show-period="true"></crumb-menu>
|
||||
<loading-indicator></loading-indicator>
|
||||
<fresh-check></fresh-check>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -11,6 +11,7 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<loading-indicator></loading-indicator>
|
||||
<fresh-check></fresh-check>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -11,6 +11,7 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<loading-indicator></loading-indicator>
|
||||
<fresh-check></fresh-check>
|
||||
</div>
|
||||
</div>
|
||||
<div class=row>
|
||||
|
@ -9,6 +9,7 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<loading-indicator></loading-indicator>
|
||||
<fresh-check></fresh-check>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -9,6 +9,7 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<loading-indicator></loading-indicator>
|
||||
<fresh-check></fresh-check>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
Loading…
Reference in New Issue
Block a user