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