mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
[outliner] Handle switching projects properly
This commit is contained in:
parent
4af1cf1d1f
commit
f87698438d
@ -1524,7 +1524,6 @@ RED.nodes = (function() {
|
|||||||
groupsByZ = {};
|
groupsByZ = {};
|
||||||
|
|
||||||
var subflowIds = Object.keys(subflows);
|
var subflowIds = Object.keys(subflows);
|
||||||
subflows = {};
|
|
||||||
subflowIds.forEach(function(id) {
|
subflowIds.forEach(function(id) {
|
||||||
RED.subflow.removeSubflow(id)
|
RED.subflow.removeSubflow(id)
|
||||||
});
|
});
|
||||||
|
@ -463,15 +463,15 @@ RED.subflow = (function() {
|
|||||||
var activeSubflow = RED.nodes.subflow(id);
|
var activeSubflow = RED.nodes.subflow(id);
|
||||||
|
|
||||||
RED.nodes.eachNode(function(n) {
|
RED.nodes.eachNode(function(n) {
|
||||||
if (n.type == "subflow:"+activeSubflow.id) {
|
if (n.type == "subflow:"+id) {
|
||||||
removedNodes.push(n);
|
removedNodes.push(n);
|
||||||
}
|
}
|
||||||
if (n.z == activeSubflow.id) {
|
if (n.z == id) {
|
||||||
removedNodes.push(n);
|
removedNodes.push(n);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RED.nodes.eachConfig(function(n) {
|
RED.nodes.eachConfig(function(n) {
|
||||||
if (n.z == activeSubflow.id) {
|
if (n.z == id) {
|
||||||
removedNodes.push(n);
|
removedNodes.push(n);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -3,14 +3,13 @@ RED.sidebar.info.outliner = (function() {
|
|||||||
var treeList;
|
var treeList;
|
||||||
var searchInput;
|
var searchInput;
|
||||||
var projectInfo;
|
var projectInfo;
|
||||||
|
var projectInfoLabel;
|
||||||
var flowList;
|
var flowList;
|
||||||
var subflowList;
|
var subflowList;
|
||||||
var globalConfigNodes;
|
var globalConfigNodes;
|
||||||
|
|
||||||
var objects = {};
|
var objects = {};
|
||||||
|
|
||||||
var objectBacklog = {};
|
|
||||||
|
|
||||||
function getFlowData() {
|
function getFlowData() {
|
||||||
var flowData = [
|
var flowData = [
|
||||||
{
|
{
|
||||||
@ -187,8 +186,11 @@ RED.sidebar.info.outliner = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onProjectLoad(activeProject) {
|
function onProjectLoad(activeProject) {
|
||||||
|
objects = {};
|
||||||
var newFlowData = getFlowData();
|
var newFlowData = getFlowData();
|
||||||
getProjectLabel(activeProject).appendTo(projectInfo);
|
projectInfoLabel.empty();
|
||||||
|
getProjectLabel(activeProject).appendTo(projectInfoLabel);
|
||||||
|
projectInfo.show();
|
||||||
treeList.treeList('data',newFlowData);
|
treeList.treeList('data',newFlowData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +225,8 @@ RED.sidebar.info.outliner = (function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
projectInfo = $('<div class="red-ui-treeList-label red-ui-info-outline-project"><span class="red-ui-treeList-icon"><i class="fa fa-archive"></i></span></div>').appendTo(container)
|
projectInfo = $('<div class="red-ui-treeList-label red-ui-info-outline-project"><span class="red-ui-treeList-icon"><i class="fa fa-archive"></i></span></div>').hide().appendTo(container)
|
||||||
|
projectInfoLabel = $('<span>').appendTo(projectInfo);
|
||||||
|
|
||||||
// <div class="red-ui-info-outline-item red-ui-info-outline-item-flow" style=";"><div class="red-ui-search-result-description red-ui-info-outline-item-label">Space Monkey</div><div class="red-ui-info-outline-item-controls"><button class="red-ui-button red-ui-button-small" style="position:absolute;right:5px;"><i class="fa fa-ellipsis-h"></i></button></div></div></div>').appendTo(container)
|
// <div class="red-ui-info-outline-item red-ui-info-outline-item-flow" style=";"><div class="red-ui-search-result-description red-ui-info-outline-item-label">Space Monkey</div><div class="red-ui-info-outline-item-controls"><button class="red-ui-button red-ui-button-small" style="position:absolute;right:5px;"><i class="fa fa-ellipsis-h"></i></button></div></div></div>').appendTo(container)
|
||||||
|
|
||||||
@ -267,15 +270,13 @@ RED.sidebar.info.outliner = (function() {
|
|||||||
|
|
||||||
RED.events.on("view:selection-changed", onSelectionChanged);
|
RED.events.on("view:selection-changed", onSelectionChanged);
|
||||||
|
|
||||||
|
RED.events.on("workspace:clear", onWorkspaceClear)
|
||||||
|
|
||||||
// ["links","nodes","flows","subflows","groups"].forEach(function(t) {
|
|
||||||
// ["add","remove","change"].forEach(function(v) {
|
|
||||||
// RED.events.on(t+":"+v, function(n) { console.log(t+":"+v,n)})
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// RED.events.on("workspace:clear", function() { console.log("workspace:clear")})
|
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
function onWorkspaceClear() {
|
||||||
|
treeList.treeList('data',getFlowData());
|
||||||
|
}
|
||||||
function onFlowAdd(ws) {
|
function onFlowAdd(ws) {
|
||||||
objects[ws.id] = {
|
objects[ws.id] = {
|
||||||
id: ws.id,
|
id: ws.id,
|
||||||
@ -390,17 +391,6 @@ RED.sidebar.info.outliner = (function() {
|
|||||||
|
|
||||||
function onSelectionChanged(selection) {
|
function onSelectionChanged(selection) {
|
||||||
treeList.treeList('clearSelection');
|
treeList.treeList('clearSelection');
|
||||||
// // console.log(selection);
|
|
||||||
// if (selection.nodes) {
|
|
||||||
// selection.nodes.forEach(function(n) {
|
|
||||||
// // console.log("..",n.id);
|
|
||||||
// treeList.treeList('show',n.id);
|
|
||||||
// if (objects[n.id].treeList) {
|
|
||||||
// objects[n.id].treeList.select(true);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user