fix(ui): 断线清指标加强——DeviceLink 离线也清 + 模块缓存版本戳
入口/stages/polling 带 ?v=20260916d,避免深层 import 被浏览器缓存成旧版; 外壳快照 ESP32 offline 时同样 clearLiveMetricsOnDisconnect。
This commit is contained in:
@@ -17,7 +17,7 @@ import {
|
||||
import {
|
||||
scheduleStatusPoll, startPolling, pausePollingForUpload,
|
||||
resumePollingAfterUpload, pollStatus, pollLogs, setStatusPollIntervalMs
|
||||
} from './common/polling.js';
|
||||
} from './common/polling.js?v=20260916d';
|
||||
|
||||
import {
|
||||
OtaSessionState, otaSessionState, otaSessionTarget, otaFailReason,
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
} from './ota/progress.js';
|
||||
import {
|
||||
updateStagesFromRelayState, updateSystemStatusUi, clearLiveMetricsOnDisconnect
|
||||
} from './ota/stages.js';
|
||||
} from './ota/stages.js?v=20260916d';
|
||||
import { startEcatLoadPoller } from './ota/ecat_load.js';
|
||||
import { deviceLink } from './common/device-link.js';
|
||||
import {
|
||||
@@ -293,6 +293,18 @@ setupDropZone('uploadZoneGd32', 'gd32');
|
||||
// 否则 polling.js 的 scheduleStatusPoll 会因 window.OtaSessionState 未定义而抛 TypeError)
|
||||
startPolling();
|
||||
|
||||
/* DeviceLink 快照判 ESP32 离线时也清指标:
|
||||
* 本页 pollStatus 可能 AbortError 静默返回,或 iframe 里旧模块未清——
|
||||
* 外壳 Owner 是更权威的「设备在线」来源,离线布尔一翻就清。 */
|
||||
deviceLink.subscribe(function (s) {
|
||||
try {
|
||||
if (!s || !s.ts || !s.links || !s.links.esp32) return;
|
||||
if ((Date.now() - s.ts) >= 5000) return;
|
||||
if (s.links.esp32.online) return;
|
||||
clearLiveMetricsOnDisconnect();
|
||||
} catch (_) {}
|
||||
});
|
||||
|
||||
// GD32 CPU 负载率(EtherCAT 通道,独立于 /system/status 轮询;页面上无该指标则自动空转)
|
||||
startEcatLoadPoller();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user