mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
All subflow input to be deleted by selection
This commit is contained in:
parent
64a6fe11da
commit
5cb9a5b7eb
@ -66,8 +66,14 @@ RED.history = (function() {
|
|||||||
if (ev.subflow) {
|
if (ev.subflow) {
|
||||||
RED.nodes.addSubflow(ev.subflow);
|
RED.nodes.addSubflow(ev.subflow);
|
||||||
}
|
}
|
||||||
|
var subflow;
|
||||||
|
if (ev.subflowInputs && ev.subflowInputs.length > 0) {
|
||||||
|
subflow = RED.nodes.subflow(ev.subflowInputs[0].z);
|
||||||
|
subflow.in.push(ev.subflowInputs[0]);
|
||||||
|
subflow.in[0].dirty = true;
|
||||||
|
}
|
||||||
if (ev.subflowOutputs && ev.subflowOutputs.length > 0) {
|
if (ev.subflowOutputs && ev.subflowOutputs.length > 0) {
|
||||||
var subflow = RED.nodes.subflow(ev.subflowOutputs[0].z);
|
subflow = RED.nodes.subflow(ev.subflowOutputs[0].z);
|
||||||
ev.subflowOutputs.sort(function(a,b) { return a.i-b.i});
|
ev.subflowOutputs.sort(function(a,b) { return a.i-b.i});
|
||||||
for (i=0;i<ev.subflowOutputs.length;i++) {
|
for (i=0;i<ev.subflowOutputs.length;i++) {
|
||||||
var output = ev.subflowOutputs[i];
|
var output = ev.subflowOutputs[i];
|
||||||
@ -84,6 +90,8 @@ RED.history = (function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (subflow) {
|
||||||
RED.nodes.eachNode(function(n) {
|
RED.nodes.eachNode(function(n) {
|
||||||
if (n.type == "subflow:"+subflow.id) {
|
if (n.type == "subflow:"+subflow.id) {
|
||||||
n.changed = true;
|
n.changed = true;
|
||||||
|
@ -796,6 +796,7 @@ RED.view = (function() {
|
|||||||
var removedNodes = [];
|
var removedNodes = [];
|
||||||
var removedLinks = [];
|
var removedLinks = [];
|
||||||
var removedSubflowOutputs = [];
|
var removedSubflowOutputs = [];
|
||||||
|
var removedSubflowInputs = [];
|
||||||
|
|
||||||
var startDirty = dirty;
|
var startDirty = dirty;
|
||||||
if (moving_set.length > 0) {
|
if (moving_set.length > 0) {
|
||||||
@ -812,6 +813,8 @@ RED.view = (function() {
|
|||||||
} else {
|
} else {
|
||||||
if (node.direction === "out") {
|
if (node.direction === "out") {
|
||||||
removedSubflowOutputs.push(node);
|
removedSubflowOutputs.push(node);
|
||||||
|
} else if (node.direction === "in") {
|
||||||
|
removedSubflowInputs.push(node);
|
||||||
}
|
}
|
||||||
node.dirty = true;
|
node.dirty = true;
|
||||||
}
|
}
|
||||||
@ -843,6 +846,23 @@ RED.view = (function() {
|
|||||||
activeSubflow.out[j].dirty = true;
|
activeSubflow.out[j].dirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Assume 0/1 inputs
|
||||||
|
|
||||||
|
if (removedSubflowInputs.length == 1) {
|
||||||
|
var input = removedSubflowInputs[0];
|
||||||
|
var subflowRemovedInputLinks = [];
|
||||||
|
RED.nodes.eachLink(function(l) {
|
||||||
|
if (l.source.type == "subflow" && l.source.z == activeSubflow.id && l.source.i == input.i) {
|
||||||
|
subflowRemovedLinks.push(l);
|
||||||
|
} else if (l.target.type == "subflow:"+activeSubflow.id) {
|
||||||
|
subflowRemovedLinks.push(l);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
subflowRemovedInputLinks.forEach(function(l) { RED.nodes.removeLink(l)});
|
||||||
|
removedLinks = removedLinks.concat(subflowRemovedInputLinks);
|
||||||
|
activeSubflow.in = [];
|
||||||
|
}
|
||||||
|
|
||||||
RED.nodes.eachNode(function(n) {
|
RED.nodes.eachNode(function(n) {
|
||||||
if (n.type == "subflow:"+activeSubflow.id) {
|
if (n.type == "subflow:"+activeSubflow.id) {
|
||||||
n.changed = true;
|
n.changed = true;
|
||||||
@ -866,7 +886,7 @@ RED.view = (function() {
|
|||||||
removedLinks.push(selected_link);
|
removedLinks.push(selected_link);
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
}
|
}
|
||||||
RED.history.push({t:'delete',nodes:removedNodes,links:removedLinks,subflowOutputs:removedSubflowOutputs,dirty:startDirty});
|
RED.history.push({t:'delete',nodes:removedNodes,links:removedLinks,subflowOutputs:removedSubflowOutputs,subflowInputs:removedSubflowInputs,dirty:startDirty});
|
||||||
|
|
||||||
selected_link = null;
|
selected_link = null;
|
||||||
updateSelection();
|
updateSelection();
|
||||||
|
Loading…
Reference in New Issue
Block a user