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

[groups] Prevent subflow port nodes being added group

This commit is contained in:
Nick O'Leary 2020-03-24 14:05:35 +00:00
parent 7bc3b662e4
commit 7c91c4ae5a
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 21 additions and 12 deletions

View File

@ -345,6 +345,10 @@ RED.group = (function() {
if (nodes.length === 0) { if (nodes.length === 0) {
return; return;
} }
if (nodes.filter(function(n) { return n.type === "subflow" }).length > 0) {
RED.notify("Cannot add subflow ports to a group","error");
return;
}
// nodes is an array // nodes is an array
// each node must be on the same tab (z) // each node must be on the same tab (z)
var group = { var group = {
@ -416,6 +420,7 @@ RED.group = (function() {
// Second pass - add them to the group // Second pass - add them to the group
for (i=0;i<nodes.length;i++) { for (i=0;i<nodes.length;i++) {
n = nodes[i]; n = nodes[i];
if (n.type !== "subflow") {
if (g && n.g === g.id) { if (g && n.g === g.id) {
var ni = g.nodes.indexOf(n); var ni = g.nodes.indexOf(n);
if (ni > -1) { if (ni > -1) {
@ -431,7 +436,11 @@ RED.group = (function() {
group.h = Math.max(group.h,n.y+n.h/2+25-group.y); group.h = Math.max(group.h,n.y+n.h/2+25-group.y);
} }
} }
markDirty(group);
}
function removeFromGroup(group, nodes, reparent) { function removeFromGroup(group, nodes, reparent) {
console.log('rfg',group,nodes);
if (!Array.isArray(nodes)) { if (!Array.isArray(nodes)) {
nodes = [nodes]; nodes = [nodes];
} }

View File

@ -1382,7 +1382,7 @@ if (DEBUG_EVENTS) { console.warn("canvasMouseDown", mouse_mode); }
},100); },100);
} }
} }
if (!node.n.g && activeGroups) { if (node.n.type !== 'subflow' && !node.n.g && activeGroups) {
if (!groupHoverTimer) { if (!groupHoverTimer) {
groupHoverTimer = setTimeout(function() { groupHoverTimer = setTimeout(function() {
activeHoverGroup = getGroupAt(node.n.x,node.n.y); activeHoverGroup = getGroupAt(node.n.x,node.n.y);