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

added editor action to disable all debug nodes on a global/current workspace level

This commit is contained in:
cinhcet 2020-05-18 22:49:10 +02:00
parent 89a048e5fa
commit b71f81af57

View File

@ -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) {