From c753328a0b6f793a964ced36cce79d3e7423b5fb Mon Sep 17 00:00:00 2001 From: Leigh Johnson Date: Tue, 13 Dec 2016 15:33:47 -0500 Subject: [PATCH] split templates into job templates / workflow job templates --- .../rbac-user-team.controller.js | 3 +- .../rbac-user-team.directive.js | 1 - .../rbac-user-team.partial.html | 20 ++++-- .../rbac-multiselect-list.directive.js | 62 +++++++++++++------ .../src/shared/stateDefinitions.factory.js | 22 +++++-- 5 files changed, 76 insertions(+), 32 deletions(-) diff --git a/awx/ui/client/src/access/add-rbac-user-team/rbac-user-team.controller.js b/awx/ui/client/src/access/add-rbac-user-team/rbac-user-team.controller.js index 981478d6d0..9888370e54 100644 --- a/awx/ui/client/src/access/add-rbac-user-team/rbac-user-team.controller.js +++ b/awx/ui/client/src/access/add-rbac-user-team/rbac-user-team.controller.js @@ -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 diff --git a/awx/ui/client/src/access/add-rbac-user-team/rbac-user-team.directive.js b/awx/ui/client/src/access/add-rbac-user-team/rbac-user-team.directive.js index 2b89195820..8790410ee3 100644 --- a/awx/ui/client/src/access/add-rbac-user-team/rbac-user-team.directive.js +++ b/awx/ui/client/src/access/add-rbac-user-team/rbac-user-team.directive.js @@ -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'); diff --git a/awx/ui/client/src/access/add-rbac-user-team/rbac-user-team.partial.html b/awx/ui/client/src/access/add-rbac-user-team/rbac-user-team.partial.html index e6ba2326af..f148a25d70 100644 --- a/awx/ui/client/src/access/add-rbac-user-team/rbac-user-team.partial.html +++ b/awx/ui/client/src/access/add-rbac-user-team/rbac-user-team.partial.html @@ -33,14 +33,19 @@
+ ng-click="selectTab('job_templates')" + ng-class="{'is-selected': tab.job_templates }"> Templates
+ Workflow Templates +
+
Projects
-
- +
+ +
+
+
diff --git a/awx/ui/client/src/access/rbac-multiselect/rbac-multiselect-list.directive.js b/awx/ui/client/src/access/rbac-multiselect/rbac-multiselect-list.directive.js index 1cc5f29f3d..d94411ff0f 100644 --- a/awx/ui/client/src/access/rbac-multiselect/rbac-multiselect-list.directive.js +++ b/awx/ui/client/src/access/rbac-multiselect/rbac-multiselect-list.directive.js @@ -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', diff --git a/awx/ui/client/src/shared/stateDefinitions.factory.js b/awx/ui/client/src/shared/stateDefinitions.factory.js index 62b7f9cb68..21ba01aade 100644 --- a/awx/ui/client/src/shared/stateDefinitions.factory.js +++ b/awx/ui/client/src/shared/stateDefinitions.factory.js @@ -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',