mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Solved node red not loading without error when subflow is missing
This commit is contained in:
parent
e5d579c1bb
commit
6fbcec8b98
@ -2095,6 +2095,16 @@ RED.nodes = (function() {
|
|||||||
} else if (n.type.substring(0,7) === "subflow") {
|
} else if (n.type.substring(0,7) === "subflow") {
|
||||||
var parentId = n.type.split(":")[1];
|
var parentId = n.type.split(":")[1];
|
||||||
var subflow = subflow_denylist[parentId]||subflow_map[parentId]||getSubflow(parentId);
|
var subflow = subflow_denylist[parentId]||subflow_map[parentId]||getSubflow(parentId);
|
||||||
|
if (!subflow){
|
||||||
|
node._def = {
|
||||||
|
color:"#fee",
|
||||||
|
defaults: {},
|
||||||
|
label: "unknown: "+n.type,
|
||||||
|
labelStyle: "red-ui-flow-node-label-italic",
|
||||||
|
outputs: n.outputs|| (n.wires && n.wires.length) || 0,
|
||||||
|
set: registry.getNodeSet("node-red/unknown")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (createNewIds || options.importMap[n.id] === "copy") {
|
if (createNewIds || options.importMap[n.id] === "copy") {
|
||||||
parentId = subflow.id;
|
parentId = subflow.id;
|
||||||
node.type = "subflow:"+parentId;
|
node.type = "subflow:"+parentId;
|
||||||
@ -2105,6 +2115,7 @@ RED.nodes = (function() {
|
|||||||
node.outputs = subflow.out.length;
|
node.outputs = subflow.out.length;
|
||||||
node.inputs = subflow.in.length;
|
node.inputs = subflow.in.length;
|
||||||
node.env = n.env;
|
node.env = n.env;
|
||||||
|
}
|
||||||
} else if (n.type === 'junction') {
|
} else if (n.type === 'junction') {
|
||||||
node._def = {defaults:{}}
|
node._def = {defaults:{}}
|
||||||
node._config.x = node.x
|
node._config.x = node.x
|
||||||
|
@ -45,12 +45,14 @@ RED.editor = (function() {
|
|||||||
var hasChanged;
|
var hasChanged;
|
||||||
if (node.type.indexOf("subflow:")===0) {
|
if (node.type.indexOf("subflow:")===0) {
|
||||||
subflow = RED.nodes.subflow(node.type.substring(8));
|
subflow = RED.nodes.subflow(node.type.substring(8));
|
||||||
|
if (subflow){
|
||||||
isValid = subflow.valid;
|
isValid = subflow.valid;
|
||||||
hasChanged = subflow.changed;
|
hasChanged = subflow.changed;
|
||||||
if (isValid === undefined) {
|
if (isValid === undefined) {
|
||||||
isValid = validateNode(subflow);
|
isValid = validateNode(subflow);
|
||||||
hasChanged = subflow.changed;
|
hasChanged = subflow.changed;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
validationErrors = validateNodeProperties(node, node._def.defaults, node);
|
validationErrors = validateNodeProperties(node, node._def.defaults, node);
|
||||||
node.valid = isValid && validationErrors.length === 0;
|
node.valid = isValid && validationErrors.length === 0;
|
||||||
node.changed = node.changed || hasChanged;
|
node.changed = node.changed || hasChanged;
|
||||||
|
@ -199,7 +199,7 @@ function parseConfig(config) {
|
|||||||
if (subflowDetails) {
|
if (subflowDetails) {
|
||||||
var subflowType = subflowDetails[1]
|
var subflowType = subflowDetails[1]
|
||||||
n.subflow = subflowType;
|
n.subflow = subflowType;
|
||||||
flow.subflows[subflowType].instances.push(n)
|
if (flow.subflows[subflowType]) flow.subflows[subflowType].instances.push(n)
|
||||||
}
|
}
|
||||||
if (container) {
|
if (container) {
|
||||||
container.nodes[n.id] = n;
|
container.nodes[n.id] = n;
|
||||||
|
Loading…
Reference in New Issue
Block a user