fixed error reporting on system tracking

This commit is contained in:
John Mitchell 2015-06-22 11:02:49 -04:00
parent 6d6d9de379
commit 336a8f23bd
4 changed files with 65 additions and 21 deletions

View File

@ -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;
}
}
}

View File

@ -23,6 +23,7 @@
background-color: @enabled-item-background;
border-color: @enabled-item-border;
color: @enabled-item-text;
box-shadow: none;
z-index: 2;
}
}

View File

@ -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) {

View File

@ -1,4 +1,17 @@
<section class="SystemTrackingContainer">
<section class="SystemTrackingContainer" ng-if="noModuleData">
<breadcrumbs>
<breadcrumb path="/inventories" title="Inventories"></breadcrumb>
<breadcrumb path="/inventories/{{inventory.id}}/manage" title="{{inventory.name}}"></breadcrumb>
<breadcrumb path="/inventories/{{inventory.id}}/system-tracking/{{hostIds}}" title="System Tracking" current="true"></breadcrumb>
</breadcrumbs>
<section class="FactDataError SystemTrackingContainer-main">
<p class="FactDataError-note--full">
To setup or run scan jobs, edit the "<a link-to="inventoryEdit" model="{ inventory_id: inventory }">{{inventory.name}}</a>" inventory and select "Scan Jobs Templates".
</p>
</section>
</section>
<section class="SystemTrackingContainer" ng-if="!noModuleData">
<breadcrumbs>
<breadcrumb path="/inventories" title="Inventories"></breadcrumb>
<breadcrumb path="/inventories/{{inventory.id}}/manage" title="{{inventory.name}}"></breadcrumb>
@ -31,16 +44,17 @@
<section class="FactDataError SystemTrackingContainer-main" ng-if="error" ng-switch="error.name">
<p class="FactDataError-message" ng-switch-when="NoScanData">
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.
</p>
<p class="FactDataError-message" ng-switch-when="InsufficientScanData">
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.
</p>
<p class="FactDataError-note">
To setup or run scan jobs, edit the "<a link-to="inventoryEdit" model="{ inventory_id: inventory }">{{inventory.name}}</a>" 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 "<a link-to="inventoryEdit" model="{ inventory_id: inventory }">{{inventory.name}}</a>" inventory and select "Scan Jobs Templates".
</p>
</section>
<fact-data-table
ng-if="!error"
left-hostname="leftHostname"
right-hostname="rightHostname"
left-scan-date="leftScanDate"