From a59da9115e74af952fc89b9a9b89f95e86458fd8 Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Fri, 20 Jan 2017 14:33:42 -0500 Subject: [PATCH] allow overriding chkbox ngDisable inheritance Allow checkbox associated with form textbox to override the enherited ngDisabled condition set on the associated "parent" form textbox. This allows "Ask at Runtime?" checkboxes to be unchecked. Note: I did not expand this feature to anything outside the scope of fixing this problem. i.e. only password textbox fields. related to #4857 --- awx/ui/client/src/forms/Credentials.js | 9 ++++++--- awx/ui/client/src/shared/form-generator.js | 5 +++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/awx/ui/client/src/forms/Credentials.js b/awx/ui/client/src/forms/Credentials.js index 247981e18b..50ef0f3080 100644 --- a/awx/ui/client/src/forms/Credentials.js +++ b/awx/ui/client/src/forms/Credentials.js @@ -231,7 +231,8 @@ export default subCheckbox: { variable: 'ssh_password_ask', text: i18n._('Ask at runtime?'), - ngChange: 'ask(\'ssh_password\', \'undefined\')' + ngChange: 'ask(\'ssh_password\', \'undefined\')', + ngDisabled: false, }, hasShowInputButton: true, autocomplete: false, @@ -309,7 +310,8 @@ export default subCheckbox: { variable: 'become_password_ask', text: i18n._('Ask at runtime?'), - ngChange: 'ask(\'become_password\', \'undefined\')' + ngChange: 'ask(\'become_password\', \'undefined\')', + ngDisabled: false, }, hasShowInputButton: true, autocomplete: false, @@ -394,7 +396,8 @@ export default subCheckbox: { variable: 'vault_password_ask', text: i18n._('Ask at runtime?'), - ngChange: 'ask(\'vault_password\', \'undefined\')' + ngChange: 'ask(\'vault_password\', \'undefined\')', + ngDisabled: false, }, hasShowInputButton: true, autocomplete: false, diff --git a/awx/ui/client/src/shared/form-generator.js b/awx/ui/client/src/shared/form-generator.js index 1f4b418799..0918fa514f 100644 --- a/awx/ui/client/src/shared/form-generator.js +++ b/awx/ui/client/src/shared/form-generator.js @@ -914,10 +914,11 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat field.subCheckbox.variable + "\" "; html += (field.subCheckbox.ngChange) ? "ng-change=\"" + field.subCheckbox.ngChange + "\" " : ""; html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" "; - if (field.subCheckbox.ngDisabled) { + if (field.subCheckbox.ngDisabled !== undefined) { html += "ng-disabled='" + field.subCheckbox.ngDisabled + "'"; + } else { + html += (field.ngDisabled) ? "ng-disabled=\"" + field.ngDisabled + "\" " : ""; } - html += (field.ngDisabled) ? "ng-disabled=\"" + field.ngDisabled + "\" " : ""; html += ">"; html += field.subCheckbox.text ? field.subCheckbox.text : ""; html += "";