1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Partial deploy containing deleted subflow throws error

This commit is contained in:
Nick O'Leary 2015-05-05 13:52:55 +01:00
parent 56e8c143dd
commit 7112fd2a22

View File

@ -537,6 +537,7 @@ function diffFlow(flow,config) {
var flowNodes = {};
var changedNodes = {};
var deletedNodes = {};
var deletedSubflows = {};
var deletedTabs = {};
var linkChangedNodes = {};
@ -591,10 +592,12 @@ function diffFlow(flow,config) {
flow.config.forEach(function(node) {
if (!flowNodes[node.id]) {
if (node.type != "tab") {
deletedNodes[node.id] = node;
} else {
if (node.type === "tab") {
deletedTabs[node.id] = node;
} else if (node.type === "subflow") {
deletedSubflows[node.id] = node;
} else {
deletedNodes[node.id] = node;
}
}
buildNodeLinks(activeLinks,node,flow.allNodes);
@ -720,9 +723,8 @@ function diffFlow(flow,config) {
// var n = flow.allNodes[id];
// console.log("[ ] [ ] [D]",n.id,n.type);
// });
var diff = {
deleted: Object.keys(deletedNodes).filter(function(id) { return deletedNodes[id].type != "subflow" && (!deletedNodes[id].z || deletedTabs[deletedNodes[id].z] || flowNodes[deletedNodes[id].z].type != "subflow")}),
deleted: Object.keys(deletedNodes).filter(function(id) { return deletedNodes[id].type != "subflow" && (!deletedNodes[id].z || deletedTabs[deletedNodes[id].z] || !(deletedSubflows[deletedNodes[id].z] || flowNodes[deletedNodes[id].z].type == "subflow"))}),
changed: Object.keys(changedNodes).filter(function(id) { return changedNodes[id].type != "subflow" && (!changedNodes[id].z || flowNodes[changedNodes[id].z].type != "subflow")}),
linked: Object.keys(linkChangedNodes).filter(function(id) { return linkChangedNodes[id].type != "subflow" && (!linkChangedNodes[id].z || flowNodes[linkChangedNodes[id].z].type != "subflow")}),
wiringChanged: []