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

Debug sidebar: only display 200 most recent entries

This commit is contained in:
Nicholas O'Leary 2013-09-19 14:22:24 +01:00
parent 8821f88743
commit 3e538cd145

View File

@ -117,6 +117,9 @@
var errornotification = null; var errornotification = null;
var messageCount = 0;
function debugConnect() { function debugConnect() {
//console.log("debug ws connecting"); //console.log("debug ws connecting");
var ws = new WebSocket("ws://"+location.hostname+":"+location.port+document.location.pathname+"/debug"); var ws = new WebSocket("ws://"+location.hostname+":"+location.port+document.location.pathname+"/debug");
@ -160,7 +163,13 @@
(o.topic?'<span class="debug-message-topic">'+topic+'</span>':'')+ (o.topic?'<span class="debug-message-topic">'+topic+'</span>':'')+
'<span class="debug-message-payload">'+payload+'</span>'; '<span class="debug-message-payload">'+payload+'</span>';
var atBottom = (sbc.scrollHeight-messages.offsetHeight-sbc.scrollTop) < 5; var atBottom = (sbc.scrollHeight-messages.offsetHeight-sbc.scrollTop) < 5;
messageCount++;
$(messages).append(msg); $(messages).append(msg);
if (messageCount > 200) {
$("#debug-content .debug-message:first").remove();
messageCount--;
}
if (atBottom) { if (atBottom) {
$(sbc).scrollTop(sbc.scrollHeight); $(sbc).scrollTop(sbc.scrollHeight);
} }
@ -176,6 +185,7 @@
$("#debug-tab-clear").click(function() { $("#debug-tab-clear").click(function() {
$(".debug-message").remove(); $(".debug-message").remove();
messageCount = 0;
RED.nodes.eachNode(function(node) { RED.nodes.eachNode(function(node) {
node.highlighted = false; node.highlighted = false;
node.dirty = true; node.dirty = true;