From 3e538cd1452f17e82afd7212ec2f69b288fe5148 Mon Sep 17 00:00:00 2001 From: Nicholas O'Leary Date: Thu, 19 Sep 2013 14:22:24 +0100 Subject: [PATCH] Debug sidebar: only display 200 most recent entries --- nodes/core/58-debug.html | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nodes/core/58-debug.html b/nodes/core/58-debug.html index 7f188208a..a76f2e82c 100644 --- a/nodes/core/58-debug.html +++ b/nodes/core/58-debug.html @@ -117,6 +117,9 @@ var errornotification = null; + var messageCount = 0; + + function debugConnect() { //console.log("debug ws connecting"); var ws = new WebSocket("ws://"+location.hostname+":"+location.port+document.location.pathname+"/debug"); @@ -160,7 +163,13 @@ (o.topic?''+topic+'':'')+ ''+payload+''; var atBottom = (sbc.scrollHeight-messages.offsetHeight-sbc.scrollTop) < 5; + messageCount++; $(messages).append(msg); + + if (messageCount > 200) { + $("#debug-content .debug-message:first").remove(); + messageCount--; + } if (atBottom) { $(sbc).scrollTop(sbc.scrollHeight); } @@ -176,6 +185,7 @@ $("#debug-tab-clear").click(function() { $(".debug-message").remove(); + messageCount = 0; RED.nodes.eachNode(function(node) { node.highlighted = false; node.dirty = true;