From 89a2b300b8384077d778de0d25f128eef4bea278 Mon Sep 17 00:00:00 2001 From: librelad Date: Thu, 28 May 2026 19:28:17 +0100 Subject: [PATCH] ux(overview): slim the System card to 3 compact rows Drop the OS row and compact Memory/Uptime so the System card matches the density of its sibling cards. Full detail stays on the deep system stats page. Co-Authored-By: Claude Opus 4.7 Signed-off-by: librelad --- .../js/components/admin/admin-overview.js | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/containers/libreportal/frontend/js/components/admin/admin-overview.js b/containers/libreportal/frontend/js/components/admin/admin-overview.js index bd9b4c3..478218b 100644 --- a/containers/libreportal/frontend/js/components/admin/admin-overview.js +++ b/containers/libreportal/frontend/js/components/admin/admin-overview.js @@ -149,9 +149,10 @@ class AdminOverview { 'System', sysKind, this.line('Disk', disk.text || `${diskPct}%`) - + this.line('Memory', mem.text || '—') - + this.line('Uptime', (info.uptime || '—').replace(/^up /, '')) - + this.line('OS', info.os || '—'), + + 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)), `` ); @@ -180,6 +181,22 @@ 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;