niujiuru 3 недель назад
Родитель
Сommit
c8a057ee10

+ 1 - 0
web-ui.service/page5_handler.go

@@ -0,0 +1 @@
+package main

+ 1 - 1
web-ui.service/web/pages/page5.html

@@ -34,7 +34,7 @@
 
       <div class="status-bar">
         <div class="status-item">
-          <span class="label">网口相机(固定IP地址)</span>
+          <span class="label">网口相机(IP/MASK)</span>
           <span class="value">192.168.100.100/24</span>
         </div>
         <div class="status-item">

+ 7 - 4
web-ui.service/web/static/js/log-stream.js

@@ -1,7 +1,8 @@
 let logSource = null;
 let currentUnit = null;
 
-const MAX_LOG_LINES = 2000;
+const MAX_LOG_LINES = 800;
+const MIN_LOG_LINES = 500;
 let logLines = [];
 
 function escapeHtml(s) {
@@ -75,12 +76,14 @@ function connectLog(unit, target) {
         const line = document.createElement("div");
         line.innerHTML = colorLog(e.data);
 
-        const atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < 2;
+        const atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < 20;
 
         el.appendChild(line);
 
-        while (el.childElementCount > MAX_LOG_LINES) {
-            el.removeChild(el.firstElementChild);
+        if (el.childElementCount > MAX_LOG_LINES) {
+            while (el.childElementCount > MIN_LOG_LINES) {
+                el.firstElementChild.remove();
+            }
         }
 
         if (atBottom) {