mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 19:51:08 -03:30
add autopopulation parameter to lookupinit
This commit is contained in:
@@ -38,9 +38,16 @@ export default
|
|||||||
instructions = params.instructions,
|
instructions = params.instructions,
|
||||||
postAction = params.postAction,
|
postAction = params.postAction,
|
||||||
callback = params.callback,
|
callback = params.callback,
|
||||||
|
autopopulateLookup,
|
||||||
input_type = (params.input_type) ? params.input_type: "checkbox",
|
input_type = (params.input_type) ? params.input_type: "checkbox",
|
||||||
defaultUrl, name, watchUrl;
|
defaultUrl, name, watchUrl;
|
||||||
|
|
||||||
|
if (params.autopopulateLookup !== undefined) {
|
||||||
|
autopopulateLookup = params.autopopulateLookup;
|
||||||
|
} else {
|
||||||
|
autopopulateLookup = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (params.url) {
|
if (params.url) {
|
||||||
// pass in a url value to override the default
|
// pass in a url value to override the default
|
||||||
defaultUrl = params.url;
|
defaultUrl = params.url;
|
||||||
@@ -67,8 +74,11 @@ export default
|
|||||||
sourceField = form.fields[field].sourceField;
|
sourceField = form.fields[field].sourceField;
|
||||||
|
|
||||||
// this logic makes sure that the form is being added, and that the lookup to be autopopulated is required
|
// this logic makes sure that the form is being added, and that the lookup to be autopopulated is required
|
||||||
|
// we also look to see if the lookupinit autopopulateLookup parameter passed in by the controller is false
|
||||||
function fieldIsAutopopulatable() {
|
function fieldIsAutopopulatable() {
|
||||||
if (parent_scope.mode === "add") {
|
if (autopopulateLookup === false) {
|
||||||
|
return false;
|
||||||
|
} if (parent_scope.mode === "add") {
|
||||||
if (parent_scope[sourceModel + "_field"].awRequiredWhen &&
|
if (parent_scope[sourceModel + "_field"].awRequiredWhen &&
|
||||||
parent_scope[sourceModel + "_field"].awRequiredWhen.variable &&
|
parent_scope[sourceModel + "_field"].awRequiredWhen.variable &&
|
||||||
parent_scope[parent_scope[sourceModel + "_field"].awRequiredWhen.variable]) {
|
parent_scope[parent_scope[sourceModel + "_field"].awRequiredWhen.variable]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user