1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-28 02:25:27 +03:00

Merge pull request #5694 from jlmitch5/addOrgToPermModal

add org to user/team perm modal
This commit is contained in:
jlmitch5 2017-03-14 11:18:35 -04:00 committed by GitHub
commit ad40e509e4
6 changed files with 59 additions and 28 deletions

View File

@ -7,8 +7,10 @@
/* jshint unused: vars */
export default ['$compile','templateUrl', 'i18n', 'generateList',
'ProjectList', 'TemplateList', 'InventoryList', 'CredentialList',
'OrganizationList',
function($compile, templateUrl, i18n, generateList,
ProjectList, TemplateList, InventoryList, CredentialList) {
ProjectList, TemplateList, InventoryList, CredentialList,
OrganizationList) {
return {
restrict: 'E',
scope: {
@ -24,7 +26,8 @@ export default ['$compile','templateUrl', 'i18n', 'generateList',
job_templates: TemplateList,
workflow_templates: TemplateList,
inventories: InventoryList,
credentials: CredentialList
credentials: CredentialList,
organizations: OrganizationList
};
list = _.cloneDeep(listMap[scope.resourceType]);
@ -63,6 +66,9 @@ export default ['$compile','templateUrl', 'i18n', 'generateList',
break;
case 'job_templates':
case 'workflow_templates':
case 'credentials':
case 'organizations':
list.name = 'job_templates';
list.iterator = 'job_template';
list.fields = {
@ -72,25 +78,6 @@ export default ['$compile','templateUrl', 'i18n', 'generateList',
list.fields.name.columnClass = 'col-md-5 col-sm-5 col-xs-10';
list.fields.description.columnClass = 'col-md-5 col-sm-5 hidden-xs';
break;
case 'workflow_templates':
list.name = 'workflow_templates';
list.iterator = 'workflow_template';
list.basePath = 'workflow_job_templates';
list.fields = {
name: list.fields.name,
description: list.fields.description
};
list.fields.name.columnClass = 'col-md-5 col-sm-5 col-xs-10';
list.fields.description.columnClass = 'col-md-5 col-sm-5 hidden-xs';
break;
case 'credentials':
list.fields = {
name: list.fields.name,
description: list.fields.description
};
list.fields.name.columnClass = 'col-md-5 col-sm-5 col-xs-10';
list.fields.description.columnClass = 'col-md-5 col-sm-5 hidden-xs';
}
list.fields = _.each(list.fields, (field) => field.nosort = true);

View File

@ -18,7 +18,7 @@ function(rootScope, scope, $state, i18n, CreateSelect2, GetBasePath, Rest, $q, W
function init(){
let resources = ['job_templates', 'workflow_templates', 'projects', 'inventories', 'credentials'];
let resources = ['job_templates', 'workflow_templates', 'projects', 'inventories', 'credentials', 'organizations'];
// data model:
// selected - keyed by type of resource
@ -43,7 +43,8 @@ function(rootScope, scope, $state, i18n, CreateSelect2, GetBasePath, Rest, $q, W
workflow_templates: false,
projects: false,
inventories: false,
credentials: false
credentials: false,
organizations: false
};
// initializes select2 per select field

View File

@ -1,7 +1,8 @@
<div id="add-permissions-modal" class="AddPermissions modal fade">
<div class="AddPermissions-backDrop is-loggedOut"></div>
<div class="AddPermissions-dialog">
<div class="AddPermissions-content is-loggedOut">
<div class="AddPermissions-content AddPermissions-content--userTeam
is-loggedOut">
<!-- begin header -->
<div class="AddPermissions-header">
<div class="List-header">
@ -9,7 +10,7 @@
<div class="List-titleText ng-binding">
{{ owner.name || owner.username }}
<div class="List-titleLockup"></div>
{{ title }}
{{ title | uppercase }}
</div>
</div>
<div class="Form-exitHolder">
@ -60,6 +61,12 @@
translate>
Credentials
</div>
<div class="Form-tab"
ng-click="selectTab('organizations')"
ng-class="{'is-selected': tab.organizations}"
translate>
Organizations
</div>
</div>
<div id="AddPermissions-jobTemplates" class="AddPermissions-list" ng-show="tab.job_templates">
@ -77,6 +84,9 @@
<div id="AddPermissions-credentials" class="AddPermissions-list" ng-show="tab.credentials">
<rbac-multiselect-list view="Credentials" all-selected="allSelected" dataset="resolve.credentialsDataset"></rbac-multiselect-list>
</div>
<div id="AddPermissions-organizations" class="AddPermissions-list" ng-show="tab.organizations">
<rbac-multiselect-list view="Organizations" all-selected="allSelected" dataset="resolve.organizationsDataset"></rbac-multiselect-list>
</div>
<!-- end section 1 -->
<!-- begin section 2 -->
@ -127,6 +137,13 @@
translate>
Credentials
</div>
<div class="Form-tab"
ng-click="selectTab('organizations')"
ng-class="{'is-selected': tab.organizations}"
ng-show="showSection2Tab('organizations')"
translate>
Organizations
</div>
</div>
<div class="AddPermissions-keyPane"
ng-show="showKeyPane">
@ -142,7 +159,8 @@
</div>
<!-- role drop-downs -->
<div ng-repeat="(type, roleSet) in keys" ng-show="tab[type]">
<div ng-repeat="(type, roleSet) in keys"
ng-show="tab[type] && showSection2Tab(type)">
<select
id="{{type}}-role-select" class="form-control"
ng-model="roleSelection[type]"

View File

@ -32,6 +32,10 @@
opacity: 1;
}
.AddPermissions-content--userTeam {
max-width: 820px;
}
.AddPermissions-header {
padding: 20px;
padding-bottom: 10px;

View File

@ -7,8 +7,10 @@
/* jshint unused: vars */
export default ['addPermissionsTeamsList', 'addPermissionsUsersList', 'TemplateList', 'ProjectList',
'InventoryList', 'CredentialList', '$compile', 'generateList', 'GetBasePath',
'OrganizationList',
function(addPermissionsTeamsList, addPermissionsUsersList, TemplateList, ProjectList,
InventoryList, CredentialList, $compile, generateList, GetBasePath) {
InventoryList, CredentialList, $compile, generateList, GetBasePath,
OrganizationList) {
return {
restrict: 'E',
scope: {
@ -27,7 +29,8 @@ export default ['addPermissionsTeamsList', 'addPermissionsUsersList', 'TemplateL
JobTemplates: TemplateList,
WorkflowTemplates: TemplateList,
Inventories: InventoryList,
Credentials: CredentialList
Credentials: CredentialList,
Organizations: OrganizationList
};
list = _.cloneDeep(listMap[scope.view]);
list.multiSelect = true;
@ -99,6 +102,14 @@ export default ['addPermissionsTeamsList', 'addPermissionsUsersList', 'TemplateL
list.fields.name.columnClass = 'col-md-6 col-sm-6 col-xs-11';
list.fields.organization.columnClass = 'col-md-5 col-sm-5 hidden-xs';
break;
case 'Organizations':
list.fields = {
name: list.fields.name,
description: list.fields.description,
};
list.fields.name.columnClass = 'col-md-6 col-sm-6 col-xs-11';
list.fields.description.columnClass = 'col-md-5 col-sm-5 hidden-xs';
break;
default:
list.fields = {
name: list.fields.name,

View File

@ -270,6 +270,10 @@ export default ['$injector', '$stateExtender', '$log', 'i18n', function($injecto
credential_search: {
value: {order_by: 'name', page_size: '5', role_level: 'admin_role'},
dynamic: true
},
organization_search: {
value: {order_by: 'name', page_size: '5', role_level: 'admin_role'},
dynamic: true
}
},
ncyBreadcrumb:{
@ -311,6 +315,12 @@ export default ['$injector', '$stateExtender', '$log', 'i18n', function($injecto
return qs.search(path, $stateParams[`${list.iterator}_search`]);
}
],
organizationsDataset: ['OrganizationList', 'QuerySet', '$stateParams', 'GetBasePath',
function(list, qs, $stateParams, GetBasePath) {
let path = GetBasePath(list.basePath) || GetBasePath(list.name);
return qs.search(path, $stateParams[`${list.iterator}_search`]);
}
],
},
onExit: function($state) {
if ($state.transition) {