mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Import of subflow loses certain internal wires
Wires between subflow inputs and outputs are getting lost when JSON is imported.
This commit is contained in:
parent
9afb4a9315
commit
ac0ca083c0
@ -236,12 +236,6 @@ RED.nodes = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshValidation() {
|
|
||||||
for (var n=0;n<nodes.length;n++) {
|
|
||||||
RED.editor.validateNode(nodes[n]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function addWorkspace(ws) {
|
function addWorkspace(ws) {
|
||||||
workspaces[ws.id] = ws;
|
workspaces[ws.id] = ws;
|
||||||
}
|
}
|
||||||
@ -535,18 +529,11 @@ RED.nodes = (function() {
|
|||||||
n.type != "tab" &&
|
n.type != "tab" &&
|
||||||
n.type != "subflow" &&
|
n.type != "subflow" &&
|
||||||
!registry.getNodeType(n.type) &&
|
!registry.getNodeType(n.type) &&
|
||||||
n.type.substring(0,8) != "subflow:") {
|
n.type.substring(0,8) != "subflow:" &&
|
||||||
// TODO: get this UI thing out of here! (see below as well)
|
unknownTypes.indexOf(n.type)==-1) {
|
||||||
|
|
||||||
if (unknownTypes.indexOf(n.type)==-1) {
|
|
||||||
unknownTypes.push(n.type);
|
unknownTypes.push(n.type);
|
||||||
}
|
}
|
||||||
//if (n.x == null && n.y == null) {
|
|
||||||
// // config node - remove it
|
|
||||||
// newNodes.splice(i,1);
|
|
||||||
// i--;
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (unknownTypes.length > 0) {
|
if (unknownTypes.length > 0) {
|
||||||
var typeList = "<ul><li>"+unknownTypes.join("</li><li>")+"</li></ul>";
|
var typeList = "<ul><li>"+unknownTypes.join("</li><li>")+"</li></ul>";
|
||||||
@ -764,10 +751,10 @@ RED.nodes = (function() {
|
|||||||
n.out.forEach(function(output) {
|
n.out.forEach(function(output) {
|
||||||
output.wires.forEach(function(wire) {
|
output.wires.forEach(function(wire) {
|
||||||
var link;
|
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};
|
link = {source:n.in[wire.port], sourcePort:wire.port,target:output};
|
||||||
} else {
|
} 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);
|
addLink(link);
|
||||||
new_links.push(link);
|
new_links.push(link);
|
||||||
@ -779,7 +766,7 @@ RED.nodes = (function() {
|
|||||||
return [new_nodes,new_links,new_workspaces,new_subflows];
|
return [new_nodes,new_links,new_workspaces,new_subflows];
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: only supports filter.z
|
// TODO: supports filter.z|type
|
||||||
function filterNodes(filter) {
|
function filterNodes(filter) {
|
||||||
var result = [];
|
var result = [];
|
||||||
|
|
||||||
@ -788,6 +775,9 @@ RED.nodes = (function() {
|
|||||||
if (filter.z && node.z !== filter.z) {
|
if (filter.z && node.z !== filter.z) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (filter.type && node.type !== filter.type) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
result.push(node);
|
result.push(node);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -903,7 +893,7 @@ RED.nodes = (function() {
|
|||||||
filterLinks: filterLinks,
|
filterLinks: filterLinks,
|
||||||
|
|
||||||
import: importNodes,
|
import: importNodes,
|
||||||
refreshValidation: refreshValidation,
|
|
||||||
getAllFlowNodes: getAllFlowNodes,
|
getAllFlowNodes: getAllFlowNodes,
|
||||||
createExportableNodeSet: createExportableNodeSet,
|
createExportableNodeSet: createExportableNodeSet,
|
||||||
createCompleteNodeSet: createCompleteNodeSet,
|
createCompleteNodeSet: createCompleteNodeSet,
|
||||||
|
Loading…
Reference in New Issue
Block a user