mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
simplified meta-data
This commit is contained in:
@@ -224,33 +224,18 @@ class Subflow extends Flow {
|
||||
return null;
|
||||
}
|
||||
function lookupFlow(flow, name) {
|
||||
var prefix = name.substring(0, name.length -5); // len("_{type,info}")==5
|
||||
if (name.endsWith("_type")) {
|
||||
var val = lookupFlow0(flow, prefix);
|
||||
if (val) {
|
||||
return val.type;
|
||||
}
|
||||
}
|
||||
else if (name.endsWith("_info")) {
|
||||
var val = lookupFlow0(flow, prefix);
|
||||
if (val) {
|
||||
return val.info;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var val = lookupFlow0(flow, name);
|
||||
if (val) {
|
||||
if ((typeof val === "str) && (val.type" !== "str")) {
|
||||
try {
|
||||
return redUtil.evaluateNodeProperty(val.value, val.type, null, null, null);
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
return undefined;
|
||||
}
|
||||
var val = lookupFlow0(flow, name);
|
||||
if (val) {
|
||||
if ((typeof val === "str) && (val.type" !== "str")) {
|
||||
try {
|
||||
return redUtil.evaluateNodeProperty(val.value, val.type, null, null, null);
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
return undefined;
|
||||
}
|
||||
return val.value;
|
||||
}
|
||||
return val.value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -273,21 +258,6 @@ class Subflow extends Flow {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set environment variable of subflow
|
||||
* @param {String} name name of env var
|
||||
* @param {Object} val value of env var
|
||||
*/
|
||||
setSetting(name, val) {
|
||||
var node = this.node;
|
||||
if (node) {
|
||||
var env = node.env;
|
||||
if (env) {
|
||||
env[name] = { name: name, type: "str", value: val, info: null };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a status event from a node within this flow.
|
||||
* @param {Node} node The original node that triggered the event
|
||||
|
Reference in New Issue
Block a user