From fcad385bcbc4036b70e51eec6273b36b3fee38db Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Tue, 5 Jul 2016 11:35:59 -0400 Subject: [PATCH] Explicitly set the credential lists base path to include the ?kind= param so that future searches will have the correct base path. --- .../manage/groups/groups-add.controller.js | 14 ++------ .../manage/groups/groups-edit.controller.js | 32 +++++-------------- 2 files changed, 11 insertions(+), 35 deletions(-) diff --git a/awx/ui/client/src/inventories/manage/groups/groups-add.controller.js b/awx/ui/client/src/inventories/manage/groups/groups-add.controller.js index 2c476c7d26..f7b8281447 100644 --- a/awx/ui/client/src/inventories/manage/groups/groups-add.controller.js +++ b/awx/ui/client/src/inventories/manage/groups/groups-add.controller.js @@ -93,18 +93,10 @@ input_type: "radio" }); } - else if (source === 'ec2'){ - LookUpInit({ - scope: $scope, - url: GetBasePath('credentials') + '?kind=aws', - form: form, - list: CredentialList, - field: 'credential', - input_type: "radio" - }); - } - // equal to case 'rax' || 'azure' || 'azure_rm' || 'vmware' || 'satellite6' || 'cloudforms' || 'openstack' || 'custom' + // equal to case 'ec2' || 'rax' || 'azure' || 'azure_rm' || 'vmware' || 'satellite6' || 'cloudforms' || 'openstack' else{ + var credentialBasePath = (source === 'ec2') ? GetBasePath('credentials') + '?kind=aws' : GetBasePath('credentials') + (source === '' ? '' : '?kind=' + (source)); + CredentialList.basePath = credentialBasePath; LookUpInit({ scope: $scope, url: GetBasePath('credentials') + (source === '' ? '' : '?kind=' + source), diff --git a/awx/ui/client/src/inventories/manage/groups/groups-edit.controller.js b/awx/ui/client/src/inventories/manage/groups/groups-edit.controller.js index 5fcf9930a5..266eef430a 100644 --- a/awx/ui/client/src/inventories/manage/groups/groups-edit.controller.js +++ b/awx/ui/client/src/inventories/manage/groups/groups-edit.controller.js @@ -92,20 +92,12 @@ input_type: "radio" }); } - else if (source.value === 'ec2'){ - LookUpInit({ - scope: $scope, - url: GetBasePath('credentials') + '?kind=aws', - form: form, - list: CredentialList, - field: 'credential', - input_type: "radio" - }); - } else{ + var credentialBasePath = (source.value === 'ec2') ? GetBasePath('credentials') + '?kind=aws' : GetBasePath('credentials') + (source.value === '' ? '' : '?kind=' + (source.value)); + CredentialList.basePath = credentialBasePath; LookUpInit({ scope: $scope, - url: GetBasePath('credentials') + (source.value === '' ? '' : '?kind=' + (source.value)), + url: credentialBasePath, form: form, list: CredentialList, field: 'credential', @@ -260,27 +252,19 @@ $scope = angular.extend($scope, groupData); // instantiate lookup fields - if (inventorySourceData.source !== 'custom' && inventorySourceData.source !== 'ec2'){ + if (inventorySourceData.source !== 'custom'){ + var credentialBasePath = (inventorySourceData.source === 'ec2') ? GetBasePath('credentials') + '?kind=aws' : GetBasePath('credentials') + (inventorySourceData.source === '' ? '' : '?kind=' + (inventorySourceData.source)); + CredentialList.basePath = credentialBasePath; LookUpInit({ scope: $scope, - url: GetBasePath('credentials') + (inventorySourceData.source === '' ? '' : '?kind=' + (inventorySourceData.source)), + url: credentialBasePath, form: form, list: CredentialList, field: 'credential', input_type: "radio" }); } - else if (inventorySourceData.source === 'ec2'){ - LookUpInit({ - scope: $scope, - url: GetBasePath('credentials') + '?kind=aws', - form: form, - list: CredentialList, - field: 'credential', - input_type: "radio" - }); - } - // equal to case 'rax' || 'azure' || 'azure_rm' || 'vmware' || 'satellite6' || 'cloudforms' || 'openstack' || 'custom' + // equal to case 'custom' else{ $scope.inventory_script_name = inventorySourceData.summary_fields.source_script.name; LookUpInit({