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