diff --git a/awx/ui/static/js/controllers/JobTemplates.js b/awx/ui/static/js/controllers/JobTemplates.js index ac59060f53..6b3905c042 100644 --- a/awx/ui/static/js/controllers/JobTemplates.js +++ b/awx/ui/static/js/controllers/JobTemplates.js @@ -462,6 +462,14 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route field: 'credential' }); + LookUpInit({ + scope: scope, + form: form, + current_item: data.cloud_credential, + list: CredentialList, + field: 'cloud_credential' + }); + LookUpInit({ scope: scope, form: form, diff --git a/awx/ui/static/js/controllers/Jobs.js b/awx/ui/static/js/controllers/Jobs.js index 9ace263098..f1bda6313a 100644 --- a/awx/ui/static/js/controllers/Jobs.js +++ b/awx/ui/static/js/controllers/Jobs.js @@ -390,6 +390,14 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, field: 'credential' }); + LookUpInit({ + scope: scope, + form: form, + current_item: data.cloud_credential, + list: CredentialList, + field: 'cloud_credential' + }); + LookUpInit({ scope: scope, form: form, diff --git a/awx/ui/static/js/forms/Credentials.js b/awx/ui/static/js/forms/Credentials.js index fcd8899feb..654dc50a4b 100644 --- a/awx/ui/static/js/forms/Credentials.js +++ b/awx/ui/static/js/forms/Credentials.js @@ -28,31 +28,37 @@ angular.module('CredentialFormDefinition', []) addRequired: false, editRequired: false }, - "ssh_username": { - label: 'SSH Username', + kind: { + label: 'Kind', + type: 'radio', // FIXME: Make select, pull from OPTIONS request + options: [{ label: 'Machine', value: 'ssh' }, { label: 'SCM', value: 'scm'}, { label: 'AWS', value: 'aws'}, { label: 'Rackspace', value: 'rax'}], + //ngChange: 'selectCategory()' + }, + "username": { + label: 'Username', type: 'text', addRequired: false, editRequired: false, autocomplete: false }, - "ssh_password": { - label: 'SSH Password', + "password": { + label: 'Password', type: 'password', addRequired: false, editRequired: false, - ngChange: "clearPWConfirm('ssh_password_confirm')", + ngChange: "clearPWConfirm('password_confirm')", ask: true, clear: true, - associated: 'ssh_password_confirm', + associated: 'password_confirm', autocomplete: false }, - "ssh_password_confirm": { - label: 'Confirm SSH Password', + "password_confirm": { + label: 'Confirm Password', type: 'password', addRequired: false, editRequired: false, awPassMatch: true, - associated: 'ssh_password', + associated: 'password', autocomplete: false }, "ssh_key_data": { diff --git a/awx/ui/static/js/forms/Groups.js b/awx/ui/static/js/forms/Groups.js index c15e700a0c..c1ba2796c5 100644 --- a/awx/ui/static/js/forms/Groups.js +++ b/awx/ui/static/js/forms/Groups.js @@ -112,7 +112,17 @@ angular.module('GroupFormDefinition', []) type: 'text', awRequiredWhen: {variable: "sourcePathRequired", init: "false" } }, - source_username: { + credential: { // FIXME: Lookup doesn't work yet! + label: 'Cloud Credential', + type: 'lookup', + sourceModel: 'credential', + sourceField: 'name', + ngClick: 'lookUpCredential()', + addRequired: false, + editRequired: false, + column: 1 + }, + /*source_username: { labelBind: 'sourceUsernameLabel', excludeModal: true, type: 'text', @@ -141,7 +151,7 @@ angular.module('GroupFormDefinition', []) awPassMatch: true, associated: 'source_password', autocomplete: false - }, + },*/ source_regions: { label: 'Regions', excludeModal: true, diff --git a/awx/ui/static/js/forms/JobTemplates.js b/awx/ui/static/js/forms/JobTemplates.js index b5e0c3363b..9df0df72ce 100644 --- a/awx/ui/static/js/forms/JobTemplates.js +++ b/awx/ui/static/js/forms/JobTemplates.js @@ -72,7 +72,7 @@ angular.module('JobTemplateFormDefinition', []) awRequiredWhen: {variable: "playbookrequired", init: "true" }, column: 1 }, - credential: { + credential: { // FIXME: Lookup only credentials with kind=ssh label: 'Credential', type: 'lookup', sourceModel: 'credential', @@ -82,6 +82,16 @@ angular.module('JobTemplateFormDefinition', []) editRequired: false, column: 1 }, + cloud_credential: { // FIXME: Lookup only credentials with kind=aws/rax + label: 'Cloud Credential', + type: 'lookup', + sourceModel: 'cloud_credential', + sourceField: 'name', + ngClick: 'lookUpCredential()', + addRequired: false, + editRequired: false, + column: 1 + }, forks: { label: 'Forks', id: 'forks-number', diff --git a/awx/ui/static/js/forms/Jobs.js b/awx/ui/static/js/forms/Jobs.js index cecaa6a4e2..919d92ff81 100644 --- a/awx/ui/static/js/forms/Jobs.js +++ b/awx/ui/static/js/forms/Jobs.js @@ -99,7 +99,7 @@ angular.module('JobFormDefinition', []) editRequired: true, column: 1 }, - credential: { + credential: { // FIXME: Lookup only credentials with kind=ssh label: 'Credential', type: 'lookup', sourceModel: 'credential', @@ -109,6 +109,16 @@ angular.module('JobFormDefinition', []) editRequired: false, column: 1 }, + cloud_credential: { // FIXME: Lookup only credentials with kind=aws/rax + label: 'Cloud Credential', + type: 'lookup', + sourceModel: 'cloud_credential', + sourceField: 'name', + ngClick: 'lookUpCredential()', + addRequired: false, + editRequired: false, + column: 1 + }, forks: { label: 'Forks', id: 'forks-number', diff --git a/awx/ui/static/js/forms/Projects.js b/awx/ui/static/js/forms/Projects.js index 1eb5bb98e7..95ad9e1df7 100644 --- a/awx/ui/static/js/forms/Projects.js +++ b/awx/ui/static/js/forms/Projects.js @@ -128,7 +128,16 @@ angular.module('ProjectFormDefinition', []) addRequired: false, editRequired: false }, - auth_required: { + credential: { // FIXME: Lookup doesn't work yet! + label: 'SCM Credential', + type: 'lookup', + sourceModel: 'credential', + sourceField: 'name', + ngClick: 'lookUpCredential()', + addRequired: false, + editRequired: false, + }, + /*auth_required: { label: 'Authorization required?', type: 'checkbox', ngShow: "scm_type !== '' && scm_type !== null", @@ -194,7 +203,7 @@ angular.module('ProjectFormDefinition', []) editRequired: false, awPassMatch: true, associated: 'scm_key_unlock' - }, + },*/ checkbox_group: { label: 'SCM Options', type: 'checkbox_group', diff --git a/awx/ui/static/js/helpers/Groups.js b/awx/ui/static/js/helpers/Groups.js index 4acacbc787..e84bfc836f 100644 --- a/awx/ui/static/js/helpers/Groups.js +++ b/awx/ui/static/js/helpers/Groups.js @@ -517,7 +517,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' scope.groups[i].name + '. Use the Refresh button to monitor the status.', 'alert-info'); } else { - if (scope.groups[i].summary_fields.inventory_source.source == 'ec2') { + /*if (scope.groups[i].summary_fields.inventory_source.source == 'ec2') { scope.sourceUsernameLabel = 'Access Key ID'; scope.sourcePasswordLabel = 'Secret Access Key'; scope.sourcePasswordConfirmLabel = 'Confirm Secret Access Key'; @@ -526,7 +526,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' scope.sourceUsernameLabel = 'Username'; scope.sourcePasswordLabel = 'Password'; scope.sourcePasswordConfirmLabel = 'Confirm Password'; - } + }*/ Rest.setUrl(scope.groups[i].related.inventory_source); Rest.get() .success( function(data, status, headers, config) { @@ -685,11 +685,11 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' scope.source = form.fields.source['default']; scope.parseType = 'yaml'; scope[form.fields['source_vars'].parseTypeName] = 'yaml'; - scope.sourcePasswordRequired = false; + /*scope.sourcePasswordRequired = false; scope.sourceUsernameRequired = false; scope.sourceUsernameLabel = 'Username'; scope.sourcePasswordLabel = 'Password'; - scope.sourcePasswordConfirmLabel = 'Confirm Password'; + scope.sourcePasswordConfirmLabel = 'Confirm Password';*/ scope.sourcePathRequired = false; ParseTypeChange(scope); @@ -855,8 +855,8 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' var data = { group: group_id, source: scope['source'].value, source_path: scope['source_path'], - source_username: scope['source_username'], - source_password: scope['source_password'], + //source_username: scope['source_username'], + //source_password: scope['source_password'], source_regions: scope['source_regions'], overwrite: scope['overwrite'], overwrite_vars: scope['overwrite_vars'], @@ -955,7 +955,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' }; scope.sourceChange = function() { - if (scope['source'].value == 'ec2' || scope['source'].value == 'rackspace') { + /*if (scope['source'].value == 'ec2' || scope['source'].value == 'rackspace') { scope.sourcePasswordRequired = true; scope.sourceUsernameRequired = true; if (scope['source'].value == 'ec2') { @@ -977,7 +977,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' scope.source_password_confirm = ''; scope.source_username = ''; scope[form.name + '_form']['source_username'].$setValidity('required',true); - } + }*/ if (scope['source'].value == 'file') { scope.sourcePathRequired = true; @@ -991,7 +991,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' } // Password change - scope.clearPWConfirm = function(fld) { + /*scope.clearPWConfirm = function(fld) { // If password value changes, make sure password_confirm must be re-entered scope[fld] = ''; scope[form.name + '_form'][fld].$setValidity('awpassmatch', false); @@ -1018,6 +1018,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' scope[form.name + '_form'][associated].$setValidity('awpassmatch', true); scope[form.name + '_form'].$setDirty(); } + */ // Start the update process scope.updateGroup = function() { @@ -1030,7 +1031,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' scope.summary_fields.group.name + '. Use the Refresh button to monitor the status.', 'alert-info'); } else { - if (scope.source == 'Amazon EC2') { + /*if (scope.source == 'Amazon EC2') { scope.sourceUsernameLabel = 'Access Key ID'; scope.sourcePasswordLabel = 'Secret Access Key'; scope.sourcePasswordConfirmLabel = 'Confirm Secret Access Key'; @@ -1039,7 +1040,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' scope.sourceUsernameLabel = 'Username'; scope.sourcePasswordLabel = 'Password'; scope.sourcePasswordConfirmLabel = 'Confirm Password'; - } + }*/ InventoryUpdate({ scope: scope, group_id: group_id, diff --git a/awx/ui/static/js/lists/Credentials.js b/awx/ui/static/js/lists/Credentials.js index 7fa370a2dc..6c936cfa63 100644 --- a/awx/ui/static/js/lists/Credentials.js +++ b/awx/ui/static/js/lists/Credentials.js @@ -29,6 +29,9 @@ angular.module('CredentialsListDefinition', []) label: 'Description', excludeModal: true }, + kind: { + label: 'Kind' + }, team: { label: 'Team', ngBind: 'credential.team_name',