v0.15.3: Show all storage paths on dashboard/monitoring + fix hub report

This commit is contained in:
2026-02-19 09:06:59 +01:00
parent 426eaca04d
commit 215ba8a83d
6 changed files with 60 additions and 15 deletions
+9
View File
@@ -1,5 +1,14 @@
## Changelog ## 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) ### What was just completed (2026-02-19 session 52)
- **v0.15.2 — Fix data loss on container restart (2 bugs):** - **v0.15.2 — Fix data loss on container restart (2 bugs):**
+12 -7
View File
@@ -58,16 +58,21 @@ func BuildReport(
LoadAvg15: sysInfo.LoadAvg15, LoadAvg15: sysInfo.LoadAvg15,
} }
// Storage // Storage — root filesystem + all registered storage paths
r.Storage = []StorageReport{ 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{ r.Storage = append(r.Storage, StorageReport{
Mount: cfg.Paths.HDDPath, Mount: sp.Path,
TotalGB: sysInfo.HDDTotalGB, Label: sp.Label,
UsedGB: sysInfo.HDDUsedGB, TotalGB: di.TotalGB,
Percent: sysInfo.HDDPercent, UsedGB: di.UsedGB,
Percent: di.UsedPercent,
}) })
} }
+1
View File
@@ -38,6 +38,7 @@ type SystemReport struct {
// StorageReport holds disk usage for a mount point. // StorageReport holds disk usage for a mount point.
type StorageReport struct { type StorageReport struct {
Mount string `json:"mount"` Mount string `json:"mount"`
Label string `json:"label,omitempty"`
TotalGB float64 `json:"total_gb"` TotalGB float64 `json:"total_gb"`
UsedGB float64 `json:"used_gb"` UsedGB float64 `json:"used_gb"`
Percent float64 `json:"percent"` Percent float64 `json:"percent"`
+30
View File
@@ -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. // DeployStoragePath extends StoragePath with free space data for the deploy dropdown.
type DeployStoragePath struct { type DeployStoragePath struct {
settings.StoragePath settings.StoragePath
@@ -89,6 +117,7 @@ func (s *Server) dashboardHandler(w http.ResponseWriter, _ *http.Request) {
data["StoppedCount"] = stopped data["StoppedCount"] = stopped
data["TotalCount"] = len(stackList) data["TotalCount"] = len(stackList)
data["SystemInfo"] = sysInfo data["SystemInfo"] = sysInfo
data["StorageBars"] = s.buildStorageBars()
// Backup status // Backup status
data["BackupEnabled"] = s.cfg.Backup.Enabled 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) { func (s *Server) monitoringHandler(w http.ResponseWriter, _ *http.Request) {
data := s.baseData("monitoring", "Rendszermonitor") data := s.baseData("monitoring", "Rendszermonitor")
data["SystemInfo"] = system.GetInfo(s.primaryHDDPath(), s.cpuCollector) 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 // On monitoring page, exclude the "pings-missing" alert since the detailed table is visible
if s.alertManager != nil { if s.alertManager != nil {
@@ -65,14 +65,14 @@
<div class="system-bar-fill system-bar-{{usageColor .SystemInfo.DiskPercent}}" style="width:{{printf "%.0f" .SystemInfo.DiskPercent}}%"></div> <div class="system-bar-fill system-bar-{{usageColor .SystemInfo.DiskPercent}}" style="width:{{printf "%.0f" .SystemInfo.DiskPercent}}%"></div>
</div> </div>
</div> </div>
{{if .SystemInfo.HDDConfigured}} {{range .StorageBars}}
<div class="system-info-item"> <div class="system-info-item">
<div class="system-info-header"> <div class="system-info-header">
<span class="system-info-label">Külső HDD</span> <span class="system-info-label">{{.Label}}</span>
<span class="system-info-value">{{fmtGB .SystemInfo.HDDUsedGB}} / {{fmtGB .SystemInfo.HDDTotalGB}} ({{printf "%.0f" .SystemInfo.HDDPercent}}%)</span> <span class="system-info-value">{{fmtGB .UsedGB}} / {{fmtGB .TotalGB}} ({{printf "%.0f" .Percent}}%)</span>
</div> </div>
<div class="system-bar"> <div class="system-bar">
<div class="system-bar-fill system-bar-{{usageColor .SystemInfo.HDDPercent}}" style="width:{{printf "%.0f" .SystemInfo.HDDPercent}}%"></div> <div class="system-bar-fill system-bar-{{usageColor .Percent}}" style="width:{{printf "%.0f" .Percent}}%"></div>
</div> </div>
</div> </div>
{{end}} {{end}}
@@ -50,14 +50,14 @@
<div class="system-bar-fill {{usageColor .DiskPercent | printf "system-bar-%s"}}" style="width:{{printf "%.1f" .DiskPercent}}%"></div> <div class="system-bar-fill {{usageColor .DiskPercent | printf "system-bar-%s"}}" style="width:{{printf "%.1f" .DiskPercent}}%"></div>
</div> </div>
</div> </div>
{{if .HDDConfigured}} {{range $.StorageBars}}
<div class="storage-item"> <div class="storage-item">
<div class="storage-header"> <div class="storage-header">
<span class="storage-label">Külső HDD</span> <span class="storage-label">{{.Label}}</span>
<span class="storage-value">{{fmtGB .HDDUsedGB}} / {{fmtGB .HDDTotalGB}} ({{printf "%.0f" .HDDPercent}}%)</span> <span class="storage-value">{{fmtGB .UsedGB}} / {{fmtGB .TotalGB}} ({{printf "%.0f" .Percent}}%)</span>
</div> </div>
<div class="system-bar"> <div class="system-bar">
<div class="system-bar-fill {{usageColor .HDDPercent | printf "system-bar-%s"}}" style="width:{{printf "%.1f" .HDDPercent}}%"></div> <div class="system-bar-fill {{usageColor .Percent | printf "system-bar-%s"}}" style="width:{{printf "%.1f" .Percent}}%"></div>
</div> </div>
</div> </div>
{{end}} {{end}}