From 32ddd8dab9cfa1ade8f34f1a7299d142929ed818 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Thu, 29 Jun 2017 16:00:35 -0700 Subject: [PATCH] changes to insights - better error handling for an invventory missing an insights cred - better error handling for missing reports/no reports - feedback from UX - adding refresh button --- .../inventories/insights/insights.block.less | 23 ++++++++++++++++--- .../insights/insights.controller.js | 11 +++++---- .../insights/insights.partial.html | 14 ++++++++++- .../edit/inventory-edit.controller.js | 1 + .../standard-inventory/inventory.form.js | 2 +- .../src/shared/branding/colors.default.less | 1 + 6 files changed, 43 insertions(+), 9 deletions(-) diff --git a/awx/ui/client/src/inventories-hosts/inventories/insights/insights.block.less b/awx/ui/client/src/inventories-hosts/inventories/insights/insights.block.less index f651c30cf3..e1ac5a80f7 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/insights/insights.block.less +++ b/awx/ui/client/src/inventories-hosts/inventories/insights/insights.block.less @@ -64,14 +64,15 @@ } .InsightsNav-anchor.is-currentFilter{ + background-color: @f2grey; padding-top: 5px; - border-bottom: 5px solid @menu-link-btm-hov; + border-bottom: 5px solid @b7grey; } .InsightsNav-anchor:hover{ - background-color: @menu-link-bg-hov; + background-color: @f2grey; padding-top: 5px; - border-bottom: 5px solid @menu-link-btm-hov; + border-bottom: 5px solid @b7grey; } .InsightsNav-totalIssues{ @@ -99,6 +100,22 @@ background-color: @b7grey; } +.InsightsNav-refresh{ + color: @default-icon; + cursor: pointer; + margin-left: 10px; + margin-right: 10px; +} + +.InsightsNav-refresh:hover{ + color: @default-link; +} + +.InsightsBody-missingIssues{ + color: @default-icon; + margin: 10px 0px 10px 0px; +} + .InsightsRow{ margin-top:10px; } diff --git a/awx/ui/client/src/inventories-hosts/inventories/insights/insights.controller.js b/awx/ui/client/src/inventories-hosts/inventories/insights/insights.controller.js index b050866277..88c70ee00a 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/insights/insights.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/insights/insights.controller.js @@ -9,8 +9,8 @@ export default [ 'InsightsData', '$scope', 'moment', '$state', 'InventoryData', function (data, $scope, moment, $state, InventoryData, InsightsService) { function init() { - $scope.reports = data.reports; - $scope.reports_dataset = data; + $scope.reports = (data && data.reports) ? data.reports : []; + $scope.reports_dataset = (data) ? data : {}; $scope.currentFilter = "total"; $scope.solvable_count = filter('solvable').length; $scope.not_solvable_count = filter('not_solvable').length; @@ -20,8 +20,11 @@ function (data, $scope, moment, $state, InventoryData, InsightsService) { $scope.low_count =filter('low').length; let a = moment(), b = moment($scope.reports_dataset.last_check_in); $scope.last_check_in = a.diff(b, 'hours'); - $scope.inventory = InventoryData; - $scope.insights_credential = InventoryData.summary_fields.insights_credential.id; + $scope.inventory = (InventoryData) ? InventoryData : {}; + $scope.insights_credential = (InventoryData && InventoryData.summary_fields && + InventoryData.summary_fields.insights_credential && InventoryData.summary_fields.insights_credential.id) ? + InventoryData.summary_fields.insights_credential.id : null; + } function filter(str){ diff --git a/awx/ui/client/src/inventories-hosts/inventories/insights/insights.partial.html b/awx/ui/client/src/inventories-hosts/inventories/insights/insights.partial.html index e1f2ee91d3..fa05459114 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/insights/insights.partial.html +++ b/awx/ui/client/src/inventories-hosts/inventories/insights/insights.partial.html @@ -50,10 +50,22 @@
Not Solvable With Playbook
{{not_solvable_count}} +
+ + +
+
+ No scan jobs have been run on this host. +
+
+ The Insights Credential for {{inventory.name}} was not found. +
- +
diff --git a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js index 443a65be35..a32c5ab49e 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js @@ -32,6 +32,7 @@ function InventoriesEdit($scope, $location, $scope.insights_credential_name = (inventoryData.summary_fields.insights_credential && inventoryData.summary_fields.insights_credential.name) ? inventoryData.summary_fields.insights_credential.name : null; $scope.insights_credential = (inventoryData.summary_fields.insights_credential && inventoryData.summary_fields.insights_credential.id) ? inventoryData.summary_fields.insights_credential.id : null; + $scope.is_insights = (inventoryData.summary_fields.insights_credential && inventoryData.summary_fields.insights_credential.id) ? true : false; $scope.organization_name = inventoryData.summary_fields.organization.name; $scope.inventory_variables = inventoryData.variables === null || inventoryData.variables === '' ? '---' : ParseVariableString(inventoryData.variables); $scope.parseType = 'yaml'; diff --git a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js index 5d4c24d811..0be972390c 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js +++ b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js @@ -201,7 +201,7 @@ function(i18n, InventoryCompletedJobsList) { relatedButtons: { remediate_inventory: { ngClick: 'remediateInventory(id, name, insights_credential)', - ngShow: 'insights_credential!==null && mode !== "add"', + ngShow: 'is_insights && mode !== "add"', label: i18n._('Remediate Inventory'), class: 'Form-primaryButton' } diff --git a/awx/ui/client/src/shared/branding/colors.default.less b/awx/ui/client/src/shared/branding/colors.default.less index 1f7ca0b2d0..a685f8427e 100644 --- a/awx/ui/client/src/shared/branding/colors.default.less +++ b/awx/ui/client/src/shared/branding/colors.default.less @@ -24,6 +24,7 @@ @cgrey: #CCCCCC; @f7grey: #F7F7F7; @insights-yellow: #dedc4f; +@f2grey: #f2f2f2; @default-warning: #F0AD4E;