From 5df7833038e81ec34672ddeed4fdf546e4da741f Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Tue, 22 Jul 2014 16:24:34 -0400 Subject: [PATCH] fixed defect with GCE cred's not showing up in inventory groups modal window --- awx/ui/static/js/controllers/Credentials.js | 3 +++ awx/ui/static/js/forms/Credentials.js | 14 ++++++++++++-- awx/ui/static/js/helpers/Credentials.js | 3 +++ awx/ui/static/js/helpers/Groups.js | 12 ++++++++++-- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/awx/ui/static/js/controllers/Credentials.js b/awx/ui/static/js/controllers/Credentials.js index 12fe028c17..a5d11142cf 100644 --- a/awx/ui/static/js/controllers/Credentials.js +++ b/awx/ui/static/js/controllers/Credentials.js @@ -393,6 +393,9 @@ function CredentialsEdit($scope, $rootScope, $compile, $location, $log, $routePa $scope.api_key = data.password; master.api_key = $scope.api_key; break; + case 'gce': + $scope.email_address = data.username; + $scope.project = data.project; } $scope.$emit('credentialLoaded'); diff --git a/awx/ui/static/js/forms/Credentials.js b/awx/ui/static/js/forms/Credentials.js index 695a821d6c..b5a5862e9d 100644 --- a/awx/ui/static/js/forms/Credentials.js +++ b/awx/ui/static/js/forms/Credentials.js @@ -141,7 +141,17 @@ angular.module('CredentialFormDefinition', []) "username": { labelBind: 'usernameLabel', type: 'text', - ngShow: "kind.value && kind.value !== 'aws'", + ngShow: "kind.value && kind.value !== 'aws' && kind.value!=='gce'", + awRequiredWhen: { + variable: 'aws_required', + init: false + }, + autocomplete: false + }, + "email_address": { + labelBind: 'usernameLabel', + type: 'email', + ngShow: "kind.value === 'gce'", awRequiredWhen: { variable: 'username_required', init: false @@ -159,7 +169,7 @@ angular.module('CredentialFormDefinition', []) autocomplete: false, ask: false, clear: false, - apiField: 'passwowrd' + // apiField: 'passwowrd' }, "password": { label: 'Password', diff --git a/awx/ui/static/js/helpers/Credentials.js b/awx/ui/static/js/helpers/Credentials.js index 69ad630d57..59d2638753 100644 --- a/awx/ui/static/js/helpers/Credentials.js +++ b/awx/ui/static/js/helpers/Credentials.js @@ -149,6 +149,9 @@ angular.module('CredentialsHelper', ['Utilities']) case 'rax': data.password = scope.api_key; break; + case 'gce': + data.username = scope.email_address; + data.project = scope.project; } if (Empty(data.team) && Empty(data.user)) { diff --git a/awx/ui/static/js/helpers/Groups.js b/awx/ui/static/js/helpers/Groups.js index 3a911dc92a..36e6134243 100644 --- a/awx/ui/static/js/helpers/Groups.js +++ b/awx/ui/static/js/helpers/Groups.js @@ -235,9 +235,17 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' text: 'All' }]); $('#source_form').addClass('squeeze'); + } else if (scope.source.value === 'gce') { + scope.source_region_choices = scope.gce_regions; + //$('#s2id_group_source_regions').select2('data', []); + $('#s2id_source_source_regions').select2('data', [{ + id: 'all', + text: 'All' + }]); + $('#source_form').addClass('squeeze'); } - if (scope.source.value === 'rax' || scope.source.value === 'ec2') { - kind = (scope.source.value === 'rax') ? 'rax' : 'aws'; + if (scope.source.value === 'rax' || scope.source.value === 'ec2'|| scope.source.value==='gce') { + kind = (scope.source.value === 'rax') ? 'rax' : (scope.source.value==='gce') ? 'gce' : 'aws'; url = GetBasePath('credentials') + '?cloud=true&kind=' + kind; LookUpInit({ url: url,