From 29fcf336c194265f31a6eafd90c0631fef84357e Mon Sep 17 00:00:00 2001 From: mabashian Date: Wed, 23 Aug 2017 12:11:40 -0400 Subject: [PATCH] Disable host filter lookup for users who don't have edit permissions. Hide delete/edit inv list icons for users who don't have proper permissions. --- .../src/inventories-hosts/inventories/inventory.list.js | 6 ++---- .../smart-inventory-host-filter.directive.js | 3 ++- .../smart-inventory-host-filter.partial.html | 2 +- .../inventories/smart-inventory/smart-inventory.form.js | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/awx/ui/client/src/inventories-hosts/inventories/inventory.list.js b/awx/ui/client/src/inventories-hosts/inventories/inventory.list.js index 233dcaa7f9..267dcc20ea 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/inventory.list.js +++ b/awx/ui/client/src/inventories-hosts/inventories/inventory.list.js @@ -98,8 +98,7 @@ export default ['i18n', function(i18n) { ngClick: 'editInventory(inventory)', awToolTip: i18n._('Edit inventory'), dataPlacement: 'top', - ngShow: 'inventory.summary_fields.user_capabilities.edit', - ngHide: 'inventory.pending_deletion' + ngShow: '!inventory.pending_deletion && inventory.summary_fields.user_capabilities.edit' }, view: { label: i18n._('View'), @@ -113,8 +112,7 @@ export default ['i18n', function(i18n) { ngClick: "deleteInventory(inventory.id, inventory.name)", awToolTip: i18n._('Delete inventory'), dataPlacement: 'top', - ngShow: 'inventory.summary_fields.user_capabilities.delete', - ngHide: 'inventory.pending_deletion' + ngShow: '!inventory.pending_deletion && inventory.summary_fields.user_capabilities.delete' }, pending_deletion: { diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.directive.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.directive.js index 198a0eca7c..2bfb654e3e 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.directive.js +++ b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.directive.js @@ -10,7 +10,8 @@ export default ['templateUrl', '$compile', function(templateUrl, $compile) { return { scope: { - hostFilter: '=' + hostFilter: '=', + fieldIsDisabled: '=' }, restrict: 'E', templateUrl: templateUrl('inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter'), diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.partial.html b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.partial.html index 6c3248b2de..197abb6e18 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.partial.html +++ b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.partial.html @@ -1,6 +1,6 @@
- diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory.form.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory.form.js index 2eb4f3b10a..cf69f91a99 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory.form.js +++ b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory.form.js @@ -64,7 +64,7 @@ export default ['i18n', 'InventoryCompletedJobsList', function(i18n, InventoryCo smart_hosts: { label: i18n._('Smart Host Filter'), type: 'custom', - control: '', + control: '', awPopOver: "

" + i18n._("Populate the hosts for this inventory by using a search filter.") + "

" + i18n._("Example: ansible_facts.ansible_distribution:\"RedHat\"") + "

" + i18n._("Refer to the Ansible Tower documentation for further syntax and examples.") + "

", dataTitle: i18n._('Smart Host Filter'), dataPlacement: 'right',