P6-03 repo size trend + agent-update UI fix + dashboard polish #21

Merged
steve merged 17 commits from tidy-up-last-backup-projection into main 2026-05-07 23:00:04 +01:00
2 changed files with 18 additions and 3 deletions
Showing only changes of commit c4dc9e9119 - Show all commits
+15
View File
@@ -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()
}
+3 -3
View File
@@ -213,10 +213,10 @@
<div><a href="{{index $sortURL "os"}}" class="text-ink-mid hover:text-ink">OS · arch{{if eq $f.Sort "os"}} {{if eq $f.Dir "desc"}}↓{{else}}↑{{end}}{{end}}</a></div>
<div><a href="{{index $sortURL "last_backup"}}" class="text-ink-mid hover:text-ink">Last backup{{if eq $f.Sort "last_backup"}} {{if eq $f.Dir "desc"}}↓{{else}}↑{{end}}{{end}}</a></div>
<div class="text-right"><a href="{{index $sortURL "repo_size"}}" class="text-ink-mid hover:text-ink">Repo size{{if eq $f.Sort "repo_size"}} {{if eq $f.Dir "desc"}}↓{{else}}↑{{end}}{{end}}</a></div>
<div>30d trend</div>
<div class="text-ink-mid">30d trend</div>
<div class="text-right"><a href="{{index $sortURL "snapshot_count"}}" class="text-ink-mid hover:text-ink">Snapshots{{if eq $f.Sort "snapshot_count"}} {{if eq $f.Dir "desc"}}↓{{else}}↑{{end}}{{end}}</a></div>
<div>Alerts</div>
<div>Tags</div>
<div class="text-ink-mid text-right">Alerts</div>
<div class="text-ink-mid">Tags</div>
<div></div>
</div>