From a21a740bad92bb1591fe67abd7caa061ba6cf515 Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Mon, 2 Dec 2013 18:48:27 +0000 Subject: [PATCH] AC-741 scm and machine type credentials now sharing ssh_key_unlock field in Credential form definition. Originally split because only machine should allow Ask option. Added new askShow option to form generator so that Ask checkbox gets an ng-show directive. --- awx/ui/static/js/controllers/Credentials.js | 3 --- awx/ui/static/js/forms/Credentials.js | 25 +++------------------ awx/ui/static/js/helpers/Credentials.js | 3 --- awx/ui/static/lib/ansible/form-generator.js | 4 +++- 4 files changed, 6 insertions(+), 29 deletions(-) diff --git a/awx/ui/static/js/controllers/Credentials.js b/awx/ui/static/js/controllers/Credentials.js index b4fbff2e8a..1c8d514830 100644 --- a/awx/ui/static/js/controllers/Credentials.js +++ b/awx/ui/static/js/controllers/Credentials.js @@ -373,9 +373,6 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP scope['ssh_password'] = data.password; master['ssh_password'] = scope['ssh_password']; break; - case 'scm': - scope['scm_key_unlock'] = data['ssh_key_unlock']; - break; case 'rax': scope['api_key'] = data['password']; master['api_key'] = scope['api_key']; diff --git a/awx/ui/static/js/forms/Credentials.js b/awx/ui/static/js/forms/Credentials.js index 3ba0e4b4fb..9dd125caa6 100644 --- a/awx/ui/static/js/forms/Credentials.js +++ b/awx/ui/static/js/forms/Credentials.js @@ -194,43 +194,24 @@ angular.module('CredentialFormDefinition', []) "ssh_key_unlock": { label: 'Key Password', type: 'password', - ngShow: "kind.value == 'ssh'", + ngShow: "kind.value == 'ssh' || kind.value == 'scm'", addRequired: false, editRequired: false, ngChange: "clearPWConfirm('ssh_key_unlock_confirm')", associated: 'ssh_key_unlock_confirm', ask: true, + askShow: "kind.value == 'ssh'", //Only allow ask for machine credentials clear: true }, "ssh_key_unlock_confirm": { label: 'Confirm Key Password', type: 'password', - ngShow: "kind.value == 'ssh'", + ngShow: "kind.value == 'ssh' || kind.value == 'scm'", addRequired: false, editRequired: false, awPassMatch: true, associated: 'ssh_key_unlock' }, - "scm_key_unlock": { - label: 'Key Password', - type: 'password', - ngShow: "kind.value == 'scm'", - addRequired: false, - editRequired: false, - ngChange: "clearPWConfirm('scm_key_unlock_confirm')", - associated: 'scm_key_unlock_confirm', - ask: false, - clear: true - }, - "scm_key_unlock_confirm": { - label: 'Confirm Key Password', - type: 'password', - ngShow: "kind.value == 'scm'", - addRequired: false, - editRequired: false, - awPassMatch: true, - associated: 'scm_key_unlock' - }, "sudo_username": { label: 'Sudo Username', type: 'text', diff --git a/awx/ui/static/js/helpers/Credentials.js b/awx/ui/static/js/helpers/Credentials.js index b8161b0240..bfec19c2c9 100644 --- a/awx/ui/static/js/helpers/Credentials.js +++ b/awx/ui/static/js/helpers/Credentials.js @@ -134,9 +134,6 @@ angular.module('CredentialsHelper', ['Utilities']) data['username'] = scope['access_key']; data['password'] = scope['secret_key']; break; - case 'scm': - data['ssh_key_unlock'] = scope['scm_key_unlock']; - break; case 'rax': data['password'] = scope['api_key']; break; diff --git a/awx/ui/static/lib/ansible/form-generator.js b/awx/ui/static/lib/ansible/form-generator.js index 22bd00ea63..817126a644 100644 --- a/awx/ui/static/lib/ansible/form-generator.js +++ b/awx/ui/static/lib/ansible/form-generator.js @@ -525,7 +525,9 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies', 'Utilities']) html += " >\n"; html += "\n\n"; if (field.ask) { - html += "