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

Merge pull request #2609 from node-red-hitachi/fix-remove-from-group

fix empty placeholder not shown on remove from group
This commit is contained in:
Nick O'Leary 2020-06-12 08:49:09 +01:00 committed by GitHub
commit eeebf04509
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,7 @@ RED.sidebar.info.outliner = (function() {
children: [] children: []
}, },
{ {
id: "__subflow__",
label: RED._("menu.label.subflows"), label: RED._("menu.label.subflows"),
children: [] children: []
}, },
@ -272,6 +273,9 @@ RED.sidebar.info.outliner = (function() {
} }
}) })
subflowList.treeList.addChild(getEmptyItem("__subflow__"));
globalConfigNodes.treeList.addChild(getEmptyItem("__global__"));
RED.events.on("projects:load", onProjectLoad) RED.events.on("projects:load", onProjectLoad)
RED.events.on("flows:add", onFlowAdd) RED.events.on("flows:add", onFlowAdd)
@ -358,6 +362,10 @@ RED.sidebar.info.outliner = (function() {
} else { } else {
objects[sf.id].children.push(getEmptyItem(sf.id)); objects[sf.id].children.push(getEmptyItem(sf.id));
} }
if (empties["__subflow__"]) {
empties["__subflow__"].treeList.remove();
delete empties["__subflow__"];
}
subflowList.treeList.addChild(objects[sf.id]) subflowList.treeList.addChild(objects[sf.id])
updateSearch(); updateSearch();
} }
@ -438,8 +446,8 @@ RED.sidebar.info.outliner = (function() {
delete missingParents[n.id] delete missingParents[n.id]
} }
} }
var parent = n.g||n.z; var parent = n.g||n.z||"__global__";
if (parent) { if (parent !== "__global__") {
if (objects[parent]) { if (objects[parent]) {
if (empties[parent]) { if (empties[parent]) {
empties[parent].treeList.remove(); empties[parent].treeList.remove();
@ -455,8 +463,12 @@ RED.sidebar.info.outliner = (function() {
missingParents[parent].push(objects[n.id]) missingParents[parent].push(objects[n.id])
} }
} else { } else {
if (empties[parent]) {
empties[parent].treeList.remove();
delete empties[parent];
}
// No parent - add to Global flow list // No parent - add to Global flow list
globalConfigNodes.treeList.addChild(objects[n.id]) globalConfigNodes.treeList.addChild(objects[n.id]);
} }
objects[n.id].element.toggleClass("red-ui-info-outline-item-disabled", !!n.d) objects[n.id].element.toggleClass("red-ui-info-outline-item-disabled", !!n.d)
updateSearch(); updateSearch();