diff --git a/dashboard/src/pages/Home.tsx b/dashboard/src/pages/Home.tsx index c3be64a..ee1399b 100644 --- a/dashboard/src/pages/Home.tsx +++ b/dashboard/src/pages/Home.tsx @@ -39,14 +39,6 @@ function formatUptime(seconds: number) { return `${m} 分钟` } -function formatBytes(bytes: number) { - if (!bytes || bytes <= 0) return '0 B' - const units = ['B', 'KB', 'MB', 'GB', 'TB'] - const i = Math.min(units.length - 1, Math.floor(Math.log(bytes) / Math.log(1024))) - const value = bytes / 1024 ** i - return `${value >= 10 ? Math.round(value) : value.toFixed(1)} ${units[i]}` -} - function UsageBar({ percent }: { percent: number }) { return (
- {stats.cpu.model || '未知型号'} · {stats.cpu.cores} 核 -
- {formatBytes(stats.memory.used)} / {formatBytes(stats.memory.total)} -