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

disable hide all menu if all tabs hidden

This commit is contained in:
Hiroyasu Nishiyama 2023-01-30 11:42:53 +09:00
parent a607ee90e0
commit 66f9686e48

View File

@ -143,6 +143,14 @@ RED.workspaces = (function() {
const hiddenflowCount = hiddenFlows.size; const hiddenflowCount = hiddenFlows.size;
let activeWorkspace = tab || RED.nodes.workspace(RED.workspaces.active()) || RED.nodes.subflow(RED.workspaces.active()) let activeWorkspace = tab || RED.nodes.workspace(RED.workspaces.active()) || RED.nodes.subflow(RED.workspaces.active())
let isFlowDisabled = activeWorkspace ? activeWorkspace.disabled : false let isFlowDisabled = activeWorkspace ? activeWorkspace.disabled : false
const currentTabs = workspace_tabs.listTabs();
let flowCount = 0;
currentTabs.forEach(tab => {
console.log("; TAB: ", tab);
if (RED.nodes.workspace(tab)) {
flowCount++;
}
});
var menuItems = [] var menuItems = []
if (isMenuButton) { if (isMenuButton) {
@ -194,7 +202,6 @@ RED.workspaces = (function() {
} }
) )
} }
const currentTabs = workspace_tabs.listTabs()
const activeIndex = currentTabs.findIndex(id => id === activeWorkspace.id) const activeIndex = currentTabs.findIndex(id => id === activeWorkspace.id)
menuItems.push( menuItems.push(
{ {
@ -236,11 +243,13 @@ RED.workspaces = (function() {
} }
) )
} }
menuItems.push( menuItems.push(
{ {
id:"red-ui-tabs-menu-option-add-hide-all-flows", id:"red-ui-tabs-menu-option-add-hide-all-flows",
label: RED._("workspace.hideAllFlows"), label: RED._("workspace.hideAllFlows"),
onselect: "core:hide-all-flows" onselect: "core:hide-all-flows",
disabled: (hiddenflowCount === flowCount)
}, },
{ {
id:"red-ui-tabs-menu-option-add-show-all-flows", id:"red-ui-tabs-menu-option-add-show-all-flows",