From 534fbdbfafef763337640e774d33bd7014f93e57 Mon Sep 17 00:00:00 2001 From: attacker Date: Fri, 19 Jun 2026 02:02:04 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=87=E6=8D=A2=E5=AE=9E=E4=BE=8B?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=97=A0=E6=95=88=20&=20=E7=A3=81=E7=9B=98?= =?UTF-8?q?=E5=88=86=E5=8C=BA=E5=86=85=E5=AE=B9=E6=BA=A2=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Select 下拉切换主机时同步更新 latest/serverInfo(添加 selectedHost 依赖) - 磁盘分区 used_gb/usage_percent 格式化 .toFixed(1),容器加宽 + whitespace-nowrap 防溢出 --- frontend/src/pages/HostMonitor.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/pages/HostMonitor.tsx b/frontend/src/pages/HostMonitor.tsx index 0a7ac78..9f39d68 100644 --- a/frontend/src/pages/HostMonitor.tsx +++ b/frontend/src/pages/HostMonitor.tsx @@ -100,13 +100,14 @@ export function HostMonitor() { const m = urlHost ? list.find((h: any) => h.hostname === urlHost) : null; setSelectedHost(m?.hostname || list[0]?.hostname || ''); } - const cur = list.find((h: any) => h.hostname === (urlHost || selectedHost)); + // 切换主机时同步更新 latest / serverInfo + const cur = list.find((h: any) => h.hostname === (selectedHost || urlHost)); if (cur) { setLatest(cur); setServerInfo(cur); } }).catch(() => {}).finally(() => setLoading(false)); - }, []); + }, [selectedHost]); // 加载历史数据 useEffect(() => { @@ -392,8 +393,8 @@ export function HostMonitor() {
- {p.used_gb?.toFixed(1) || p.used || '?'}/{p.total_gb?.toFixed(0) || p.total || '?'}GB - {p.usage_percent || p.used_percent || 0}% + {(p.used_gb ?? 0).toFixed(1)}/{(p.total_gb ?? 0).toFixed(0)}GB + {(p.usage_percent ?? p.used_percent ?? 0).toFixed(1)}%
))}