From 33bb3abd52ce6b7b6458d2766a5621c6dfd31428 Mon Sep 17 00:00:00 2001 From: Ken Hoes Date: Wed, 13 Jul 2016 15:14:12 -0400 Subject: [PATCH 1/2] Retrieved cloud credential from job template summary fields --- .../edit/job-templates-edit.controller.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 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 ff9766ac55..4687840b70 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 @@ -347,20 +347,13 @@ export default ParseTypeChange({ scope: $scope, field_id: 'job_templates_variables', onChange: callback }); - if (related_cloud_credential) { - Rest.setUrl(related_cloud_credential); - Rest.get() - .success(function (data) { - $scope.$emit('cloudCredentialReady', data.name); - }) - .error(function (data, status) { - ProcessErrors($scope, data, status, null, {hdr: 'Error!', - msg: 'Failed to related cloud credential. GET returned status: ' + status }); - }); + if(related_cloud_credential) { + $scope.$emit('cloudCredentialReady', $scope.job_template_obj.summary_fields.cloud_credential.name); } else { // No existing cloud credential $scope.$emit('cloudCredentialReady', null); } + }); Wait('start'); From 906db7d75e11afc8bb9fad012912598dbdcc0e69 Mon Sep 17 00:00:00 2001 From: Ken Hoes Date: Thu, 14 Jul 2016 08:50:42 -0400 Subject: [PATCH 2/2] Added condition based off PR feedback --- .../src/job-templates/edit/job-templates-edit.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4687840b70..0eb0ac028b 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 @@ -347,7 +347,7 @@ export default ParseTypeChange({ scope: $scope, field_id: 'job_templates_variables', onChange: callback }); - if(related_cloud_credential) { + if($scope.job_template_obj.summary_fields.cloud_credential.name && related_cloud_credential) { $scope.$emit('cloudCredentialReady', $scope.job_template_obj.summary_fields.cloud_credential.name); } else { // No existing cloud credential