Compare commits

..

No commits in common. "9324c6a4f489d01c405c55f8b03320ae62cc10e9" and "f792cf55f63d6036461a585d6a78041cbd96b9f0" have entirely different histories.

View File

@ -149,10 +149,9 @@ class AdminOverview {
'System',
sysKind,
this.line('Disk', disk.text || `${diskPct}%`)
+ this.line('Memory', mem.total
? `${this.gb(mem.used)} / ${this.gb(mem.total)} (${Math.round(mem.percent) || 0}%)`
: (mem.text || '—'))
+ this.line('Uptime', this.shortUptime(info.uptime)),
+ this.line('Memory', mem.text || '—')
+ this.line('Uptime', (info.uptime || '—').replace(/^up /, ''))
+ this.line('OS', info.os || '—'),
`<button type="button" class="backup-secondary-btn" data-admin-go="system">View system stats →</button>`
);
@ -181,22 +180,6 @@ class AdminOverview {
while (n >= 1024 && i < u.length - 1) { n /= 1024; i++; }
return `${n.toFixed(i ? 1 : 0)} ${u[i]}`;
}
// Compact gigabytes, e.g. 2030043136 → "1.9G", matching the Disk row's style.
gb(n) {
return `${((parseInt(n) || 0) / 1073741824).toFixed(1)}G`;
}
// "up 1 hour, 11 minutes" → "1h 11m".
shortUptime(u) {
return (u || '—')
.replace(/^up\s+/, '')
.replace(/\s*weeks?/g, 'w')
.replace(/\s*days?/g, 'd')
.replace(/\s*hours?/g, 'h')
.replace(/\s*minutes?/g, 'm')
.replace(/,/g, '');
}
}
window.AdminOverview = AdminOverview;