1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

split templates into job templates / workflow job templates

This commit is contained in:
Leigh Johnson 2016-12-13 15:33:47 -05:00
parent ce12b97d75
commit c753328a0b
5 changed files with 76 additions and 32 deletions

View File

@ -31,7 +31,8 @@ function(rootScope, scope, $state, GetBasePath, Rest, $q, Wait, ProcessErrors) {
_.each(resources, (resource) => scope.keys[resource] = {});
scope.tab = {
templates: true,
job_templates: true,
workflow_templates: false,
projects: false,
inventories: false,
credentials: false

View File

@ -14,7 +14,6 @@ export default ['templateUrl',
resolve: "="
},
controller: controller,
controllerAs: 'rbac',
templateUrl: templateUrl('access/add-rbac-user-team/rbac-user-team'),
link: function(scope, element, attrs) {
$('#add-permissions-modal').modal('show');

View File

@ -33,14 +33,19 @@
<div class="Form-tabHolder">
<div class="Form-tab"
ng-click="selectTab('templates')"
ng-class="{'is-selected': tab.templates }">
ng-click="selectTab('job_templates')"
ng-class="{'is-selected': tab.job_templates }">
Templates
</div>
<div class="Form-tab"
ng-click="selectTab('projects')"
ng-class="{'is-selected': tab.projects}"
ng-click="selectTab('workflow_templates')"
ng-class="{'is-selected': tab.workflow_templates}"
>
Workflow Templates
</div>
<div class="Form-tab"
ng-click="selectTab('projects')"
ng-class="{'is-selected': tab.projects }">
Projects
</div>
<div class="Form-tab"
@ -57,8 +62,11 @@
</div>
</div>
<div id="AddPermissions-users" class="AddPermissions-list" ng-show="tab.templates">
<rbac-multiselect-list view="Templates" all-selected="allSelected" dataset="resolve.templatesDataset"></rbac-multiselect-list>
<div id="AddPermissions-jobTemplates" class="AddPermissions-list" ng-show="tab.job_templates">
<rbac-multiselect-list view="JobTemplates" all-selected="allSelected" dataset="resolve.jobTemplatesDataset"></rbac-multiselect-list>
</div>
<div id="AddPermissions-jobTemplates" class="AddPermissions-list" ng-show="tab.workflow_templates">
<rbac-multiselect-list view="WorkflowTemplates" all-selected="allSelected" dataset="resolve.workflowTemplatesDataset"></rbac-multiselect-list>
</div>
<div id="AddPermissions-projects" class="AddPermissions-list" ng-show="tab.projects">
<rbac-multiselect-list view="Projects" all-selected="allSelected" dataset="resolve.projectsDataset"></rbac-multiselect-list>

View File

@ -24,7 +24,8 @@ export default ['addPermissionsTeamsList', 'addPermissionsUsersList', 'TemplateL
Teams: addPermissionsTeamsList,
Users: addPermissionsUsersList,
Projects: ProjectList,
Templates: TemplateList,
JobTemplates: TemplateList,
WorkflowTemplates: TemplateList,
Inventories: InventoryList,
Credentials: CredentialList
};
@ -34,23 +35,48 @@ export default ['addPermissionsTeamsList', 'addPermissionsUsersList', 'TemplateL
list.listTitleBadge = false;
delete list.actions;
delete list.fieldActions;
if (scope.view !== 'Users' && scope.view !== 'Teams' && scope.view !=='Projects' && scope.view !== 'Inventories'){
list.fields = {
name: list.fields.name,
description: list.fields.description
};
} else if (scope.view === 'Projects'){
list.fields = {
name: list.fields.name,
scm_type: list.fields.scm_type
};
} else if (scope.view === 'Inventories'){
list.fieds = {
name: list.fields.name,
organization: list.fields.organization
};
}
switch(scope.view){
case 'Projects':
list.fields = {
name: list.fields.name,
scm_type: list.fields.scm_type
};
break;
case 'Inventories':
list.fields = {
name: list.fields.name,
organization: list.fields.organization
};
break;
case 'JobTemplates':
list.name = 'job_templates';
list.iterator = 'job_template';
list.fields = {
name: list.fields.name,
description: list.fields.description
};
break;
case 'WorkflowTemplates':
list.name = 'workflow_templates';
list.iterator = 'workflow_template',
list.basePath = 'workflow_job_templates';
list.fields = {
name: list.fields.name,
description: list.fields.description
};
break;
default:
list.fields = {
name: list.fields.name,
description: list.fields.description
};
}
list_html = generateList.build({
mode: 'edit',

View File

@ -242,8 +242,12 @@ export default ['$injector', '$stateExtender', '$log', function($injector, $stat
value: {order_by: 'name', page_size: '5'},
dynamic: true
},
template_search: {
value: {order_by: 'name', page_size: '5', type: 'workflow_job_template,job_template'}, // @issue and also system_job_template?
job_template_search: {
value: {order_by: 'name', page_size: '5'},
dynamic: true
},
workflow_template_search: {
value: {order_by: 'name', page_size: '5'},
dynamic: true
},
inventory_search: {
@ -261,10 +265,16 @@ export default ['$injector', '$stateExtender', '$log', function($injector, $stat
}
},
resolve: {
templatesDataset: ['TemplateList', 'QuerySet', '$stateParams', 'GetBasePath',
function(list, qs, $stateParams, GetBasePath) {
let path = GetBasePath(list.basePath) || GetBasePath(list.name);
return qs.search(path, $stateParams[`${list.iterator}_search`]);
jobTemplatesDataset: ['QuerySet', '$stateParams', 'GetBasePath',
function(qs, $stateParams, GetBasePath) {
let path = GetBasePath('job_templates');
return qs.search(path, $stateParams.job_template_search);
}
],
workflowTemplatesDataset: ['QuerySet', '$stateParams', 'GetBasePath',
function(qs, $stateParams, GetBasePath) {
let path = GetBasePath('workflow_job_templates');
return qs.search(path, $stateParams.workflow_template_search);
}
],
projectsDataset: ['ProjectList', 'QuerySet', '$stateParams', 'GetBasePath',