From c4dc9e911959304cceecdda35f1f4dcc785e991b Mon Sep 17 00:00:00 2001 From: Steve Cliff Date: Thu, 7 May 2026 22:55:21 +0100 Subject: [PATCH] =?UTF-8?q?ui+store:=20dashboard=20polish=20=E2=80=94=20re?= =?UTF-8?q?po=20size=20projection=20+=20header=20alignment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Project total_size_bytes onto hosts.repo_size_bytes inside the UpsertHostRepoStats transaction. The hosts row column has been unwritten since the initial schema in 0001, so the dashboard's Repo size cell has always rendered '—' even after backups. Now the column updates atomically alongside the host_repo_stats row, and FleetSummary's SUM(repo_size_bytes) becomes accurate too. - Right-align the Alerts column header so it sits over its right-aligned value (was floating left of column, ambiguous). - Add text-ink-mid to the 30d trend / Alerts / Tags headers so all column headers share the same brightness. --- internal/store/host_repo_stats.go | 15 +++++++++++++++ web/templates/pages/dashboard.html | 6 +++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/internal/store/host_repo_stats.go b/internal/store/host_repo_stats.go index 9889b29..681788f 100644 --- a/internal/store/host_repo_stats.go +++ b/internal/store/host_repo_stats.go @@ -211,6 +211,21 @@ func (s *Store) UpsertHostRepoStats(ctx context.Context, hostID string, patch Ho ); err != nil { return fmt.Errorf("store: upsert host_repo_stats: %w", err) } + + // Project total_size_bytes onto the dashboard's host row so the + // "Repo size" column and FleetSummary.SUM(repo_size_bytes) stay in + // sync with the latest report. We only write a non-nil size — a + // patch that doesn't carry a size (e.g. a prune-only ack) leaves + // the prior row value alone. + if cur.TotalSizeBytes != nil { + if _, err = tx.ExecContext(ctx, + `UPDATE hosts SET repo_size_bytes = ? WHERE id = ?`, + *cur.TotalSizeBytes, hostID, + ); err != nil { + return fmt.Errorf("store: project repo_size_bytes onto hosts row: %w", err) + } + } + return tx.Commit() } diff --git a/web/templates/pages/dashboard.html b/web/templates/pages/dashboard.html index 5a8587d..e95ff78 100644 --- a/web/templates/pages/dashboard.html +++ b/web/templates/pages/dashboard.html @@ -213,10 +213,10 @@
OS · arch{{if eq $f.Sort "os"}} {{if eq $f.Dir "desc"}}↓{{else}}↑{{end}}{{end}}
Last backup{{if eq $f.Sort "last_backup"}} {{if eq $f.Dir "desc"}}↓{{else}}↑{{end}}{{end}}
Repo size{{if eq $f.Sort "repo_size"}} {{if eq $f.Dir "desc"}}↓{{else}}↑{{end}}{{end}}
-
30d trend
+
30d trend
Snapshots{{if eq $f.Sort "snapshot_count"}} {{if eq $f.Dir "desc"}}↓{{else}}↑{{end}}{{end}}
-
Alerts
-
Tags
+
Alerts
+
Tags