Skip to content

Commit

Permalink
Ignore subflow debug nodes when building filter
Browse files Browse the repository at this point in the history
Fixes #1660

As the editor doesn't know the ids of subflow instance debug nodes
there's no easy way to build a list of them as part of the filter
options. So for now, disable the filter option if we don't know
about the debug node.
  • Loading branch information
knolleary committed Mar 3, 2018
1 parent cfcf78a commit 3b12076
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions nodes/core/core/lib/debug/debug-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ RED.debug = (function() {
clearMessageList(false);
});


return {
content: content,
footer: footerToolbar
Expand All @@ -238,6 +237,9 @@ RED.debug = (function() {
workspaceOrder.forEach(function(ws,i) {
workspaceOrderMap[ws] = i;
});
candidateNodes = candidateNodes.filter(function(node) {
return workspaceOrderMap.hasOwnProperty(node.z);
})
candidateNodes.sort(function(A,B) {
var wsA = workspaceOrderMap[A.z];
var wsB = workspaceOrderMap[B.z];
Expand Down Expand Up @@ -339,7 +341,7 @@ RED.debug = (function() {
activeMenuMessage.clearPinned();
}},
null,
{id:"debug-message-menu-item-filter",label:RED._("node-red:debug.messageMenu.filterNode"),onselect:function(){
{id:"debug-message-menu-item-filter", label:RED._("node-red:debug.messageMenu.filterNode"),onselect:function(){
var candidateNodes = RED.nodes.filterNodes({type:'debug'});
candidateNodes.forEach(function(n) {
filteredNodes[n.id] = true;
Expand All @@ -361,6 +363,15 @@ RED.debug = (function() {
menuOptionMenu.on('mouseup', function() { $(this).hide() });
menuOptionMenu.appendTo("body");
}

var filterOptionDisabled = false;
var sourceNode = RED.nodes.node(sourceId);
if (sourceNode && sourceNode.type !== 'debug') {
filterOptionDisabled = true;
}
RED.menu.setDisabled('debug-message-menu-item-filter',filterOptionDisabled);
RED.menu.setDisabled('debug-message-menu-item-clear-filter',filterOptionDisabled);

var elementPos = button.offset();
menuOptionMenu.css({
top: elementPos.top+"px",
Expand Down

0 comments on commit 3b12076

Please sign in to comment.