Remove delete and edit buttons from smart inventory host list. Only option should be view.

This commit is contained in:
mabashian 2017-09-01 16:32:09 -04:00
parent e053e5a84e
commit a09bd5a90d
3 changed files with 11 additions and 7 deletions

View File

@ -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});

View File

@ -37,7 +37,7 @@ function(i18n) {
" set by the inventory sync process.") +
"</p>",
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'
}
},

View File

@ -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;
}],