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
Showing only changes of commit 2562b2c7b5 - Show all commits
@@ -87,3 +87,37 @@ func TestUIRepoTrend_InvalidRangeFallsBackTo30d(t *testing.T) {
t.Errorf("expected data-range=30d on invalid range fallback")
}
}
// TestUIRepoPageRendersTrendPanel — full-page render path: seed 3
// history rows, fetch /hosts/{id}/repo, assert the Trend panel with
// SVG chart ID, class, and heading text appear embedded in the page.
func TestUIRepoPageRendersTrendPanel(t *testing.T) {
t.Parallel()
_, baseURL, st := newTestServerWithUI(t)
cookie := loginAsAdmin(t, st)
hostID := makeHost(t, st, "h-trend-page")
ctx := context.Background()
now := time.Now().UTC()
for i := 0; i < 3; i++ {
day := now.AddDate(0, 0, -i).Format("2006-01-02")
v := int64(2000 + i*200)
c := int64(20 + i)
if err := st.UpsertHostRepoStatsHistory(ctx, hostID, day,
store.HostRepoStats{TotalSizeBytes: &v, SnapshotCount: &c}, now); err != nil {
t.Fatalf("seed %s: %v", day, err)
}
}
body := getRepoPage(t, baseURL, hostID, cookie)
if !strings.Contains(body, `id="repo-trend-chart"`) {
t.Errorf("expected id=\"repo-trend-chart\" in full-page render")
}
if !strings.Contains(body, `class="repo-trend-chart"`) {
t.Errorf("expected class=\"repo-trend-chart\" in full-page render")
}
if !strings.Contains(body, ">Trend<") {
t.Errorf("expected panel heading '>Trend<' in full-page render")
}
}