From 42626f6ea1c0dade94eb4e710a52cf59f62706b7 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Tue, 23 Feb 2021 09:24:08 +0100
Subject: [PATCH] Limit number of rows in log window

---
 instance/log.ejs | 2 +-
 instance/log.js  | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/instance/log.ejs b/instance/log.ejs
index c01129c..1c920d4 100644
--- a/instance/log.ejs
+++ b/instance/log.ejs
@@ -18,7 +18,7 @@
         <div style='border-color: #abb6c2; border-style: solid; border-top: none; height: 100%;'>
             <table class='table table-sm' style='margin: 0px;'>
                 <thead class='thead-light'
-                       style='position: sticky; position: -webkit-sticky; top: 0; z-index: 999;'>
+                       style='position: sticky; position: -webkit-sticky; top: 0; z-index: 999; -webkit-app-region: drag'>
                     <tr>
                         <th style='border: 0px; position: sticky; position: -webkit-sticky; top: 0; z-index: 999;'>Timestamp</th>
                         <th style='border: 0px; position: sticky; position: -webkit-sticky; top: 0; z-index: 999;'>Label</th>
diff --git a/instance/log.js b/instance/log.js
index 5dba3f8..3eb02c9 100644
--- a/instance/log.js
+++ b/instance/log.js
@@ -28,6 +28,10 @@ file.on('line', line => {
             <td>${match[3]}</td>
         </tr>`
     );
+
+    const limit = 200;
+    var trs = $('tr');
+    if (trs.length > limit) trs.slice(2, trs.length - limit).remove();
 });
 
 window.onload = () => {};
-- 
GitLab