mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 17:37:37 -02:30
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.
This commit is contained in:
@@ -373,9 +373,6 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
scope['ssh_password'] = data.password;
|
scope['ssh_password'] = data.password;
|
||||||
master['ssh_password'] = scope['ssh_password'];
|
master['ssh_password'] = scope['ssh_password'];
|
||||||
break;
|
break;
|
||||||
case 'scm':
|
|
||||||
scope['scm_key_unlock'] = data['ssh_key_unlock'];
|
|
||||||
break;
|
|
||||||
case 'rax':
|
case 'rax':
|
||||||
scope['api_key'] = data['password'];
|
scope['api_key'] = data['password'];
|
||||||
master['api_key'] = scope['api_key'];
|
master['api_key'] = scope['api_key'];
|
||||||
|
|||||||
@@ -194,43 +194,24 @@ angular.module('CredentialFormDefinition', [])
|
|||||||
"ssh_key_unlock": {
|
"ssh_key_unlock": {
|
||||||
label: 'Key Password',
|
label: 'Key Password',
|
||||||
type: 'password',
|
type: 'password',
|
||||||
ngShow: "kind.value == 'ssh'",
|
ngShow: "kind.value == 'ssh' || kind.value == 'scm'",
|
||||||
addRequired: false,
|
addRequired: false,
|
||||||
editRequired: false,
|
editRequired: false,
|
||||||
ngChange: "clearPWConfirm('ssh_key_unlock_confirm')",
|
ngChange: "clearPWConfirm('ssh_key_unlock_confirm')",
|
||||||
associated: 'ssh_key_unlock_confirm',
|
associated: 'ssh_key_unlock_confirm',
|
||||||
ask: true,
|
ask: true,
|
||||||
|
askShow: "kind.value == 'ssh'", //Only allow ask for machine credentials
|
||||||
clear: true
|
clear: true
|
||||||
},
|
},
|
||||||
"ssh_key_unlock_confirm": {
|
"ssh_key_unlock_confirm": {
|
||||||
label: 'Confirm Key Password',
|
label: 'Confirm Key Password',
|
||||||
type: 'password',
|
type: 'password',
|
||||||
ngShow: "kind.value == 'ssh'",
|
ngShow: "kind.value == 'ssh' || kind.value == 'scm'",
|
||||||
addRequired: false,
|
addRequired: false,
|
||||||
editRequired: false,
|
editRequired: false,
|
||||||
awPassMatch: true,
|
awPassMatch: true,
|
||||||
associated: 'ssh_key_unlock'
|
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": {
|
"sudo_username": {
|
||||||
label: 'Sudo Username',
|
label: 'Sudo Username',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
|
|||||||
@@ -134,9 +134,6 @@ angular.module('CredentialsHelper', ['Utilities'])
|
|||||||
data['username'] = scope['access_key'];
|
data['username'] = scope['access_key'];
|
||||||
data['password'] = scope['secret_key'];
|
data['password'] = scope['secret_key'];
|
||||||
break;
|
break;
|
||||||
case 'scm':
|
|
||||||
data['ssh_key_unlock'] = scope['scm_key_unlock'];
|
|
||||||
break;
|
|
||||||
case 'rax':
|
case 'rax':
|
||||||
data['password'] = scope['api_key'];
|
data['password'] = scope['api_key'];
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -525,7 +525,9 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies', 'Utilities'])
|
|||||||
html += " ><i class=\"icon-undo\"></i></button>\n";
|
html += " ><i class=\"icon-undo\"></i></button>\n";
|
||||||
html += "</span>\n</div>\n";
|
html += "</span>\n</div>\n";
|
||||||
if (field.ask) {
|
if (field.ask) {
|
||||||
html += "<label class=\"checkbox-inline ask-checkbox\">";
|
html += "<label class=\"checkbox-inline ask-checkbox\" ";
|
||||||
|
html += (field.askShow) ? "ng-show=\"" + field.askShow + "\" " : "";
|
||||||
|
html += ">";
|
||||||
html += "<input type=\"checkbox\" ng-model=\"" +
|
html += "<input type=\"checkbox\" ng-model=\"" +
|
||||||
fld + "_ask\" ng-change=\"ask('" + fld + "','" + field.associated + "')\" ";
|
fld + "_ask\" ng-change=\"ask('" + fld + "','" + field.associated + "')\" ";
|
||||||
html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" ";
|
html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" ";
|
||||||
|
|||||||
Reference in New Issue
Block a user