diff --git a/frontend/src/components/NodeCard.tsx b/frontend/src/components/NodeCard.tsx index bc01f44..1af8dab 100644 --- a/frontend/src/components/NodeCard.tsx +++ b/frontend/src/components/NodeCard.tsx @@ -104,6 +104,7 @@ export const NodeCard = memo(function NodeCard({ server, config, liveLatencyResu }) { const threshold = config.offline_threshold_seconds; const online = isOnline(server, threshold); + const cpuCores = Math.max(0, Math.trunc(number(server.cpu_cores))); const memory = percent(server.mem_used, server.mem_total); const disk = percent(server.disk_used, server.disk_total); const usedTraffic = trafficUsed(server); @@ -135,7 +136,7 @@ export const NodeCard = memo(function NodeCard({ server, config, liveLatencyResu
- + 0 ? ui(locale, `CPU ${cpuCores} 核`, `CPU ${cpuCores} ${cpuCores === 1 ? "core" : "cores"}`) : "CPU"} value={`${number(server.cpu).toFixed(1)}%`} used={number(server.cpu)} sub={`${number(server.load1).toFixed(2)}, ${number(server.load5).toFixed(2)}, ${number(server.load15).toFixed(2)}`} muted={!online} /> 0 ? `${traffic.toFixed(1)}%` : "∞"} used={traffic} sub={`${formatBytes(usedTraffic)} / ${server.traffic_limit > 0 ? formatBytes(server.traffic_limit) : "∞"}`} muted={!online} /> diff --git a/frontend/src/styles/dashboard.css b/frontend/src/styles/dashboard.css index 531a169..8fbe808 100644 --- a/frontend/src/styles/dashboard.css +++ b/frontend/src/styles/dashboard.css @@ -71,7 +71,7 @@ .metric { display: flex; min-width: 0; flex-direction: column; gap: 4px; } .metric.muted { opacity: .55; } /* 固定行高:CJK 回退字体的 normal 行高大于拉丁文本,浮动行高会把进度条与下一行顶偏 */ -.metric > div { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; line-height: 16px; } +.metric > div { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; line-height: 16px; white-space: nowrap; } .metric span, .metric small { color: var(--muted-foreground); } .metric strong { font-weight: 500; font-variant-numeric: tabular-nums; } .metric small { overflow: hidden; font-size: 12px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; line-height: 14px; }