From af31c7972c9ccd799aeaaf3ecc5b678db92142f1 Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Fri, 23 Jun 2017 09:14:09 -0400 Subject: [PATCH] Hide smart inv button when no hosts exist. Updated disassociate tooltip. Filtered out the target group when associating existing groups --- awx/ui/client/src/inventories-hosts/hosts/host.list.js | 2 +- .../hosts/related/nested-groups/host-nested-groups.list.js | 2 +- .../shared/associate-groups/associate-groups.controller.js | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/awx/ui/client/src/inventories-hosts/hosts/host.list.js b/awx/ui/client/src/inventories-hosts/hosts/host.list.js index bf8ed8673e..865d3eb108 100644 --- a/awx/ui/client/src/inventories-hosts/hosts/host.list.js +++ b/awx/ui/client/src/inventories-hosts/hosts/host.list.js @@ -110,7 +110,7 @@ export default ['i18n', function(i18n) { awToolTip: "Create a new Smart Inventory from search results.", actionClass: 'btn List-buttonDefault', buttonContent: 'SMART INVENTORY', - ngShow: 'canAdd', + ngShow: 'canAdd && (hosts.length > 0 || !(searchTags | isEmpty))', dataPlacement: "top", ngDisabled: '!enableSmartInventoryButton' } diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups.list.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups.list.js index 9c2718688c..1c818d5fe3 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups.list.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups.list.js @@ -99,7 +99,7 @@ export default { //label: 'Delete', mode: 'all', ngClick: "disassociateGroup(nested_group)", - awToolTip: 'Delete group', + awToolTip: 'Disassociate group', dataPlacement: "top", ngShow: "nested_group.summary_fields.user_capabilities.delete" } diff --git a/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.controller.js b/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.controller.js index 41112ee0ec..ec06428d96 100644 --- a/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.controller.js +++ b/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.controller.js @@ -23,6 +23,11 @@ page_size: 5 }; + if($state.params.group_id) { + $scope.associate_group_default_params.not__id = $state.params.group_id; + $scope.associate_group_queryset.not__id = $state.params.group_id; + } + let list = _.cloneDeep(GroupList); list.basePath = GetBasePath('inventory') + $state.params.inventory_id + '/groups'; list.iterator = 'associate_group';