v0.149.0 — F3: the dashboard backup card tells the truth about the last run
The card claimed "Utolsó mentés: Még nem futott" on every box, forever, even
with dumps on disk and db_dump_completed events in the hub. dashboard.html
branches on {{if .BackupStatus}} and reads .Success/.LastRun, but
dashboardHandler never set that key — so the {{if}} arm was unreachable and
the "never ran" else-branch rendered unconditionally. The neighbouring
"Adatbázisok: N mentve" row kept working because it reads DBDumpStatus, which
was passed; that is the contradiction the audit caught on the live box.
Fix is the one-line pass-through the template always expected:
data["BackupStatus"] = fullStatus.LastDBDump. *DBDumpStatus nil/non-nil maps
onto the template's branch, so a fresh box still reads "Még nem futott" and no
zero-value timestamp is fabricated. No template change, no new view-model.
Tests drive the real handler through ServeHTTP so they bite on the handler
wiring, not the template alone. Red-proofed: deleting the assignment fails
TestDashboardBackupCard_ShowsLastRun.
Origin: felhom.eu/documentation/audits/AUDIT-vacation-remote-ops-2026-07-20.md (F3)
This commit is contained in:
@@ -174,6 +174,11 @@ func (s *Server) dashboardHandler(w http.ResponseWriter, r *http.Request) {
|
||||
nextDBDump := scheduler.NextDailyRun(s.cfg.Backup.DBDumpSchedule)
|
||||
fullStatus := s.backupMgr.GetFullStatus(nextDBDump)
|
||||
data["DBDumpStatus"] = fullStatus.LastDBDump
|
||||
// F3 (AUDIT-vacation-remote-ops-2026-07-20): the card's "Utolsó mentés" row branches on
|
||||
// .BackupStatus, which was never passed — so the {{if}} arm was unreachable and EVERY box
|
||||
// rendered "Még nem futott" regardless of history. *DBDumpStatus nil/non-nil maps exactly
|
||||
// onto the template's branch, so a fresh box still reads "Még nem futott" honestly.
|
||||
data["BackupStatus"] = fullStatus.LastDBDump
|
||||
data["BackupRunning"] = fullStatus.Running
|
||||
data["BackupMaxAgeHours"] = s.cfg.Monitoring.Thresholds.BackupMaxAgeHours
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user