mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Remove unused _info/_type subflow env var magic values
This commit is contained in:
parent
7969dd431f
commit
1c94064c57
@ -47,38 +47,6 @@ function evaluateInputValue(value, type, node) {
|
|||||||
return redUtil.evaluateNodeProperty(value, type, node, null, null);
|
return redUtil.evaluateNodeProperty(value, type, node, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Compose information object for env var
|
|
||||||
*/
|
|
||||||
function composeInfo(info, val) {
|
|
||||||
var result = {
|
|
||||||
name: info.name,
|
|
||||||
type: info.type,
|
|
||||||
value: val,
|
|
||||||
};
|
|
||||||
if (info.ui) {
|
|
||||||
var ui = info.ui;
|
|
||||||
result.ui = {
|
|
||||||
hasUI: ui.hasUI,
|
|
||||||
icon: ui.icon,
|
|
||||||
labels: ui.labels,
|
|
||||||
type: ui.type
|
|
||||||
};
|
|
||||||
var retUI = result.ui;
|
|
||||||
if (ui.type === "input") {
|
|
||||||
retUI.inputTypes = ui.inputTypes;
|
|
||||||
}
|
|
||||||
if (ui.type === "select") {
|
|
||||||
retUI.menu = ui.menu;
|
|
||||||
}
|
|
||||||
if (ui.type === "spinner") {
|
|
||||||
retUI.spinner = ui.spinner;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents a subflow - which is handled as a special type of Flow
|
* This class represents a subflow - which is handled as a special type of Flow
|
||||||
*/
|
*/
|
||||||
@ -349,15 +317,8 @@ class Subflow extends Flow {
|
|||||||
getSetting(name) {
|
getSetting(name) {
|
||||||
if (!/^\$parent\./.test(name)) {
|
if (!/^\$parent\./.test(name)) {
|
||||||
var env = this.env;
|
var env = this.env;
|
||||||
var is_info = name.endsWith("_info");
|
if (env && env.hasOwnProperty(name)) {
|
||||||
var is_type = name.endsWith("_type");
|
var val = env[name];
|
||||||
var ename = (is_info || is_type) ? name.substring(0, name.length -5) : name; // 5 = length of "_info"/"_type"
|
|
||||||
|
|
||||||
if (env && env.hasOwnProperty(ename)) {
|
|
||||||
var val = env[ename];
|
|
||||||
if (is_type) {
|
|
||||||
return val ? val.type : undefined;
|
|
||||||
}
|
|
||||||
// If this is an env type property we need to be careful not
|
// If this is an env type property we need to be careful not
|
||||||
// to get into lookup loops.
|
// to get into lookup loops.
|
||||||
// 1. if the value to lookup is the same as this one, go straight to parent
|
// 1. if the value to lookup is the same as this one, go straight to parent
|
||||||
@ -371,11 +332,7 @@ class Subflow extends Flow {
|
|||||||
value = value.replace(new RegExp("\\${"+name+"}","g"),"${$parent."+name+"}");
|
value = value.replace(new RegExp("\\${"+name+"}","g"),"${$parent."+name+"}");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
var ret = evaluateInputValue(value, type, this.node);
|
return evaluateInputValue(value, type, this.node);
|
||||||
if (is_info) {
|
|
||||||
return composeInfo(val, ret);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
this.error(e);
|
this.error(e);
|
||||||
|
Loading…
Reference in New Issue
Block a user