From 86fc29740373b896d63276d38aa23c20da040ae8 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Thu, 13 Aug 2026 17:15:58 +0800
Subject: [PATCH] refactor(station-dashboard): 将自动轮询改为手动刷新机制

---
 src/main/resources/static/station-dashboard.html |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/main/resources/static/station-dashboard.html b/src/main/resources/static/station-dashboard.html
index 31e91ff..07e2c8d 100644
--- a/src/main/resources/static/station-dashboard.html
+++ b/src/main/resources/static/station-dashboard.html
@@ -315,7 +315,7 @@
 <div class="sidebar">
     <div class="sidebar-header">
         <h1>📡 Station</h1>
-        <span class="refresh-badge" id="refreshBadge">⏳ 5s</span>
+        <button class="btn btn-outline" onclick="refreshInstanceList()" style="font-size:11px;padding:3px 10px">🔄 刷新</button>
     </div>
     <div class="instance-list" id="instanceList">
         <div class="empty-state">
@@ -429,7 +429,6 @@
 let instances = {};
 let eventsCache = {};
 let pnlChart = null;
-let pollingTimer = null;
 let pendingAction = null;
 let pnlData = [];
 
@@ -501,9 +500,20 @@
         }
         instances = newInstances;
         renderInstanceList();
+        // 实例数据已更新,同步刷新选中实例的概览统计与参数页状态条
+        if (selectedMd5 && instances[selectedMd5]) {
+            renderStats(instances[selectedMd5]);
+            renderConfigStatusBar();
+        }
     } catch (e) {
         // 静默失败,保留旧数据
     }
+}
+
+// 手动刷新事件日志(对应「事件日志」Tab 的刷新按钮)
+function refreshEvents() {
+    if (!selectedMd5) return;
+    loadEvents(selectedMd5);
 }
 
 function renderInstanceList() {
@@ -570,6 +580,7 @@
     header.querySelector('.instance-title').innerHTML = `
         <h2>${inst.contract || '—'} <span style="font-size:12px;color:var(--dim);font-weight:400">${md5.substring(0,12)}...</span></h2>
         <span class="state-badge ${sanitizeState(inst.state)}">${inst.state || 'UNKNOWN'}</span>
+        <button class="btn btn-outline" onclick="refreshEvents()" style="font-size:11px;padding:3px 10px">🔄 刷新</button>
     `;
     $('btnStart').disabled = false;
     $('btnStop').disabled = false;
@@ -1126,19 +1137,8 @@
 
 // ==================== 初始化 ====================
 function startPolling() {
-    poll(); // 立即执行一次
-    pollingTimer = setInterval(poll, 5000);
+    poll(); // 页面加载时立即加载一次实例列表(不再自动轮询,改为手动刷新)
 }
-
-// 倒计时显示
-setInterval(() => {
-    const badge = $('refreshBadge');
-    if (badge) badge.textContent = '⏳ 5s';
-    setTimeout(() => { if (badge) badge.textContent = '⏳ 4s'; }, 1000);
-    setTimeout(() => { if (badge) badge.textContent = '⏳ 3s'; }, 2000);
-    setTimeout(() => { if (badge) badge.textContent = '⏳ 2s'; }, 3000);
-    setTimeout(() => { if (badge) badge.textContent = '⏳ 1s'; }, 4000);
-}, 5000);
 
 startPolling();
 </script>

--
Gitblit v1.9.1