mirror of
https://github.com/ansible/awx.git
synced 2026-03-21 19:07:39 -02:30
Remove delete and edit buttons from smart inventory host list. Only option should be view.
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
export default
|
export default
|
||||||
['$scope', '$state', '$stateParams', 'GenerateForm', 'ParseTypeChange', 'HostsService', 'host', '$rootScope',
|
['$scope', '$state', '$stateParams', 'GenerateForm', 'ParseTypeChange', 'HostsService', 'host', '$rootScope',
|
||||||
function($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.parseType = 'yaml';
|
||||||
$scope.formCancel = function(){
|
$scope.formCancel = function(){
|
||||||
$state.go('^', null, {reload: true});
|
$state.go('^', null, {reload: true});
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ function(i18n) {
|
|||||||
" set by the inventory sync process.") +
|
" set by the inventory sync process.") +
|
||||||
"</p>",
|
"</p>",
|
||||||
dataTitle: i18n._('Host Enabled'),
|
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: {
|
fields: {
|
||||||
@@ -56,11 +56,11 @@ function(i18n) {
|
|||||||
dataTitle: i18n._('Host Name'),
|
dataTitle: i18n._('Host Name'),
|
||||||
dataPlacement: 'right',
|
dataPlacement: 'right',
|
||||||
dataContainer: 'body',
|
dataContainer: 'body',
|
||||||
ngDisabled: '!(host.summary_fields.user_capabilities.edit || canAdd)'
|
ngDisabled: '!(host.summary_fields.user_capabilities.edit || canAdd) || isSmartInvHost'
|
||||||
},
|
},
|
||||||
description: {
|
description: {
|
||||||
label: i18n._('Description'),
|
label: i18n._('Description'),
|
||||||
ngDisabled: '!(host.summary_fields.user_capabilities.edit || canAdd)',
|
ngDisabled: '!(host.summary_fields.user_capabilities.edit || canAdd) || isSmartInvHost',
|
||||||
type: 'text'
|
type: 'text'
|
||||||
},
|
},
|
||||||
host_variables: {
|
host_variables: {
|
||||||
@@ -79,23 +79,23 @@ function(i18n) {
|
|||||||
dataTitle: i18n._('Host Variables'),
|
dataTitle: i18n._('Host Variables'),
|
||||||
dataPlacement: 'right',
|
dataPlacement: 'right',
|
||||||
dataContainer: 'body',
|
dataContainer: 'body',
|
||||||
ngDisabled: '!(host.summary_fields.user_capabilities.edit || canAdd)'
|
ngDisabled: '!(host.summary_fields.user_capabilities.edit || canAdd) || isSmartInvHost'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
buttons: {
|
buttons: {
|
||||||
cancel: {
|
cancel: {
|
||||||
ngClick: 'formCancel()',
|
ngClick: 'formCancel()',
|
||||||
ngShow: '(host.summary_fields.user_capabilities.edit || canAdd)'
|
ngShow: '(host.summary_fields.user_capabilities.edit || canAdd) && !isSmartInvHost'
|
||||||
},
|
},
|
||||||
close: {
|
close: {
|
||||||
ngClick: 'formCancel()',
|
ngClick: 'formCancel()',
|
||||||
ngShow: '!(host.summary_fields.user_capabilities.edit || canAdd)'
|
ngShow: '!(host.summary_fields.user_capabilities.edit || canAdd) || isSmartInvHost'
|
||||||
},
|
},
|
||||||
save: {
|
save: {
|
||||||
ngClick: 'formSave()',
|
ngClick: 'formSave()',
|
||||||
ngDisabled: true,
|
ngDisabled: true,
|
||||||
ngShow: '(host.summary_fields.user_capabilities.edit || canAdd)'
|
ngShow: '(host.summary_fields.user_capabilities.edit || canAdd) && !isSmartInvHost'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ export default {
|
|||||||
list.basePath = GetBasePath('inventory') + $stateParams.smartinventory_id + '/hosts';
|
list.basePath = GetBasePath('inventory') + $stateParams.smartinventory_id + '/hosts';
|
||||||
delete list.actions.create;
|
delete list.actions.create;
|
||||||
delete list.fields.groups;
|
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';
|
list.fields.name.columnClass = 'col-lg-8 col-md-11 col-sm-8 col-xs-7';
|
||||||
return list;
|
return list;
|
||||||
}],
|
}],
|
||||||
|
|||||||
Reference in New Issue
Block a user