1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix up dynamic generation of switch ui

This commit is contained in:
Nick O'Leary 2019-08-21 12:39:51 +01:00
parent 0d680a58f3
commit 8307f26099
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -251,6 +251,7 @@
var numValueField = null; var numValueField = null;
var expValueField = null; var expValueField = null;
var btwnAndLabel = null; var btwnAndLabel = null;
var btwnValueField = null;
var btwnValue2Field = null; var btwnValue2Field = null;
var typeValueField = null; var typeValueField = null;
@ -259,9 +260,7 @@
var caseSensitive = $('<input/>',{id:"node-input-rule-case-"+i,class:"node-input-rule-case",type:"checkbox",style:"width:auto;vertical-align:top"}).appendTo(row2); var caseSensitive = $('<input/>',{id:"node-input-rule-case-"+i,class:"node-input-rule-case",type:"checkbox",style:"width:auto;vertical-align:top"}).appendTo(row2);
$('<label/>',{for:"node-input-rule-case-"+i,style:"margin-left: 3px;"}).text(caseLabel).appendTo(row2); $('<label/>',{for:"node-input-rule-case-"+i,style:"margin-left: 3px;"}).text(caseLabel).appendTo(row2);
selectField.change(function() { selectField.change(function() {
resizeRule(container);
var type = selectField.val(); var type = selectField.val();
if (valueField){ if (valueField){
valueField.typedInput('hide'); valueField.typedInput('hide');
} }
@ -274,6 +273,9 @@
if (typeValueField){ if (typeValueField){
typeValueField.typedInput('hide'); typeValueField.typedInput('hide');
} }
if (btwnValueField){
btwnValueField.typedInput('hide');
}
if (btwnValue2Field){ if (btwnValue2Field){
btwnValue2Field.typedInput('hide'); btwnValue2Field.typedInput('hide');
} }
@ -293,19 +295,16 @@
expValueField = createExpValueField(); expValueField = createExpValueField();
} }
expValueField.typedInput('show'); expValueField.typedInput('show');
} else { } else if (type === "istype") {
if (type === "istype") { if (!typeValueField){
if (!typeValueField){ typeValueField = createTypeValueField();
typeValueField = createTypeValueField();
}
typeValueField.typedInput('show');
} }
else { typeValueField.typedInput('show');
} else if (! (type === "true" || type === "false" || type === "null" || type === "nnull" || type === "empty" || type === "nempty" || type === "else" )) {
if (!valueField){ if (!valueField){
valueField = createValueField(); valueField = createValueField();
} }
valueField.typedInput('show'); valueField.typedInput('show');
}
} }
if (type === "regex") { if (type === "regex") {
row2.show(); row2.show();
@ -321,6 +320,8 @@
row2.hide(); row2.hide();
row3.hide(); row3.hide();
} }
resizeRule(container);
}); });
selectField.val(rule.t); selectField.val(rule.t);
if ((rule.t == "btwn") || (rule.t == "index")) { if ((rule.t == "btwn") || (rule.t == "index")) {