From 336a8f23bd0341b3302312190cca46ab9f6704d1 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Mon, 22 Jun 2015 11:02:49 -0400 Subject: [PATCH] fixed error reporting on system tracking --- .../fact-data-error.block.less | 4 +- .../fact-module-filter.block.less | 1 + .../system-tracking.controller.js | 59 ++++++++++++++----- .../system-tracking.partial.html | 22 +++++-- 4 files changed, 65 insertions(+), 21 deletions(-) diff --git a/awx/ui/static/js/system-tracking/fact-data-table/fact-data-error.block.less b/awx/ui/static/js/system-tracking/fact-data-table/fact-data-error.block.less index 941cf9e0f7..301ab13d48 100644 --- a/awx/ui/static/js/system-tracking/fact-data-table/fact-data-error.block.less +++ b/awx/ui/static/js/system-tracking/fact-data-table/fact-data-error.block.less @@ -10,7 +10,6 @@ // background-color: @ansible-red; &-message { - font-family: merriweather; font-size: 1.5em; line-height: 1.5; text-align: center; @@ -20,5 +19,8 @@ &-note { + &--full { + font-size: 22px; + } } } diff --git a/awx/ui/static/js/system-tracking/fact-module-filter.block.less b/awx/ui/static/js/system-tracking/fact-module-filter.block.less index e73dd92e48..972f932e81 100644 --- a/awx/ui/static/js/system-tracking/fact-module-filter.block.less +++ b/awx/ui/static/js/system-tracking/fact-module-filter.block.less @@ -23,6 +23,7 @@ background-color: @enabled-item-background; border-color: @enabled-item-border; color: @enabled-item-text; + box-shadow: none; z-index: 2; } } diff --git a/awx/ui/static/js/system-tracking/system-tracking.controller.js b/awx/ui/static/js/system-tracking/system-tracking.controller.js index ad169868c0..5782c9a3ab 100644 --- a/awx/ui/static/js/system-tracking/system-tracking.controller.js +++ b/awx/ui/static/js/system-tracking/system-tracking.controller.js @@ -27,6 +27,13 @@ function controller($rootScope, hostIds.length === 1 ? 'single-host' : 'host-to-host'; $scope.hostIds = $routeParams.hosts; $scope.inventory = $routeParams.model.inventory; + $scope.noModuleData = false; + + // this means no scans have been run + if (_.isEmpty(moduleOptions)) { + $scope.noModuleData = true; + return; + } if ($scope.compareMode === 'host-to-host') { $scope.factModulePickersLabelLeft = "Compare latest facts collected across both hosts on or before"; @@ -75,7 +82,16 @@ function controller($rootScope, rightRange) .then(function(responses) { var data = _.pluck(responses, 'fact'); - + if (_.isEmpty(data[0]) && _.isEmpty(data[1])) { + return _.reject({ + name: 'NoScanData', + message: 'There was insufficient scan data for both of the dates you selected. Please try selecting a different date or module.', + dateValues: + { leftDate: $scope.leftDate.clone(), + rightDate: $scope.rightDate.clone() + } + }); + } if (_.isEmpty(data[0])) { $scope.leftDataNoScans = true; $scope.leftScanDate = $scope.leftDate; @@ -119,7 +135,7 @@ function controller($rootScope, // we have NO data, throw an error result = _.reject({ name: 'NoScanData', - message: 'No scans ran on eithr of the dates you selected. Please try selecting different dates.', + message: 'No scans ran on either of the dates you selected. Please try selecting different dates.', dateValues: { leftDate: $scope.leftDate.clone(), rightDate: $scope.rightDate.clone() @@ -146,6 +162,16 @@ function controller($rootScope, // Clear out any errors from the previous run... $scope.error = null; + if (_.isEmpty(info.factData)) { + info = _.reject({ + name: 'NoScanDifferences', + message: 'No differences in the scans on the dates you selected. Please try selecting different dates.', + dateValues: + { leftDate: $scope.leftDate.clone(), + rightDate: $scope.rightDate.clone() + } + }); + } $scope.factData = info.factData; $scope.isNestedDisplay = info.isNestedDisplay; @@ -163,21 +189,22 @@ function controller($rootScope, return module.name === newModuleName; }); - if (newModule.isActive) { - return; + if (newModule) { + if (newModule.isActive) { + return; + } + $scope.modules.forEach(function(module) { + module.isActive = false; + }); + + newModule.isActive = true; + + $location.replace(); + $location.search('module', newModuleName); + + reloadData({ module: newModule + }, initialData).value(); } - - $scope.modules.forEach(function(module) { - module.isActive = false; - }); - - newModule.isActive = true; - - $location.replace(); - $location.search('module', newModuleName); - - reloadData({ module: newModule - }, initialData).value(); }; function dateWatcher(dateProperty) { diff --git a/awx/ui/static/js/system-tracking/system-tracking.partial.html b/awx/ui/static/js/system-tracking/system-tracking.partial.html index 848cdba6f0..f01d586b91 100644 --- a/awx/ui/static/js/system-tracking/system-tracking.partial.html +++ b/awx/ui/static/js/system-tracking/system-tracking.partial.html @@ -1,4 +1,17 @@ -
+
+ + + + + + +
+

+ To setup or run scan jobs, edit the "{{inventory.name}}" inventory and select "Scan Jobs Templates". +

+
+
+
@@ -31,16 +44,17 @@

- There were no facts collected on or before the dates you selected ({{error.dateValues.leftDate|amDateFormat:'L'}} and {{error.dateValues.rightDate|amDateFormat:'L'}}). Please pick a different range or module and try again. + There was insufficient scan data for either of the dates you selected. Please try selecting a different date or module.

- There were no facts collected on or before one of the dates you selected ({{error.dateValue|amDateFormat:'L'}}). Please select a different date and try again. + There were no facts collected on or before one of the dates you selected ({{error.dateValue|amDateFormat:'L'}}). Please select a different date and try again.

- To setup or run scan jobs, edit the "{{inventory.name}}" inventory and select "Scan Jobs Templates". + We were not able to find any facts collected for this inventory or module. To setup or run scan jobs, edit the "{{inventory.name}}" inventory and select "Scan Jobs Templates".