diff --git a/public/icons/subflow.png b/public/icons/subflow.png new file mode 100644 index 000000000..7c1c14f38 Binary files /dev/null and b/public/icons/subflow.png differ diff --git a/public/index.html b/public/index.html index f8f6e0d4d..355146ff0 100644 --- a/public/index.html +++ b/public/index.html @@ -51,11 +51,7 @@
-
- - - -
+ edit subflow properties
@@ -81,6 +77,20 @@
+
+
+
+ +
+
+ +
+
+ +
+
+
+
@@ -199,7 +209,6 @@
- + + diff --git a/public/red/history.js b/public/red/history.js index 3a6d55133..c1d3808f5 100644 --- a/public/red/history.js +++ b/public/red/history.js @@ -50,6 +50,12 @@ RED.history = (function() { RED.view.removeWorkspace(ev.workspaces[i]); } } + if (ev.subflows) { + for (i=0;i ev.subflow.inputCount) { + ev.node.in.splice(ev.subflow.inputCount); + } else if (ev.subflow.inputs.length > 0) { + ev.node.in = ev.node.in.concat(ev.subflow.inputs); + } + if (ev.node.out.length > ev.subflow.outputCount) { + ev.node.out.splice(ev.subflow.outputCount); + } else if (ev.subflow.outputs.length > 0) { + ev.node.out = ev.node.out.concat(ev.subflow.outputs); + } + RED.nodes.eachNode(function(n) { + if (n.type == "subflow:"+ev.node.id) { + n.changed = ev.changed; + n.inputs = ev.node.in.length; + n.outputs = ev.node.out.length; + RED.editor.updateNodeProperties(n); + } + }); + + + + RED.palette.refresh(); + } else { + RED.editor.updateNodeProperties(ev.node); + RED.editor.validateNode(ev.node); + } if (ev.links) { for (i=0;iEither, add missing types to Node-RED, restart and then reload page,
or delete unknown "+n.name+", rewire as required, and then deploy.","error"); } + var activeWorkspace = RED.view.getWorkspace(); + var activeSubflow = getSubflow(activeWorkspace); + if (activeSubflow) { + for (i=0;iError: "+error,"error"); + if (error.code != "NODE_RED") { + console.log(error.stack); + RED.notify("Error: "+error,"error"); + } else { + RED.notify("Error: "+error.message,"error"); + } return null; } @@ -516,13 +741,22 @@ RED.nodes = (function() { registerType: registry.registerNodeType, getType: registry.getNodeType, convertNode: convertNode, + add: addNode, - addLink: addLink, remove: removeNode, + + addLink: addLink, removeLink: removeLink, + addWorkspace: addWorkspace, removeWorkspace: removeWorkspace, workspace: getWorkspace, + + addSubflow: addSubflow, + removeSubflow: removeSubflow, + subflow: getSubflow, + subflowContains: subflowContains, + eachNode: function(cb) { for (var n=0;n= node.outputs) { + removedLinks.push(l); + } + }); + } else if (node.outputs > node.ports.length) { + while (node.outputs > node.ports.length) { + node.ports.push(node.ports.length); + } } + } + if (node.inputs === 0) { RED.nodes.eachLink(function(l) { - if (l.source === node && l.sourcePort >= node.outputs) { - removedLinks.push(l); - } + if (l.target === node) { + removedLinks.push(l); + } }); - for (var l=0;l node.ports.length) { - while (node.outputs > node.ports.length) { - node.ports.push(node.ports.length); - } + } + for (var l=0;l