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

Disable subflow/flow menu options if active is locked

This commit is contained in:
Nick O'Leary 2022-11-01 11:29:23 +00:00
parent f12d36b5ed
commit ce94226c3c
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
3 changed files with 10 additions and 8 deletions

View File

@ -554,7 +554,7 @@ RED.subflow = (function() {
} }
}); });
RED.events.on("view:selection-changed",function(selection) { RED.events.on("view:selection-changed",function(selection) {
if (!selection.nodes) { if (!selection.nodes || RED.workspaces.isActiveLocked()) {
RED.menu.setDisabled("menu-item-subflow-convert",true); RED.menu.setDisabled("menu-item-subflow-convert",true);
} else { } else {
RED.menu.setDisabled("menu-item-subflow-convert",false); RED.menu.setDisabled("menu-item-subflow-convert",false);

View File

@ -423,8 +423,8 @@ RED.view = (function() {
} }
} }
RED.menu.setDisabled("menu-item-workspace-edit", activeSubflow || event.workspace === 0); RED.menu.setDisabled("menu-item-workspace-edit", activeFlowLocked || activeSubflow || event.workspace === 0);
RED.menu.setDisabled("menu-item-workspace-delete",event.workspace === 0 || RED.workspaces.count() == 1 || activeSubflow); RED.menu.setDisabled("menu-item-workspace-delete",activeFlowLocked || event.workspace === 0 || RED.workspaces.count() == 1 || activeSubflow);
if (workspaceScrollPositions[event.workspace]) { if (workspaceScrollPositions[event.workspace]) {
chart.scrollLeft(workspaceScrollPositions[event.workspace].left); chart.scrollLeft(workspaceScrollPositions[event.workspace].left);

View File

@ -329,8 +329,8 @@ RED.workspaces = (function() {
$("#red-ui-workspace-chart").show(); $("#red-ui-workspace-chart").show();
activeWorkspace = tab.id; activeWorkspace = tab.id;
window.location.hash = 'flow/'+tab.id; window.location.hash = 'flow/'+tab.id;
$("#red-ui-workspace").toggleClass("red-ui-workspace-disabled",!!tab.disabled); $("#red-ui-workspace").toggleClass("red-ui-workspace-disabled", !!tab.disabled);
$("#red-ui-workspace").toggleClass("red-ui-workspace-locked",!!tab.locked); $("#red-ui-workspace").toggleClass("red-ui-workspace-locked", !!tab.locked);
} else { } else {
$("#red-ui-workspace-chart").hide(); $("#red-ui-workspace-chart").hide();
activeWorkspace = 0; activeWorkspace = 0;
@ -724,11 +724,13 @@ RED.workspaces = (function() {
} }
function removeWorkspace(ws) { function removeWorkspace(ws) {
if (ws.locked) { return }
if (!ws) { if (!ws) {
ws = RED.nodes.workspace(activeWorkspace)
if (ws && !ws.locked) {
deleteWorkspace(RED.nodes.workspace(activeWorkspace)); deleteWorkspace(RED.nodes.workspace(activeWorkspace));
}
} else { } else {
if (ws.locked) { return }
if (workspace_tabs.contains(ws.id)) { if (workspace_tabs.contains(ws.id)) {
workspace_tabs.removeTab(ws.id); workspace_tabs.removeTab(ws.id);
} }