diff --git a/awx/ui/client/src/home/dashboard/lists/job-templates/job-templates-list.directive.js b/awx/ui/client/src/home/dashboard/lists/job-templates/job-templates-list.directive.js index 0a221db406..1673d56d53 100644 --- a/awx/ui/client/src/home/dashboard/lists/job-templates/job-templates-list.directive.js +++ b/awx/ui/client/src/home/dashboard/lists/job-templates/job-templates-list.directive.js @@ -1,8 +1,7 @@ /* jshint unused: vars */ export default - [ 'templateUrl', - '$state', - function JobTemplatesList(templateUrl, $state) { + ['templateUrl', '$state', 'Rest', 'GetBasePath', + function JobTemplatesList(templateUrl, $state, Rest, GetBasePath) { return { restrict: 'E', link: link, @@ -25,6 +24,18 @@ export default } }); + scope.canAddJobTemplate = false; + let url = GetBasePath('job_templates'); + Rest.setUrl(url); + Rest.options() + .then(({ data }) => { + if (!data.actions.POST) { + scope.canAddJobTemplate = false; + } else { + scope.canAddJobTemplate = true; + } + }); + function createList(list) { // smartStatus?, launchUrl, editUrl, name scope.templates = _.map(list, function(template){ return { diff --git a/awx/ui/client/src/home/dashboard/lists/job-templates/job-templates-list.partial.html b/awx/ui/client/src/home/dashboard/lists/job-templates/job-templates-list.partial.html index 2d100d18f7..1e5606275d 100644 --- a/awx/ui/client/src/home/dashboard/lists/job-templates/job-templates-list.partial.html +++ b/awx/ui/client/src/home/dashboard/lists/job-templates/job-templates-list.partial.html @@ -53,7 +53,9 @@
-