From 995268c5df3454c14fd216d76c18ab2fe40b51e2 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 8 Sep 2014 10:53:18 +0100 Subject: [PATCH] Handle node imports containing tab nodes Closes #172 --- public/red/nodes.js | 17 +++++++- public/red/ui/view.js | 98 ++++++++++++++++++++++--------------------- 2 files changed, 66 insertions(+), 49 deletions(-) diff --git a/public/red/nodes.js b/public/red/nodes.js index 3ef208006..bd0728348 100644 --- a/public/red/nodes.js +++ b/public/red/nodes.js @@ -309,6 +309,9 @@ RED.nodes = (function() { //"DO NOT DEPLOY while in this state.
Either, add missing types to Node-RED, restart and then reload page,
or delete unknown "+n.name+", rewire as required, and then deploy.","error"); } + var new_workspaces = []; + var workspace_map = {}; + for (i=0;iError: "+error,"error"); diff --git a/public/red/ui/view.js b/public/red/ui/view.js index 369b51ba0..73981fd6e 100644 --- a/public/red/ui/view.js +++ b/public/red/ui/view.js @@ -1397,61 +1397,65 @@ RED.view = (function() { if (result) { var new_nodes = result[0]; var new_links = result[1]; - var new_ms = new_nodes.map(function(n) { n.z = activeWorkspace; return {n:n};}); - var new_node_ids = new_nodes.map(function(n){ return n.id; }); - - // TODO: pick a more sensible root node - var root_node = new_ms[0].n; - var dx = root_node.x; - var dy = root_node.y; - - if (mouse_position == null) { - mouse_position = [0,0]; - } - - var minX = 0; - var minY = 0; - var i; - var node; + var new_workspaces = result[2]; - for (i=0;i 0) { + var root_node = new_ms[0].n; + var dx = root_node.x; + var dy = root_node.y; + + if (mouse_position == null) { + mouse_position = [0,0]; + } + + var minX = 0; + var minY = 0; + var i; + var node; + + for (i=0;iError: "+error,"error"); } }