From ac0ca083c0022af7677c8b88ca85a62eafe26aed Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 19 Mar 2015 22:56:59 +0000 Subject: [PATCH] Import of subflow loses certain internal wires Wires between subflow inputs and outputs are getting lost when JSON is imported. --- public/red/nodes.js | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/public/red/nodes.js b/public/red/nodes.js index 7d898e964..a54caa295 100644 --- a/public/red/nodes.js +++ b/public/red/nodes.js @@ -236,12 +236,6 @@ RED.nodes = (function() { } } - function refreshValidation() { - for (var n=0;n 0) { @@ -764,10 +751,10 @@ RED.nodes = (function() { n.out.forEach(function(output) { output.wires.forEach(function(wire) { var link; - if (wire.id == n.id) { + if (subflow_map[wire.id] && subflow_map[wire.id].id == n.id) { link = {source:n.in[wire.port], sourcePort:wire.port,target:output}; } else { - link = {source:node_map[wire.id], sourcePort:wire.port,target:output}; + link = {source:node_map[wire.id]||subflow_map[wire.id], sourcePort:wire.port,target:output}; } addLink(link); new_links.push(link); @@ -779,7 +766,7 @@ RED.nodes = (function() { return [new_nodes,new_links,new_workspaces,new_subflows]; } - // TODO: only supports filter.z + // TODO: supports filter.z|type function filterNodes(filter) { var result = []; @@ -788,6 +775,9 @@ RED.nodes = (function() { if (filter.z && node.z !== filter.z) { continue; } + if (filter.type && node.type !== filter.type) { + continue; + } result.push(node); } return result; @@ -903,7 +893,7 @@ RED.nodes = (function() { filterLinks: filterLinks, import: importNodes, - refreshValidation: refreshValidation, + getAllFlowNodes: getAllFlowNodes, createExportableNodeSet: createExportableNodeSet, createCompleteNodeSet: createCompleteNodeSet,