From 215ba8a83d9104f2e25d22fbd6624593e6417323 Mon Sep 17 00:00:00 2001 From: kisfenyo Date: Thu, 19 Feb 2026 09:06:59 +0100 Subject: [PATCH] v0.15.3: Show all storage paths on dashboard/monitoring + fix hub report --- CHANGELOG.md | 9 ++++++ controller/internal/report/builder.go | 19 +++++++----- controller/internal/report/types.go | 1 + controller/internal/web/handlers.go | 30 +++++++++++++++++++ .../internal/web/templates/dashboard.html | 8 ++--- .../internal/web/templates/monitoring.html | 8 ++--- 6 files changed, 60 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b62730..01a923d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ ## Changelog +### What was just completed (2026-02-19 session 53) +- **v0.15.3 — Show all storage paths on dashboard + fix hub report:** + + Dashboard ("Vezérlőpult") and monitoring ("Rendszermonitor") pages now show usage bars for ALL registered storage paths instead of just one hardcoded "Külső HDD" bar. New `StorageBarInfo` type and `buildStorageBars()` helper build bars from `settings.GetStoragePaths()`. Each bar shows the storage label and live disk usage. + + Hub storage report now correctly includes all registered storage paths with proper mount paths and labels. Previously it sent only root `/` plus one HDD entry using the deprecated (empty) `cfg.Paths.HDDPath`. Now uses `system.GetDiskUsage()` per storage path, same as the dashboard bars. Added `Label` field to `StorageReport` in `types.go`. + + **Files modified (5):** `internal/web/handlers.go`, `internal/web/templates/dashboard.html`, `internal/web/templates/monitoring.html`, `internal/report/builder.go`, `internal/report/types.go` + ### What was just completed (2026-02-19 session 52) - **v0.15.2 — Fix data loss on container restart (2 bugs):** diff --git a/controller/internal/report/builder.go b/controller/internal/report/builder.go index 817590a..064a63b 100644 --- a/controller/internal/report/builder.go +++ b/controller/internal/report/builder.go @@ -58,16 +58,21 @@ func BuildReport( LoadAvg15: sysInfo.LoadAvg15, } - // Storage + // Storage — root filesystem + all registered storage paths r.Storage = []StorageReport{ - {Mount: "/", TotalGB: sysInfo.DiskTotalGB, UsedGB: sysInfo.DiskUsedGB, Percent: sysInfo.DiskPercent}, + {Mount: "/", Label: "SSD", TotalGB: sysInfo.DiskTotalGB, UsedGB: sysInfo.DiskUsedGB, Percent: sysInfo.DiskPercent}, } - if sysInfo.HDDConfigured { + for _, sp := range storagePaths { + di := system.GetDiskUsage(sp.Path) + if di == nil { + continue + } r.Storage = append(r.Storage, StorageReport{ - Mount: cfg.Paths.HDDPath, - TotalGB: sysInfo.HDDTotalGB, - UsedGB: sysInfo.HDDUsedGB, - Percent: sysInfo.HDDPercent, + Mount: sp.Path, + Label: sp.Label, + TotalGB: di.TotalGB, + UsedGB: di.UsedGB, + Percent: di.UsedPercent, }) } diff --git a/controller/internal/report/types.go b/controller/internal/report/types.go index 9ac6709..463b884 100644 --- a/controller/internal/report/types.go +++ b/controller/internal/report/types.go @@ -38,6 +38,7 @@ type SystemReport struct { // StorageReport holds disk usage for a mount point. type StorageReport struct { Mount string `json:"mount"` + Label string `json:"label,omitempty"` TotalGB float64 `json:"total_gb"` UsedGB float64 `json:"used_gb"` Percent float64 `json:"percent"` diff --git a/controller/internal/web/handlers.go b/controller/internal/web/handlers.go index 04eedeb..2a1146c 100644 --- a/controller/internal/web/handlers.go +++ b/controller/internal/web/handlers.go @@ -20,6 +20,34 @@ import ( ) +// StorageBarInfo holds data for rendering a storage usage bar on dashboard/monitoring. +type StorageBarInfo struct { + Label string // e.g., "USB HDD 1TB", "SYS Storage 350G" + Path string // e.g., "/mnt/hdd_1" + TotalGB float64 + UsedGB float64 + Percent float64 +} + +// buildStorageBars returns usage bars for all registered storage paths. +func (s *Server) buildStorageBars() []StorageBarInfo { + var bars []StorageBarInfo + for _, sp := range s.settings.GetStoragePaths() { + di := system.GetDiskUsage(sp.Path) + if di == nil { + continue + } + bars = append(bars, StorageBarInfo{ + Label: sp.Label, + Path: sp.Path, + TotalGB: di.TotalGB, + UsedGB: di.UsedGB, + Percent: di.UsedPercent, + }) + } + return bars +} + // DeployStoragePath extends StoragePath with free space data for the deploy dropdown. type DeployStoragePath struct { settings.StoragePath @@ -89,6 +117,7 @@ func (s *Server) dashboardHandler(w http.ResponseWriter, _ *http.Request) { data["StoppedCount"] = stopped data["TotalCount"] = len(stackList) data["SystemInfo"] = sysInfo + data["StorageBars"] = s.buildStorageBars() // Backup status data["BackupEnabled"] = s.cfg.Backup.Enabled @@ -363,6 +392,7 @@ func (s *Server) appDetailHandler(w http.ResponseWriter, r *http.Request, slug s func (s *Server) monitoringHandler(w http.ResponseWriter, _ *http.Request) { data := s.baseData("monitoring", "Rendszermonitor") data["SystemInfo"] = system.GetInfo(s.primaryHDDPath(), s.cpuCollector) + data["StorageBars"] = s.buildStorageBars() // On monitoring page, exclude the "pings-missing" alert since the detailed table is visible if s.alertManager != nil { diff --git a/controller/internal/web/templates/dashboard.html b/controller/internal/web/templates/dashboard.html index 08bc5e9..83598d3 100644 --- a/controller/internal/web/templates/dashboard.html +++ b/controller/internal/web/templates/dashboard.html @@ -65,14 +65,14 @@
- {{if .SystemInfo.HDDConfigured}} + {{range .StorageBars}}
- Külső HDD - {{fmtGB .SystemInfo.HDDUsedGB}} / {{fmtGB .SystemInfo.HDDTotalGB}} ({{printf "%.0f" .SystemInfo.HDDPercent}}%) + {{.Label}} + {{fmtGB .UsedGB}} / {{fmtGB .TotalGB}} ({{printf "%.0f" .Percent}}%)
-
+
{{end}} diff --git a/controller/internal/web/templates/monitoring.html b/controller/internal/web/templates/monitoring.html index 13f9869..8171349 100644 --- a/controller/internal/web/templates/monitoring.html +++ b/controller/internal/web/templates/monitoring.html @@ -50,14 +50,14 @@
- {{if .HDDConfigured}} + {{range $.StorageBars}}
- Külső HDD - {{fmtGB .HDDUsedGB}} / {{fmtGB .HDDTotalGB}} ({{printf "%.0f" .HDDPercent}}%) + {{.Label}} + {{fmtGB .UsedGB}} / {{fmtGB .TotalGB}} ({{printf "%.0f" .Percent}}%)
-
+
{{end}}