Skip to content

Commit

Permalink
move to debug.html, rename to "deactivate" instead of "disable"
Browse files Browse the repository at this point in the history
  • Loading branch information
cinhcet committed May 19, 2020
1 parent b71f81a commit a69db4d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
30 changes: 0 additions & 30 deletions packages/node_modules/@node-red/editor-client/src/js/ui/view.js
Expand Up @@ -401,8 +401,6 @@ 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);});
Expand Down Expand Up @@ -1434,34 +1432,6 @@ 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) {
Expand Down
34 changes: 34 additions & 0 deletions packages/node_modules/@node-red/nodes/core/common/21-debug.html
Expand Up @@ -266,6 +266,40 @@
RED.events.on("project:change", this.clearMessageList);
RED.actions.add("core:clear-debug-messages", function() { RED.debug.clearMessageList(true) });


RED.actions.add("core:deactivate-all-debug-nodes", function() { deactivateAllDebugNodes(true); });
RED.actions.add("core:deactivate-all-flow-debug-nodes", function() { deactivateAllDebugNodes(false); });

function deactivateAllDebugNodes(globally) {
var historyEvents = [];
RED.nodes.eachNode(function(n) {
if (n.type === "debug" && n.active === true) {
if (globally === true || n.z == RED.workspaces.active()) {
historyEvents.push({
t: "edit",
node: n,
changed: n.changed,
changes: {
active: n.active
}
});
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();
}

$("#red-ui-sidebar-debug-open").on("click", function(e) {
e.preventDefault();
subWindow = window.open(document.location.toString().replace(/[?#].*$/,"")+"debug/view/view.html"+document.location.search,"nodeREDDebugView","menubar=no,location=no,toolbar=no,chrome,height=500,width=600");
Expand Down

0 comments on commit a69db4d

Please sign in to comment.