From e6322baf20bcabe797d297e9f7bda0bef68c6bfd Mon Sep 17 00:00:00 2001 From: Akita Noek Date: Thu, 19 May 2016 12:08:46 -0400 Subject: [PATCH] Show selected playbook in JT's even if you can't read the project #1955 --- .../edit/job-templates-edit.controller.js | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/awx/ui/client/src/job-templates/edit/job-templates-edit.controller.js b/awx/ui/client/src/job-templates/edit/job-templates-edit.controller.js index 2b1412f113..a2c2635bd8 100644 --- a/awx/ui/client/src/job-templates/edit/job-templates-edit.controller.js +++ b/awx/ui/client/src/job-templates/edit/job-templates-edit.controller.js @@ -78,6 +78,10 @@ export default getPlaybooks = function (project) { var url; + if ($scope.playbook) { + $scope.playbook_options = [$scope.playbook]; + } + if($scope.job_type.value === 'scan' && $scope.project_name === "Default"){ $scope.playbook_options = ['Default']; $scope.playbook = 'Default'; @@ -103,10 +107,14 @@ export default Wait('stop'); } }) - .error(function () { + .error(function (ret,status_code) { + if (status_code == 403) { + /* user doesn't have access to see the project, no big deal. */ + } else { + Alert('Missing Playbooks', 'Unable to retrieve the list of playbooks for this project. Choose a different ' + + ' project or make the playbooks available on the file system.', 'alert-info'); + } Wait('stop'); - Alert('Missing Playbooks', 'Unable to retrieve the list of playbooks for this project. Choose a different ' + - ' project or make the playbooks available on the file system.', 'alert-info'); }); } else { @@ -190,8 +198,12 @@ export default } }) .error(function (data, status) { - ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to get project ' + $scope.project + - '. GET returned status: ' + status }); + if (status == 403) { + /* User doesn't have read access to the project, no problem. */ + } else { + ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to get project ' + $scope.project + + '. GET returned status: ' + status }); + } }); } };