diff --git a/awx/ui/client/src/organizations/linkout/organizations-linkout.route.js b/awx/ui/client/src/organizations/linkout/organizations-linkout.route.js index 20f8b6a6c3..deae3ddf13 100644 --- a/awx/ui/client/src/organizations/linkout/organizations-linkout.route.js +++ b/awx/ui/client/src/organizations/linkout/organizations-linkout.route.js @@ -216,6 +216,78 @@ let lists = [{ } ] } +}, { + name: 'organizations.job_templates', + url: '/:organization_id/job_templates', + searchPrefix: 'job_template', + views: { + 'form': { + controller: OrganizationsJobTemplates, + templateProvider: function(OrgJobTemplateList, generateList) { + let html = generateList.build({ + list: OrgJobTemplateList, + mode: 'edit', + cancelButton: true + }); + return generateList.wrapPanel(html); + }, + }, + }, + params: { + template_search: { + value: { + or__project__organization: null, + or__inventory__organization: null, + page_size: 20 + }, + dynamic: true + } + }, + data: { + activityStream: true, + activityStreamTarget: 'organization', + socket: { + "groups": { + "jobs": ["status_changed"] + } + } + }, + ncyBreadcrumb: { + parent: "organizations.edit", + label: N_("JOB TEMPLATES") + }, + resolve: { + features: ['FeaturesService', function(FeaturesService) { + return FeaturesService.get(); + }], + OrgJobTemplateList: ['TemplateList', 'GetBasePath', '$stateParams', function(TemplateList) { + let list = _.cloneDeep(TemplateList); + delete list.actions; + // @issue Why is the delete action unavailable in this view? + delete list.fieldActions.delete; + delete list.fields.type; + list.listTitle = N_('Job Templates') + ` | {{ name }}`; + list.emptyListText = "This list is populated by job templates added from the Job Templates section"; + list.iterator = 'template'; + list.name = 'job_templates'; + list.basePath = "job_templates"; + list.fields.smart_status.ngInclude = "'/static/partials/organizations-job-template-smart-status.html'"; + list.fields.name.ngHref = '#/templates/job_template/{{template.id}}'; + list.fieldActions.schedule.ngClick = 'scheduleJob(template.id)'; + list.fieldActions.copy.ngClick = 'copyTemplate(template.id)'; + list.fieldActions.edit.ngClick = "editJobTemplate(template.id)"; + list.fieldActions.view.ngClick = "editJobTemplate(template.id)"; + return list; + }], + OrgJobTemplateDataset: ['OrgJobTemplateList', 'QuerySet', '$stateParams', 'GetBasePath', + function(list, qs, $stateParams, GetBasePath) { + let path = GetBasePath(list.name); + $stateParams.template_search.or__project__organization = $stateParams.organization_id; + $stateParams.template_search.or__inventory__organization = $stateParams.organization_id; + return qs.search(path, $stateParams.template_search); + } + ] + } }, { name: 'organizations.admins', url: '/:organization_id/admins',