From b71f81af57e33ce2d4997f32dbf15582e9491a36 Mon Sep 17 00:00:00 2001 From: cinhcet Date: Mon, 18 May 2020 22:49:10 +0200 Subject: [PATCH] added editor action to disable all debug nodes on a global/current workspace level --- .../@node-red/editor-client/src/js/ui/view.js | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js index 80a9432f7..59db841ad 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js @@ -401,6 +401,8 @@ RED.view = (function() { $("#red-ui-workspace-tabs").removeClass("red-ui-workspace-focussed"); }); + RED.actions.add("core:disable-all-debug-nodes", function() { disableAllDebugNodes(false); }); + RED.actions.add("core:disable-all-flow-debug-nodes", function() { disableAllDebugNodes(true); }); RED.actions.add("core:copy-selection-to-internal-clipboard",copySelection); RED.actions.add("core:cut-selection-to-internal-clipboard",function(){copySelection();deleteSelection();}); RED.actions.add("core:paste-from-internal-clipboard",function(){importNodes(clipboard);}); @@ -1432,6 +1434,34 @@ RED.view = (function() { redraw(); } + function disableAllDebugNodes(currentFlowOnly) { + var historyEvents = []; + RED.nodes.eachNode(function(n) { + if (n.type === "debug" && n.active === true && ( currentFlowOnly === false || n.z == RED.workspaces.active() )) { + var oldValue = n.active; + historyEvents.push({ + t: "edit", + node: n, + changed: n.changed, + changes: { + active: oldValue + } + }); + n.active = false; + n.changed = true; + n.dirty = true; + } + }); + if (historyEvents.length > 0) { + RED.history.push({ + t: "multi", + events: historyEvents, + dirty: RED.nodes.dirty() + }); + RED.nodes.dirty(true); + } + RED.view.redraw(); + } function selectAll() { if (mouse_mode === RED.state.SELECTING_NODE && selectNodesOptions.single) {