UI support for openstack credential

This commit is contained in:
John Mitchell
2015-04-15 15:25:24 -04:00
parent 2fbfdce12c
commit 77024ef4f7
2 changed files with 60 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
/********************************************* /*********************************************
* Copyright (c) 2014 AnsibleWorks, Inc. * Copyright (c) 2015 AnsibleWorks, Inc.
* *
* Credentials.js * Credentials.js
* Form definition for Credential model * Form definition for Credential model
@@ -156,7 +156,11 @@ export default
"host": { "host": {
labelBind: 'hostLabel', labelBind: 'hostLabel',
type: 'text', type: 'text',
ngShow: "kind.value == 'vmware'", ngShow: "kind.value == 'vmware' || kind.value == 'openstack'",
awPopOverWatch: "projectPopOver",
awPopOver: "set in helpers/credentials",
dataPlacement: 'right',
dataContainer: "body",
autocomplete: false, autocomplete: false,
awRequiredWhen: { awRequiredWhen: {
variable: 'host_required', variable: 'host_required',
@@ -219,9 +223,9 @@ export default
clear: false, clear: false,
}, },
"password": { "password": {
label: 'Password', labelBind: 'passwordLabel',
type: 'sensitive', type: 'sensitive',
ngShow: "kind.value == 'scm' || kind.value == 'vmware'", ngShow: "kind.value == 'scm' || kind.value == 'vmware' || kind.value == 'openstack'",
addRequired: false, addRequired: false,
editRequired: false, editRequired: false,
ask: false, ask: false,
@@ -306,20 +310,20 @@ export default
autocomplete: false autocomplete: false
}, },
"project": { "project": {
label: "Project", labelBind: 'projectLabel',
type: 'text', type: 'text',
ngShow: "kind.value == 'gce'", ngShow: "kind.value == 'gce' || kind.value == 'openstack'",
awRequiredWhen: { awPopOverWatch: "projectPopOver",
variable: 'project_required', awPopOver: "set in helpers/credentials",
init: false // dataTitle: 'Project ID',
},
awPopOver: "<p>The Project ID is the GCE assigned identification. It is constructed as two words followed by a three digit number. Such as: </p><p>adjective-noun-000</p>",
dataTitle: 'Project ID',
dataPlacement: 'right', dataPlacement: 'right',
dataContainer: "body", dataContainer: "body",
addRequired: false, addRequired: false,
editRequired: false, editRequired: false,
autocomplete: false awRequiredWhen: {
variable: 'project_required',
init: false
}
}, },
"vault_password": { "vault_password": {
label: "Vault Password", label: "Vault Password",

View File

@@ -1,5 +1,5 @@
/********************************************* /*********************************************
* Copyright (c) 2014 AnsibleWorks, Inc. * Copyright (c) 2015 AnsibleWorks, Inc.
* *
* Credentials.js * Credentials.js
* *
@@ -44,6 +44,7 @@ angular.module('CredentialsHelper', ['Utilities'])
scope.host_required = false; scope.host_required = false;
scope.password_required = false; scope.password_required = false;
scope.hostLabel = ''; scope.hostLabel = '';
scope.passwordLabel = 'Password';
$('.popover').each(function() { $('.popover').each(function() {
// remove lingering popover <div>. Seems to be a bug in TB3 RC1 // remove lingering popover <div>. Seems to be a bug in TB3 RC1
@@ -68,6 +69,11 @@ angular.module('CredentialsHelper', ['Utilities'])
scope.host_required = false; scope.host_required = false;
scope.password_required = false; scope.password_required = false;
scope.hostLabel = ''; scope.hostLabel = '';
scope.projectLabel = '';
scope.project_required = false;
scope.passwordLabel = 'Password (API Key)';
scope.projectPopOver = "<p>The project value</p>";
scope.hostPopOver = "<p>The host value</p>";
if (!Empty(scope.kind)) { if (!Empty(scope.kind)) {
// Apply kind specific settings // Apply kind specific settings
@@ -77,36 +83,57 @@ angular.module('CredentialsHelper', ['Utilities'])
break; break;
case 'rax': case 'rax':
scope.rackspace_required = true; scope.rackspace_required = true;
scope.username_required = true; scope.username_required = true;
break; break;
case 'ssh': case 'ssh':
scope.usernameLabel = 'Username'; //formally 'SSH Username' scope.usernameLabel = 'Username'; //formally 'SSH Username'
break; break;
case 'scm': case 'scm':
scope.sshKeyDataLabel = 'SCM Private Key'; scope.sshKeyDataLabel = 'SCM Private Key';
scope.passwordLabel = 'Password';
break; break;
case 'gce': case 'gce':
scope.usernameLabel = 'Service Account Email Address'; scope.usernameLabel = 'Service Account Email Address';
scope.sshKeyDataLabel = 'RSA Private Key'; scope.sshKeyDataLabel = 'RSA Private Key';
scope.email_required = true; scope.email_required = true;
scope.key_required = true; scope.key_required = true;
scope.project_required = true; scope.project_required = true;
scope.key_description = 'Paste the contents of the PEM file associated with the service account email.'; scope.key_description = 'Paste the contents of the PEM file associated with the service account email.';
scope.key_hint= "drag and drop a private key file on the field below"; scope.key_hint= "drag and drop a private key file on the field below";
scope.projectLabel = "Project";
scope.project_required = false;
scope.projectPopOver = "<p>The Project ID is the " +
"GCE assigned identification. It is constructed as " +
"two words followed by a three digit number. Such " +
"as: </p><p>adjective-noun-000</p>";
break; break;
case 'azure': case 'azure':
scope.usernameLabel = "Subscription ID"; scope.usernameLabel = "Subscription ID";
scope.sshKeyDataLabel = 'Management Certificate'; scope.sshKeyDataLabel = 'Management Certificate';
scope.subscription_required = true; scope.subscription_required = true;
scope.key_required = true; scope.key_required = true;
scope.key_description = "Paste the contents of the PEM file that corresponds to the certificate you uploaded in the Microsoft Azure console."; scope.key_description = "Paste the contents of the PEM file that corresponds to the certificate you uploaded in the Microsoft Azure console.";
scope.key_hint= "drag and drop a management certificate file on the field below"; scope.key_hint= "drag and drop a management certificate file on the field below";
break; break;
case 'vmware': case 'vmware':
scope.username_required = true; scope.username_required = true;
scope.host_required = true; scope.host_required = true;
scope.password_required = true; scope.password_required = true;
scope.hostLabel = "vCenter Host"; scope.hostLabel = "vCenter Host";
scope.passwordLabel = 'Password';
break;
case 'openstack':
scope.hostLabel = "Host (Authentication URL)";
scope.projectLabel = "Project (Tenet Name/ID)";
scope.password_required = true;
scope.project_required = true;
scope.host_required = true;
scope.username_required = true;
scope.projectPopOver = "<p>This is the tenant name " +
"or tenant id. This value is usually the same " +
" as the username.</p>";
scope.hostPopOver = "<p>The host to authenticate with." +
"<br />For example, https://openstack.business.com/v2.0/";
break; break;
} }
} }