mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 11:50:42 -03:30
groups and hosts rbac conditional showing in ui implementation
This commit is contained in:
parent
94efd034de
commit
1f586091e2
@ -26,14 +26,16 @@ export default
|
||||
type: 'text',
|
||||
addRequired: true,
|
||||
editRequired: true,
|
||||
tab: 'properties'
|
||||
tab: 'properties',
|
||||
ngDisabled: '!canEdit'
|
||||
},
|
||||
description: {
|
||||
label: 'Description',
|
||||
type: 'text',
|
||||
addRequired: false,
|
||||
editRequired: false,
|
||||
tab: 'properties'
|
||||
tab: 'properties',
|
||||
ngDisabled: '!canEdit'
|
||||
},
|
||||
variables: {
|
||||
label: 'Variables',
|
||||
@ -65,7 +67,8 @@ export default
|
||||
ngChange: 'sourceChange(source)',
|
||||
addRequired: false,
|
||||
editRequired: false,
|
||||
ngModel: 'source'
|
||||
ngModel: 'source',
|
||||
ngDisabled: '!canEdit'
|
||||
},
|
||||
credential: {
|
||||
label: 'Cloud Credential',
|
||||
@ -77,7 +80,8 @@ export default
|
||||
awRequiredWhen: {
|
||||
reqExpression: "cloudCredentialRequired",
|
||||
init: "false"
|
||||
}
|
||||
},
|
||||
ngDisabled: '!canEdit'
|
||||
},
|
||||
source_regions: {
|
||||
label: 'Regions',
|
||||
@ -92,7 +96,8 @@ export default
|
||||
awPopOver: "<p>Click on the regions field to see a list of regions for your cloud provider. You can select multiple regions, " +
|
||||
"or choose <em>All</em> to include all regions. Tower will only be updated with Hosts associated with the selected regions." +
|
||||
"</p>",
|
||||
dataContainer: 'body'
|
||||
dataContainer: 'body',
|
||||
ngDisabled: '!canEdit'
|
||||
},
|
||||
instance_filters: {
|
||||
label: 'Instance Filters',
|
||||
@ -112,7 +117,8 @@ export default
|
||||
"<blockquote>tag:Name=test*</blockquote>\n" +
|
||||
"<p>View the <a href=\"http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeInstances.html\" target=\"_blank\">Describe Instances documentation</a> " +
|
||||
"for a complete list of supported filters.</p>",
|
||||
dataContainer: 'body'
|
||||
dataContainer: 'body',
|
||||
ngDisabled: '!canEdit'
|
||||
},
|
||||
group_by: {
|
||||
label: 'Only Group By',
|
||||
@ -137,7 +143,8 @@ export default
|
||||
"<li>VPC ID: <strong>vpcs » vpc-5ca1ab1e</strong></li>" +
|
||||
"<li>Tag None: <strong>tags » tag_none</strong></li>" +
|
||||
"</ul><p>If blank, all groups above are created except <em>Instance ID</em>.</p>",
|
||||
dataContainer: 'body'
|
||||
dataContainer: 'body',
|
||||
ngDisabled: '!canEdit'
|
||||
},
|
||||
inventory_script: {
|
||||
label : "Custom Inventory Script",
|
||||
@ -149,6 +156,7 @@ export default
|
||||
addRequired: true,
|
||||
editRequired: true,
|
||||
ngRequired: "source && source.value === 'custom'",
|
||||
ngDisabled: '!canEdit',
|
||||
},
|
||||
custom_variables: {
|
||||
id: 'custom_variables',
|
||||
@ -269,7 +277,8 @@ export default
|
||||
dataTitle: 'Overwrite',
|
||||
dataContainer: 'body',
|
||||
dataPlacement: 'right',
|
||||
labelClass: 'checkbox-options'
|
||||
labelClass: 'checkbox-options',
|
||||
ngDisabled: '!canEdit'
|
||||
}, {
|
||||
name: 'overwrite_vars',
|
||||
label: 'Overwrite Variables',
|
||||
@ -283,7 +292,8 @@ export default
|
||||
dataTitle: 'Overwrite Variables',
|
||||
dataContainer: 'body',
|
||||
dataPlacement: 'right',
|
||||
labelClass: 'checkbox-options'
|
||||
labelClass: 'checkbox-options',
|
||||
ngDisabled: '!canEdit'
|
||||
}, {
|
||||
name: 'update_on_launch',
|
||||
label: 'Update on Launch',
|
||||
@ -296,7 +306,8 @@ export default
|
||||
dataTitle: 'Update on Launch',
|
||||
dataContainer: 'body',
|
||||
dataPlacement: 'right',
|
||||
labelClass: 'checkbox-options'
|
||||
labelClass: 'checkbox-options',
|
||||
ngDisabled: '!canEdit'
|
||||
}]
|
||||
},
|
||||
update_cache_timeout: {
|
||||
@ -321,11 +332,17 @@ export default
|
||||
|
||||
buttons: {
|
||||
cancel: {
|
||||
ngClick: 'formCancel()'
|
||||
ngClick: 'formCancel()',
|
||||
ngShow: 'canEdit'
|
||||
},
|
||||
close: {
|
||||
ngClick: 'formCancel()',
|
||||
ngShow: '!canEdit'
|
||||
},
|
||||
save: {
|
||||
ngClick: 'formSave()',
|
||||
ngDisabled: true
|
||||
ngDisabled: true,
|
||||
ngShow: 'canEdit'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -46,13 +46,15 @@ export default
|
||||
"</blockquote>",
|
||||
dataTitle: 'Host Name',
|
||||
dataPlacement: 'right',
|
||||
dataContainer: 'body'
|
||||
dataContainer: 'body',
|
||||
ngDisabled: '!canEdit'
|
||||
},
|
||||
description: {
|
||||
label: 'Description',
|
||||
type: 'text',
|
||||
addRequired: false,
|
||||
editRequired: false
|
||||
editRequired: false,
|
||||
ngDisabled: '!canEdit'
|
||||
},
|
||||
variables: {
|
||||
label: 'Variables',
|
||||
@ -83,10 +85,16 @@ export default
|
||||
buttons: {
|
||||
cancel: {
|
||||
ngClick: 'formCancel()',
|
||||
ngShow: 'canEdit'
|
||||
},
|
||||
close: {
|
||||
ngClick: 'formCancel()',
|
||||
ngShow: '!canEdit'
|
||||
},
|
||||
save: {
|
||||
ngClick: 'formSave()',
|
||||
ngDisabled: true
|
||||
ngDisabled: true,
|
||||
ngShow: 'canEdit'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -7,10 +7,21 @@
|
||||
export default
|
||||
['$state', '$stateParams', '$scope', 'GroupForm', 'CredentialList', 'inventoryScriptsListObject', 'ToggleNotification', 'ParseVariableString',
|
||||
'ParseTypeChange', 'GenerateForm', 'LookUpInit', 'RelatedSearchInit', 'RelatedPaginateInit', 'NotificationsListInit',
|
||||
'GroupManageService','GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions', 'groupData', 'inventorySourceData',
|
||||
'GroupManageService','GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions', 'groupData', 'inventorySourceData', 'Rest',
|
||||
function($state, $stateParams, $scope, GroupForm, CredentialList, InventoryScriptsList, ToggleNotification, ParseVariableString,
|
||||
ParseTypeChange, GenerateForm, LookUpInit, RelatedSearchInit, RelatedPaginateInit, NotificationsListInit,
|
||||
GroupManageService, GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions, groupData, inventorySourceData){
|
||||
GroupManageService, GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions, groupData, inventorySourceData, Rest){
|
||||
|
||||
$scope.canEdit = false;
|
||||
|
||||
Rest.setUrl(GetBasePath('groups') + $stateParams.group_id);
|
||||
Rest.options()
|
||||
.success(function(data) {
|
||||
if (data.actions.PUT) {
|
||||
$scope.canEdit = true;
|
||||
}
|
||||
});
|
||||
|
||||
var generator = GenerateForm,
|
||||
form = GroupForm();
|
||||
|
||||
|
||||
@ -5,13 +5,25 @@
|
||||
*************************************************/
|
||||
export default
|
||||
['$scope', '$rootScope', '$state', '$stateParams', 'InventoryGroups', 'generateList', 'InventoryUpdate', 'GroupManageService', 'GroupsCancelUpdate', 'ViewUpdateStatus',
|
||||
'InventoryManageService', 'groupsUrl', 'SearchInit', 'PaginateInit', 'GetSyncStatusMsg', 'GetHostsStatusMsg',
|
||||
'InventoryManageService', 'groupsUrl', 'SearchInit', 'PaginateInit', 'GetSyncStatusMsg', 'GetHostsStatusMsg', 'Rest', 'GetBasePath',
|
||||
function($scope, $rootScope, $state, $stateParams, InventoryGroups, generateList, InventoryUpdate, GroupManageService, GroupsCancelUpdate, ViewUpdateStatus,
|
||||
InventoryManageService, groupsUrl, SearchInit, PaginateInit, GetSyncStatusMsg, GetHostsStatusMsg){
|
||||
InventoryManageService, groupsUrl, SearchInit, PaginateInit, GetSyncStatusMsg, GetHostsStatusMsg, Rest, GetBasePath){
|
||||
var list = InventoryGroups,
|
||||
view = generateList,
|
||||
pageSize = 20;
|
||||
$scope.inventory_id = $stateParams.inventory_id;
|
||||
|
||||
$scope.canAdd = false;
|
||||
|
||||
Rest.setUrl(GetBasePath('inventory') + $scope.inventory_id + "/groups");
|
||||
Rest.options()
|
||||
.success(function(data) {
|
||||
if (data.actions.POST) {
|
||||
$scope.canAdd = true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// The ncy breadcrumb directive will look at this attribute when attempting to bind to the correct scope.
|
||||
// In this case, we don't want to incidentally bind to this scope when editing a host or a group. See:
|
||||
// https://github.com/ncuillery/angular-breadcrumb/issues/42 for a little more information on the
|
||||
|
||||
@ -5,8 +5,18 @@
|
||||
*************************************************/
|
||||
|
||||
export default
|
||||
['$state', '$stateParams', '$scope', 'HostForm', 'ParseTypeChange', 'GenerateForm', 'HostManageService', 'host',
|
||||
function($state, $stateParams, $scope, HostForm, ParseTypeChange, GenerateForm, HostManageService, host){
|
||||
['$state', '$stateParams', '$scope', 'HostForm', 'ParseTypeChange', 'GenerateForm', 'HostManageService', 'host', 'GetBasePath', 'Rest',
|
||||
function($state, $stateParams, $scope, HostForm, ParseTypeChange, GenerateForm, HostManageService, host, GetBasePath, Rest){
|
||||
$scope.canEdit = false;
|
||||
|
||||
Rest.setUrl(GetBasePath('hosts') + $stateParams.host_id);
|
||||
Rest.options()
|
||||
.success(function(data) {
|
||||
if (data.actions.PUT) {
|
||||
$scope.canEdit = true;
|
||||
}
|
||||
});
|
||||
|
||||
var generator = GenerateForm,
|
||||
form = HostForm;
|
||||
$scope.parseType = 'yaml';
|
||||
|
||||
@ -5,12 +5,26 @@
|
||||
*************************************************/
|
||||
export default
|
||||
['$scope', '$rootScope', '$state', '$stateParams', 'InventoryHosts', 'generateList', 'InventoryManageService', 'HostManageService',
|
||||
'hostsUrl', 'SearchInit', 'PaginateInit', 'SetStatus', 'Prompt', 'Wait', 'inventoryData', '$filter',
|
||||
'hostsUrl', 'SearchInit', 'PaginateInit', 'SetStatus', 'Prompt', 'Wait', 'inventoryData', '$filter', 'Rest', 'GetBasePath',
|
||||
function($scope, $rootScope, $state, $stateParams, InventoryHosts, generateList, InventoryManageService, HostManageService,
|
||||
hostsUrl, SearchInit, PaginateInit, SetStatus, Prompt, Wait, inventoryData, $filter){
|
||||
hostsUrl, SearchInit, PaginateInit, SetStatus, Prompt, Wait, inventoryData, $filter, Rest, GetBasePath){
|
||||
|
||||
var list = InventoryHosts,
|
||||
view = generateList,
|
||||
pageSize = 20;
|
||||
|
||||
$scope.canAdd = false;
|
||||
|
||||
$scope.inventory_id = $stateParams.inventory_id;
|
||||
|
||||
Rest.setUrl(GetBasePath('inventory') + $scope.inventory_id + "/hosts");
|
||||
Rest.options()
|
||||
.success(function(data) {
|
||||
if (data.actions.POST) {
|
||||
$scope.canAdd = true;
|
||||
}
|
||||
});
|
||||
|
||||
// The ncy breadcrumb directive will look at this attribute when attempting to bind to the correct scope.
|
||||
// In this case, we don't want to incidentally bind to this scope when editing a host or a group. See:
|
||||
// https://github.com/ncuillery/angular-breadcrumb/issues/42 for a little more information on the
|
||||
|
||||
@ -3,21 +3,26 @@
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
export default
|
||||
['$scope', '$state', function($scope, $state){
|
||||
$scope.groupsSelected = false;
|
||||
$scope.hostsSelected = false;
|
||||
$scope.hostsSelectedItems = [];
|
||||
$scope.groupsSelectedItems = [];
|
||||
$scope.setAdhocPattern = function(){
|
||||
var pattern = _($scope.groupsSelectedItems)
|
||||
.concat($scope.hostsSelectedItems)
|
||||
.map(function(item){
|
||||
return item.name;
|
||||
}).value().join(':');
|
||||
$state.go('inventoryManage.adhoc', {pattern: pattern});
|
||||
};
|
||||
export default
|
||||
['$scope', '$state', 'inventoryData', function($scope, $state, inventoryData){
|
||||
$scope.groupsSelected = false;
|
||||
$scope.hostsSelected = false;
|
||||
$scope.hostsSelectedItems = [];
|
||||
$scope.groupsSelectedItems = [];
|
||||
|
||||
$scope.canAdhoc = inventoryData.summary_fields.user_capabilities.adhoc;
|
||||
|
||||
$scope.setAdhocPattern = function(){
|
||||
var pattern = _($scope.groupsSelectedItems)
|
||||
.concat($scope.hostsSelectedItems)
|
||||
.map(function(item){
|
||||
return item.name;
|
||||
}).value().join(':');
|
||||
|
||||
$state.go('inventoryManage.adhoc', {pattern: pattern});
|
||||
};
|
||||
|
||||
$scope.$watchGroup(['groupsSelected', 'hostsSelected'], function(newVals) {
|
||||
$scope.adhocCommandTooltip = (newVals[0] || newVals[1]) ? "Run a command on the selected inventory" : "Select an inventory source by clicking the check box beside it. The inventory source can be a single group or host, a selection of multiple hosts, or a selection of multiple groups.";
|
||||
});
|
||||
}];
|
||||
}];
|
||||
|
||||
@ -143,7 +143,8 @@ export default
|
||||
actionClass: 'btn List-buttonDefault',
|
||||
buttonContent: 'RUN COMMANDS',
|
||||
showTipWhenDisabled: true,
|
||||
tooltipInnerClass: "Tooltip-wide"
|
||||
tooltipInnerClass: "Tooltip-wide",
|
||||
ngShow: 'canAdhoc'
|
||||
// TODO: set up a tip watcher and change text based on when
|
||||
// things are selected/not selected. This is started and
|
||||
// commented out in the inventory controller within the watchers.
|
||||
@ -155,7 +156,8 @@ export default
|
||||
ngClick: "createGroup()",
|
||||
awToolTip: "Create a new group",
|
||||
actionClass: 'btn List-buttonSubmit',
|
||||
buttonContent: '+ ADD GROUP'
|
||||
buttonContent: '+ ADD GROUP',
|
||||
ngShow: 'canAdd'
|
||||
}
|
||||
},
|
||||
|
||||
@ -208,6 +210,14 @@ export default
|
||||
dataPlacement: "top",
|
||||
ngShow: "group.summary_fields.user_capabilities.edit"
|
||||
},
|
||||
view: {
|
||||
//label: 'Edit',
|
||||
mode: 'all',
|
||||
ngClick: "editGroup(group.id)",
|
||||
awToolTip: 'View group',
|
||||
dataPlacement: "top",
|
||||
ngShow: "!group.summary_fields.user_capabilities.edit"
|
||||
},
|
||||
"delete": {
|
||||
//label: 'Delete',
|
||||
mode: 'all',
|
||||
|
||||
@ -78,21 +78,31 @@ export default
|
||||
mode: 'all',
|
||||
ngClick: "copyMoveHost(host.id)",
|
||||
awToolTip: 'Copy or move host to another group',
|
||||
dataPlacement: "top"
|
||||
dataPlacement: "top",
|
||||
ngShow: 'host.summary_fields.user_capabilities.edit'
|
||||
},
|
||||
edit: {
|
||||
//label: 'Edit',
|
||||
ngClick: "editHost(host.id)",
|
||||
icon: 'icon-edit',
|
||||
awToolTip: 'Edit host',
|
||||
dataPlacement: 'top'
|
||||
dataPlacement: 'top',
|
||||
ngShow: 'host.summary_fields.user_capabilities.edit'
|
||||
},
|
||||
view: {
|
||||
//label: 'Edit',
|
||||
ngClick: "editHost(host.id)",
|
||||
awToolTip: 'View host',
|
||||
dataPlacement: 'top',
|
||||
ngShow: '!host.summary_fields.user_capabilities.edit'
|
||||
},
|
||||
"delete": {
|
||||
//label: 'Delete',
|
||||
ngClick: "deleteHost(host.id, host.name)",
|
||||
icon: 'icon-trash',
|
||||
awToolTip: 'Delete host',
|
||||
dataPlacement: 'top'
|
||||
dataPlacement: 'top',
|
||||
ngShow: 'host.summary_fields.user_capabilities.delete'
|
||||
}
|
||||
},
|
||||
|
||||
@ -122,7 +132,8 @@ export default
|
||||
ngClick: "createHost()",
|
||||
awToolTip: "Create a new host",
|
||||
actionClass: 'btn List-buttonSubmit',
|
||||
buttonContent: '+ ADD HOST'
|
||||
buttonContent: '+ ADD HOST',
|
||||
ngShow: 'canAdd'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user