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

allow filtering of debug node output within subflow

This commit is contained in:
Hiroyasu Nishiyama 2021-02-10 17:32:27 +09:00
parent f5da2eb633
commit 5a6568e7c2

View File

@ -120,7 +120,7 @@ RED.debug = (function() {
filteredNodes[node.id] = !$(this).prop('checked');
$(".red-ui-debug-msg-node-"+node.id.replace(/\./g,"_")).toggleClass('hide',filteredNodes[node.id]);
});
if (!node.active || RED.nodes.workspace(node.z).disabled) {
if ((node.hasOwnProperty("active") && !node.active) || RED.nodes.workspace(node.z).disabled) {
container.addClass('disabled');
muteControl.checkboxSet('disable');
}
@ -233,6 +233,35 @@ RED.debug = (function() {
}
function containsDebug(sid, map) {
if (sid in map) {
return true;
}
var nodes = RED.nodes.filterNodes({z: sid});
var contain = false;
nodes.forEach(function (n) {
if (contain) {
return;
}
var nt = n.type;
if (nt === "debug") {
contain = true;
return;
}
if (nt.substring(0, 8) === "subflow:") {
var id = nt.substring(8);
if (containsDebug(id, map)) {
contain = true;
return;
}
}
});
if (contain) {
map[sid] = true;
}
return contain;
}
function refreshDebugNodeList() {
debugNodeList.editableList('empty');
var candidateNodes = RED.nodes.filterNodes({type:'debug'});
@ -243,7 +272,18 @@ RED.debug = (function() {
});
candidateNodes = candidateNodes.filter(function(node) {
return workspaceOrderMap.hasOwnProperty(node.z);
})
});
var map = {};
RED.nodes.eachNode(function (n) {
var nt = n.type;
if ((n.z in workspaceOrderMap) &&
(nt.substring(0, 8) === "subflow:")) {
var sid = nt.substring(8);
if (containsDebug(sid, map)) {
candidateNodes.push(n);
}
}
});
candidateNodes.sort(function(A,B) {
var wsA = workspaceOrderMap[A.z];
var wsB = workspaceOrderMap[B.z];
@ -253,7 +293,7 @@ RED.debug = (function() {
var labelA = RED.utils.getNodeLabel(A,A.id);
var labelB = RED.utils.getNodeLabel(B,B.id);
return labelA.localeCompare(labelB);
})
});
var currentWs = null;
var nodeList = [];
candidateNodes.forEach(function(node) {
@ -262,10 +302,8 @@ RED.debug = (function() {
nodeList.push(RED.nodes.workspace(node.z));
}
nodeList.push(node);
})
debugNodeList.editableList('addItems',nodeList)
});
debugNodeList.editableList('addItems',nodeList);
}
function getTimestamp() {