From 8c741ac36a7c97bf29f87ed2b79de1c82c21b881 Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Wed, 13 Nov 2013 18:27:29 +0000 Subject: [PATCH] AC-628 applied credential changes made in add controller to edit controller so that credential/cloud_credential lookups display context-aware credential lists. --- awx/ui/static/js/controllers/JobTemplates.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/awx/ui/static/js/controllers/JobTemplates.js b/awx/ui/static/js/controllers/JobTemplates.js index 653401672b..0484e450cc 100644 --- a/awx/ui/static/js/controllers/JobTemplates.js +++ b/awx/ui/static/js/controllers/JobTemplates.js @@ -494,6 +494,7 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route }); LookUpInit({ + url: GetBasePath('credentials') + '?kind=ssh', scope: scope, form: form, current_item: data.credential, @@ -501,11 +502,19 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route field: 'credential' }); + // Clone the CredentialList object for use with cloud_credential. Cloning + // and changing properties to avoid collision. + var CloudCredentialList = {}; + jQuery.extend(true, CloudCredentialList, CredentialList); + CloudCredentialList.name = 'cloudcredentials', + CloudCredentialList.iterator = 'cloudcredential', + LookUpInit({ + url: GetBasePath('credentials') + '?cloud=true', scope: scope, form: form, current_item: data.cloud_credential, - list: CredentialList, + list: CloudCredentialList, field: 'cloud_credential' });