From a09bd5a90df9ebd854c11e01c4d83166c24a23d3 Mon Sep 17 00:00:00 2001 From: mabashian Date: Fri, 1 Sep 2017 16:32:09 -0400 Subject: [PATCH] Remove delete and edit buttons from smart inventory host list. Only option should be view. --- .../related/hosts/edit/host-edit.controller.js | 1 + .../inventories/related/hosts/related-host.form.js | 14 +++++++------- .../smart-inventory/smart-inventory-hosts.route.js | 3 +++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/host-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/host-edit.controller.js index 4a66d48025..52661b4129 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/host-edit.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/host-edit.controller.js @@ -7,6 +7,7 @@ export default ['$scope', '$state', '$stateParams', 'GenerateForm', 'ParseTypeChange', 'HostsService', 'host', '$rootScope', function($scope, $state, $stateParams, GenerateForm, ParseTypeChange, HostsService, host, $rootScope){ + $scope.isSmartInvHost = $state.includes('inventories.editSmartInventory.hosts.edit'); $scope.parseType = 'yaml'; $scope.formCancel = function(){ $state.go('^', null, {reload: true}); diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.form.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.form.js index 047d7ce456..2ee6de78a2 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.form.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.form.js @@ -37,7 +37,7 @@ function(i18n) { " set by the inventory sync process.") + "

", dataTitle: i18n._('Host Enabled'), - ngDisabled: '!host.summary_fields.user_capabilities.edit || host.has_inventory_sources' + ngDisabled: '!host.summary_fields.user_capabilities.edit || host.has_inventory_sources || isSmartInvHost' } }, fields: { @@ -56,11 +56,11 @@ function(i18n) { dataTitle: i18n._('Host Name'), dataPlacement: 'right', dataContainer: 'body', - ngDisabled: '!(host.summary_fields.user_capabilities.edit || canAdd)' + ngDisabled: '!(host.summary_fields.user_capabilities.edit || canAdd) || isSmartInvHost' }, description: { label: i18n._('Description'), - ngDisabled: '!(host.summary_fields.user_capabilities.edit || canAdd)', + ngDisabled: '!(host.summary_fields.user_capabilities.edit || canAdd) || isSmartInvHost', type: 'text' }, host_variables: { @@ -79,23 +79,23 @@ function(i18n) { dataTitle: i18n._('Host Variables'), dataPlacement: 'right', dataContainer: 'body', - ngDisabled: '!(host.summary_fields.user_capabilities.edit || canAdd)' + ngDisabled: '!(host.summary_fields.user_capabilities.edit || canAdd) || isSmartInvHost' } }, buttons: { cancel: { ngClick: 'formCancel()', - ngShow: '(host.summary_fields.user_capabilities.edit || canAdd)' + ngShow: '(host.summary_fields.user_capabilities.edit || canAdd) && !isSmartInvHost' }, close: { ngClick: 'formCancel()', - ngShow: '!(host.summary_fields.user_capabilities.edit || canAdd)' + ngShow: '!(host.summary_fields.user_capabilities.edit || canAdd) || isSmartInvHost' }, save: { ngClick: 'formSave()', ngDisabled: true, - ngShow: '(host.summary_fields.user_capabilities.edit || canAdd)' + ngShow: '(host.summary_fields.user_capabilities.edit || canAdd) && !isSmartInvHost' } }, diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-hosts.route.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-hosts.route.js index 4924ec39f5..befc2c2d66 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-hosts.route.js +++ b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-hosts.route.js @@ -35,6 +35,9 @@ export default { list.basePath = GetBasePath('inventory') + $stateParams.smartinventory_id + '/hosts'; delete list.actions.create; delete list.fields.groups; + delete list.fieldActions.delete; + delete list.fieldActions.edit; + delete list.fieldActions.view.ngShow; list.fields.name.columnClass = 'col-lg-8 col-md-11 col-sm-8 col-xs-7'; return list; }],