From e2abbafa1ea6319a8c62090f89f5505df7dfc395 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Wed, 31 May 2017 14:32:09 -0700 Subject: [PATCH] adding insights row icon per host as well as hide the insights tab if a host is not an insights host. --- awx/ui/client/src/inventories/hosts/host.form.js | 3 ++- awx/ui/client/src/inventories/hosts/hosts.partial.html | 3 +++ .../src/inventories/hosts/list/host-list.controller.js | 3 +++ .../inventories/related-hosts/list/host-list.controller.js | 3 +++ .../src/inventories/related-hosts/related-host.form.js | 3 ++- .../src/inventories/related-hosts/related-host.list.js | 7 +++++++ awx/ui/client/src/shared/form-generator.js | 1 + awx/ui/client/src/shared/generator-helpers.js | 3 +++ 8 files changed, 24 insertions(+), 2 deletions(-) diff --git a/awx/ui/client/src/inventories/hosts/host.form.js b/awx/ui/client/src/inventories/hosts/host.form.js index 6f45b7b338..9cfec370d2 100644 --- a/awx/ui/client/src/inventories/hosts/host.form.js +++ b/awx/ui/client/src/inventories/hosts/host.form.js @@ -125,7 +125,8 @@ function(i18n) { awToolTip: i18n._('Please save before viewing Insights'), dataPlacement: 'top', title: i18n._('Insights'), - skipGenerator: true + skipGenerator: true, + ngIf: 'host.insights_system_id!==null' } } }; diff --git a/awx/ui/client/src/inventories/hosts/hosts.partial.html b/awx/ui/client/src/inventories/hosts/hosts.partial.html index bdc9a030c8..1f11db98bb 100644 --- a/awx/ui/client/src/inventories/hosts/hosts.partial.html +++ b/awx/ui/client/src/inventories/hosts/hosts.partial.html @@ -74,6 +74,9 @@
+ diff --git a/awx/ui/client/src/inventories/hosts/list/host-list.controller.js b/awx/ui/client/src/inventories/hosts/list/host-list.controller.js index e906052a79..d88bfadeb3 100644 --- a/awx/ui/client/src/inventories/hosts/list/host-list.controller.js +++ b/awx/ui/client/src/inventories/hosts/list/host-list.controller.js @@ -65,6 +65,9 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath, $scope.editHost = function(id){ $state.go('hosts.edit', {host_id: id}); }; + $scope.goToInsights = function(id){ + $state.go('hosts.edit.insights', {host_id:id}); + }; $scope.deleteHost = function(id, name){ var body = '
Are you sure you want to permanently delete the host below from the inventory?
' + $filter('sanitize')(name) + '
'; var action = function(){ diff --git a/awx/ui/client/src/inventories/related-hosts/list/host-list.controller.js b/awx/ui/client/src/inventories/related-hosts/list/host-list.controller.js index b02c9cbf43..3af8c0c6eb 100644 --- a/awx/ui/client/src/inventories/related-hosts/list/host-list.controller.js +++ b/awx/ui/client/src/inventories/related-hosts/list/host-list.controller.js @@ -86,6 +86,9 @@ export default ['$scope', 'ListDefinition', '$rootScope', 'GetBasePath', $scope.editHost = function(id){ $state.go('inventories.edit.hosts.edit', {host_id: id}); }; + $scope.goToInsights = function(id){ + $state.go('inventories.edit.hosts.edit.insights', {host_id:id}); + }; $scope.deleteHost = function(id, name){ var body = '
Are you sure you want to permanently delete the host below from the inventory?
' + $filter('sanitize')(name) + '
'; var action = function(){ diff --git a/awx/ui/client/src/inventories/related-hosts/related-host.form.js b/awx/ui/client/src/inventories/related-hosts/related-host.form.js index 941f98d995..0ad88d8835 100644 --- a/awx/ui/client/src/inventories/related-hosts/related-host.form.js +++ b/awx/ui/client/src/inventories/related-hosts/related-host.form.js @@ -125,7 +125,8 @@ function(i18n) { awToolTip: i18n._('Please save before viewing Insights'), dataPlacement: 'top', title: i18n._('Insights'), - skipGenerator: true + skipGenerator: true, + ngIf: 'host.insights_system_id!==null' } } }; diff --git a/awx/ui/client/src/inventories/related-hosts/related-host.list.js b/awx/ui/client/src/inventories/related-hosts/related-host.list.js index c806fbaa58..7e1e114bad 100644 --- a/awx/ui/client/src/inventories/related-hosts/related-host.list.js +++ b/awx/ui/client/src/inventories/related-hosts/related-host.list.js @@ -50,6 +50,13 @@ export default { fieldActions: { columnClass: 'col-lg-6 col-md-4 col-sm-4 col-xs-5 text-right', + insights: { + ngClick: "goToInsights(host.id)", + icon: 'fa-info', + awToolTip: 'View Insights Data', + dataPlacement: 'top', + ngShow: 'host.insights_system_id' + }, copy: { mode: 'all', ngClick: "copyMoveHost(host.id)", diff --git a/awx/ui/client/src/shared/form-generator.js b/awx/ui/client/src/shared/form-generator.js index 96f0457fae..cf6b300ba5 100644 --- a/awx/ui/client/src/shared/form-generator.js +++ b/awx/ui/client/src/shared/form-generator.js @@ -1507,6 +1507,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat collection = this.form.related[itm]; html += `