mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 18:21:12 +03:00
Added the ability to pass in ngChange with the subCheckbox form object. Separated the checkbox's ngDisabled from the parent form element.
This commit is contained in:
parent
ff78082b67
commit
3dc59ae6db
@ -114,6 +114,7 @@ export default
|
||||
label: 'Secret Key',
|
||||
type: 'sensitive',
|
||||
ngShow: "kind.value == 'aws'",
|
||||
ngDisabled: "secret_key_ask",
|
||||
awRequiredWhen: {
|
||||
reqExpression: "aws_required",
|
||||
init: false
|
||||
@ -121,7 +122,8 @@ export default
|
||||
autocomplete: false,
|
||||
subCheckbox: {
|
||||
variable: 'secret_key_ask',
|
||||
text: 'Ask at runtime?'
|
||||
text: 'Ask at runtime?',
|
||||
ngChange: 'ask(\'secret_key\', \'undefined\')'
|
||||
},
|
||||
clear: false,
|
||||
hasShowInputButton: true,
|
||||
@ -231,11 +233,13 @@ export default
|
||||
label: 'Password',
|
||||
type: 'sensitive',
|
||||
ngShow: "kind.value == 'ssh'",
|
||||
ngDisabled: "ssh_password_ask",
|
||||
addRequired: false,
|
||||
editRequired: false,
|
||||
subCheckbox: {
|
||||
variable: 'ssh_password_ask',
|
||||
text: 'Ask at runtime?'
|
||||
text: 'Ask at runtime?',
|
||||
ngChange: 'ask(\'ssh_password\', \'undefined\')'
|
||||
},
|
||||
hasShowInputButton: true,
|
||||
autocomplete: false,
|
||||
@ -269,11 +273,13 @@ export default
|
||||
ngShow: "kind.value == 'ssh' || kind.value == 'scm'",
|
||||
addRequired: false,
|
||||
editRequired: false,
|
||||
ngDisabled: "keyEntered === false",
|
||||
ngDisabled: "keyEntered === false || ssh_key_unlock_ask",
|
||||
subCheckbox: {
|
||||
variable: 'ssh_key_unlock_ask',
|
||||
ngShow: "kind.value == 'ssh'",
|
||||
text: 'Ask at runtime?'
|
||||
text: 'Ask at runtime?',
|
||||
ngChange: 'ask(\'ssh_key_unlock\', \'undefined\')',
|
||||
ngDisabled: "keyEntered === false"
|
||||
},
|
||||
hasShowInputButton: true,
|
||||
subForm: 'credentialSubForm'
|
||||
@ -305,11 +311,13 @@ export default
|
||||
labelBind: 'becomePasswordLabel',
|
||||
type: 'sensitive',
|
||||
ngShow: "(kind.value == 'ssh' && (become_method && become_method.value)) ",
|
||||
ngDisabled: "become_password_ask",
|
||||
addRequired: false,
|
||||
editRequired: false,
|
||||
subCheckbox: {
|
||||
variable: 'become_password_ask',
|
||||
text: 'Ask at runtime?'
|
||||
text: 'Ask at runtime?',
|
||||
ngChange: 'ask(\'become_password\', \'undefined\')'
|
||||
},
|
||||
hasShowInputButton: true,
|
||||
autocomplete: false,
|
||||
@ -399,11 +407,13 @@ export default
|
||||
label: "Vault Password",
|
||||
type: 'sensitive',
|
||||
ngShow: "kind.value == 'ssh'",
|
||||
ngDisabled: "vault_password_ask",
|
||||
addRequired: false,
|
||||
editRequired: false,
|
||||
subCheckbox: {
|
||||
variable: 'vault_password_ask',
|
||||
text: 'Ask at runtime?'
|
||||
text: 'Ask at runtime?',
|
||||
ngChange: 'ask(\'vault_password\', \'undefined\')'
|
||||
},
|
||||
hasShowInputButton: true,
|
||||
autocomplete: false,
|
||||
|
@ -786,7 +786,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += (field.awPassMatch) ? "awpassmatch=\"" + field.associated + "\" " : "";
|
||||
html += (field.capitalize) ? "capitalize " : "";
|
||||
html += (field.awSurveyQuestion) ? "aw-survey-question" : "" ;
|
||||
html += (field.subCheckbox) ? "ng-disabled=\"" + field.subCheckbox.variable + "\" " : "";
|
||||
html += (field.ngDisabled) ? "ng-disabled=\"" + field.ngDisabled + "\" " : "";
|
||||
html += (field.autocomplete !== undefined) ? this.attr(field, 'autocomplete') : "";
|
||||
if(field.awRequiredWhen) {
|
||||
html += field.awRequiredWhen.init ? "data-awrequired-init=\"" + field.awRequiredWhen.init + "\" " : "";
|
||||
@ -794,7 +794,6 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += field.awRequiredWhen.alwaysShowAsterisk ? "data-awrequired-always-show-asterisk=true " : "";
|
||||
}
|
||||
html += (field.awValidUrl) ? "aw-valid-url " : "";
|
||||
html += (field.associated && this.form.fields[field.associated].subCheckbox) ? "ng-disabled=\"" + this.form.fields[field.associated].subCheckbox.variable + "\" " : "";
|
||||
html += ">\n";
|
||||
}
|
||||
|
||||
@ -803,7 +802,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += "id=\"" + this.form.name + "_" + fld + "_clear_btn\" ";
|
||||
html += "class=\"btn btn-default\" ng-click=\"clear('" + fld + "','" + field.associated + "')\" " +
|
||||
"aw-tool-tip=\"Clear " + field.label + "\" id=\"" + fld + "-clear-btn\" ";
|
||||
html += (field.subCheckbox) ? "ng-disabled=\"" + field.subCheckbox.variable + "\" " : "";
|
||||
html += (field.ngDisabled) ? "ng-disabled=\"" + field.ngDisabled + "\" " : "";
|
||||
html += " ><i class=\"fa fa-undo\"></i></button>\n";
|
||||
html += "</span>\n</div>\n";
|
||||
}
|
||||
@ -818,8 +817,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += "<label class=\"checkbox-inline Form-subCheckbox\" ";
|
||||
html += (field.subCheckbox.ngShow) ? "ng-show=\"" + field.subCheckbox.ngShow + "\" " : "";
|
||||
html += ">";
|
||||
html += "<input type=\"checkbox\" ng-model=\"" +
|
||||
field.subCheckbox.variable + "\" ng-change=\"ask('" + fld + "','" + field.associated + "')\" ";
|
||||
html += "<input type=\"checkbox\" ng-model=\"" + field.subCheckbox.variable + "\" ";
|
||||
html += (field.subCheckbox.ngChange) ? "ng-change=\"" + field.subCheckbox.ngChange + "\" " : "";
|
||||
html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" ";
|
||||
html += ">";
|
||||
html += field.subCheckbox.text ? field.subCheckbox.text : "";
|
||||
@ -881,19 +880,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += buildId(field, fld + "_show_input_button", this.form);
|
||||
html += "aw-tool-tip='Toggle the display of plaintext.' aw-tip-placement='top' ";
|
||||
html += "ng-click='" + fld + "_field.toggleInput(\"#" + this.form.name + "_" + fld + "\")'";
|
||||
if (field.ngDisabled || field.subCheckbox) {
|
||||
var disabled = "";
|
||||
if (field.ngDisabled) {
|
||||
disabled += field.ngDisabled;
|
||||
}
|
||||
if (field.ngDisabled && field.subCheckbox) {
|
||||
disabled += " || ";
|
||||
}
|
||||
if (field.subCheckbox) {
|
||||
disabled += field.subCheckbox.variable;
|
||||
}
|
||||
html += "ng-disabled='" + disabled + "'";
|
||||
}
|
||||
html += (field.ngDisabled) ? "ng-disabled='" + field.ngDisabled + "'" : "";
|
||||
html += ">\n" + field.showInputInnerHTML;
|
||||
html += "\n</button>\n";
|
||||
html += "</span>\n";
|
||||
@ -928,19 +915,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += (field.capitalize) ? "capitalize " : "";
|
||||
html += (field.awSurveyQuestion) ? "aw-survey-question" : "";
|
||||
|
||||
if (field.ngDisabled || field.subCheckbox) {
|
||||
var _disabled = "";
|
||||
if (field.ngDisabled) {
|
||||
_disabled += field.ngDisabled;
|
||||
}
|
||||
if (field.ngDisabled && field.subCheckbox) {
|
||||
_disabled += " || ";
|
||||
}
|
||||
if (field.subCheckbox) {
|
||||
_disabled += field.subCheckbox.variable;
|
||||
}
|
||||
html += "ng-disabled='" + _disabled + "'";
|
||||
}
|
||||
html += (field.ngDisabled) ? "ng-disabled='" + field.ngDisabled + "'" : "";
|
||||
|
||||
html += (field.autocomplete !== undefined) ? this.attr(field, 'autocomplete') : "";
|
||||
if(field.awRequiredWhen) {
|
||||
html += field.awRequiredWhen.init ? "data-awrequired-init=\"" + field.awRequiredWhen.init + "\" " : "";
|
||||
@ -948,7 +924,6 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += field.awRequiredWhen.alwaysShowAsterisk ? "data-awrequired-always-show-asterisk=true " : "";
|
||||
}
|
||||
html += (field.awValidUrl) ? "aw-valid-url " : "";
|
||||
html += (field.associated && this.form.fields[field.associated].ask) ? "ng-disabled='" + field.associated + "_foo' " : "";
|
||||
html += ">\n";
|
||||
}
|
||||
|
||||
@ -959,10 +934,11 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += (field.subCheckbox.ngShow) ? "ng-show=\"" + field.subCheckbox.ngShow + "\" " : "";
|
||||
html += ">";
|
||||
html += "<input type=\"checkbox\" ng-model=\"" +
|
||||
field.subCheckbox.variable + "\" ng-change=\"ask('" + fld + "','" + field.associated + "')\" ";
|
||||
field.subCheckbox.variable + "\" ";
|
||||
html += (field.subCheckbox.ngChange) ? "ng-change=\"" + field.subCheckbox.ngChange + "\" " : "";
|
||||
html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" ";
|
||||
if (field.ngDisabled) {
|
||||
html += "ng-disabled='" + field.ngDisabled + "'";
|
||||
if (field.subCheckbox.ngDisabled) {
|
||||
html += "ng-disabled='" + field.subCheckbox.ngDisabled + "'";
|
||||
}
|
||||
html += ">";
|
||||
html += field.subCheckbox.text ? field.subCheckbox.text : "";
|
||||
@ -1053,8 +1029,12 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += (field.subCheckbox.ngShow) ? "ng-show=\"" + field.subCheckbox.ngShow + "\" " : "";
|
||||
html += ">";
|
||||
html += "<input type=\"checkbox\" ng-model=\"" +
|
||||
field.subCheckbox.variable + "\" ng-change=\"ask('" + fld + "','" + field.associated + "')\" ";
|
||||
field.subCheckbox.variable + "\" ";
|
||||
html += (field.subCheckbox.ngChange) ? "ng-change=\"" + field.subCheckbox.ngChange + "\" " : "";
|
||||
html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" ";
|
||||
if (field.subCheckbox.ngDisabled) {
|
||||
html += "ng-disabled='" + field.subCheckbox.ngDisabled + "'";
|
||||
}
|
||||
html += ">";
|
||||
html += field.subCheckbox.text ? field.subCheckbox.text : "";
|
||||
html += "</label>";
|
||||
@ -1115,8 +1095,12 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += (field.subCheckbox.ngShow) ? "ng-show=\"" + field.subCheckbox.ngShow + "\" " : "";
|
||||
html += ">";
|
||||
html += "<input type=\"checkbox\" ng-model=\"" +
|
||||
field.subCheckbox.variable + "\" ng-change=\"ask('" + fld + "','" + field.associated + "')\" ";
|
||||
field.subCheckbox.variable + "\" ";
|
||||
html += (field.subCheckbox.ngChange) ? "ng-change=\"" + field.subCheckbox.ngChange + "\" " : "";
|
||||
html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" ";
|
||||
if (field.subCheckbox.ngDisabled) {
|
||||
html += "ng-disabled='" + field.subCheckbox.ngDisabled + "'";
|
||||
}
|
||||
html += ">";
|
||||
html += field.subCheckbox.text ? field.subCheckbox.text : "";
|
||||
html += "</label>";
|
||||
@ -1179,7 +1163,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += (field.subCheckbox.ngShow) ? "ng-show=\"" + field.subCheckbox.ngShow + "\" " : "";
|
||||
html += ">";
|
||||
html += "<input type=\"checkbox\" ng-model=\"" +
|
||||
field.subCheckbox.variable + "\" ng-change=\"ask('" + fld + "','" + field.associated + "')\" ";
|
||||
field.subCheckbox.variable + "\" ";
|
||||
html += (field.subCheckbox.ngChange) ? "ng-change=\"" + field.subCheckbox.ngChange + "\" " : "";
|
||||
html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" ";
|
||||
html += ">";
|
||||
html += field.subCheckbox.text ? field.subCheckbox.text : "";
|
||||
@ -1381,7 +1366,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += (field.subCheckbox.ngShow) ? "ng-show=\"" + field.subCheckbox.ngShow + "\" " : "";
|
||||
html += ">";
|
||||
html += "<input type=\"checkbox\" ng-model=\"" +
|
||||
field.subCheckbox.variable + "\" ng-change=\"ask('" + fld + "','" + field.associated + "')\" ";
|
||||
field.subCheckbox.variable + "\" ";
|
||||
html += (field.subCheckbox.ngChange) ? "ng-change=\"" + field.subCheckbox.ngChange + "\" " : "";
|
||||
html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" ";
|
||||
html += ">";
|
||||
html += field.subCheckbox.text ? field.subCheckbox.text : "";
|
||||
|
Loading…
Reference in New Issue
Block a user