1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

[system_tracking] Display message when dates for retrieved data change

This commit is contained in:
Joe Fiorini 2015-06-22 11:03:12 -04:00
parent 336a8f23bd
commit 2955cfbfe8
4 changed files with 33 additions and 4 deletions

View File

@ -14,7 +14,8 @@ export default
scope: { scope: {
date: '=', date: '=',
minDate: '=', minDate: '=',
autoUpdate: '=?' autoUpdate: '=?',
inputClass: '&'
}, },
templateUrl: '/static/js/system-tracking/date-picker/date-picker.partial.html', templateUrl: '/static/js/system-tracking/date-picker/date-picker.partial.html',
link: function(scope, element, attrs) { link: function(scope, element, attrs) {

View File

@ -4,6 +4,7 @@
class="DatePicker-input" class="DatePicker-input"
type="text" type="text"
readonly readonly
ng-model="dateValue"> ng-model="dateValue"
ng-class="inputClass()">
<p class="error" ng-if="error">{{error}}</p> <p class="error" ng-if="error">{{error}}</p>
</div> </div>

View File

@ -72,6 +72,8 @@ function controller($rootScope,
$scope.leftDataNoScans = false; $scope.leftDataNoScans = false;
$scope.rightDataNoScans = false; $scope.rightDataNoScans = false;
$scope.leftDateWarning = false;
$scope.rightDateWarning = false;
waitIndicator('start'); waitIndicator('start');
@ -97,6 +99,10 @@ function controller($rootScope,
$scope.leftScanDate = $scope.leftDate; $scope.leftScanDate = $scope.leftDate;
} else { } else {
$scope.leftScanDate = moment(responses[0].timestamp); $scope.leftScanDate = moment(responses[0].timestamp);
if (!$scope.leftScanDate.isSame($scope.leftDate, 'd')) {
$scope.leftDateWarning = true;
}
} }
if (_.isEmpty(data[1])) { if (_.isEmpty(data[1])) {
@ -104,6 +110,10 @@ function controller($rootScope,
$scope.rightScanDate = $scope.rightDate; $scope.rightScanDate = $scope.rightDate;
} else { } else {
$scope.rightScanDate = moment(responses[1].timestamp); $scope.rightScanDate = moment(responses[1].timestamp);
if (!$scope.rightScanDate.isSame($scope.rightDate, 'd')) {
$scope.rightDateWarning = true;
}
} }
return data; return data;

View File

@ -21,11 +21,28 @@
<div class="FactModulePickers"> <div class="FactModulePickers">
<div class="FactModulePickers-dateContainer FactModulePickers-dateContainer--left"> <div class="FactModulePickers-dateContainer FactModulePickers-dateContainer--left">
<span class="FactModulePickers-label">{{ factModulePickersLabelLeft }}</span> <span class="FactModulePickers-label">{{ factModulePickersLabelLeft }}</span>
<date-picker date="leftDate"></date-picker> <date-picker
date="leftDate"
input-class='{ "u-input-info-alert": leftDateWarning }'>
</date-picker>
<span
class="FactModulePickers-warning"
ng-class='{ "u-hiddenVisually": !leftDateWarning, "u-info-alert": leftDateWarning }'>
There were no fact scans on this date, using a prior scan instead.
</span>
</div> </div>
<div class="FactModulePickers-dateContainer FactModulePickers-dateContainer--right" ng-show="compareMode == 'single-host'"> <div class="FactModulePickers-dateContainer FactModulePickers-dateContainer--right" ng-show="compareMode == 'single-host'">
<span class="FactModulePickers-label">{{ factModulePickersLabelRight }}</span> <span class="FactModulePickers-label">{{ factModulePickersLabelRight }}</span>
<date-picker date="rightDate" min-date="leftDate"></date-picker> <date-picker
date="rightDate"
min-date="leftDate"
input-class='{ "u-input-info-alert": rightDateWarning }'>
</date-picker>
<span
class="FactModulePickers-warning"
ng-class='{ "u-hiddenVisually": !rightDateWarning, "u-info-alert": rightDateWarning }'>
There were no fact scans on this date, using a prior scan instead.
</span>
</div> </div>
</div> </div>