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
+12 -7
View File
@@ -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,
})
}
+1
View File
@@ -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"`
+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.
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 {
@@ -65,14 +65,14 @@
<div class="system-bar-fill system-bar-{{usageColor .SystemInfo.DiskPercent}}" style="width:{{printf "%.0f" .SystemInfo.DiskPercent}}%"></div>
</div>
</div>
{{if .SystemInfo.HDDConfigured}}
{{range .StorageBars}}
<div class="system-info-item">
<div class="system-info-header">
<span class="system-info-label">Külső HDD</span>
<span class="system-info-value">{{fmtGB .SystemInfo.HDDUsedGB}} / {{fmtGB .SystemInfo.HDDTotalGB}} ({{printf "%.0f" .SystemInfo.HDDPercent}}%)</span>
<span class="system-info-label">{{.Label}}</span>
<span class="system-info-value">{{fmtGB .UsedGB}} / {{fmtGB .TotalGB}} ({{printf "%.0f" .Percent}}%)</span>
</div>
<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>
{{end}}
@@ -50,14 +50,14 @@
<div class="system-bar-fill {{usageColor .DiskPercent | printf "system-bar-%s"}}" style="width:{{printf "%.1f" .DiskPercent}}%"></div>
</div>
</div>
{{if .HDDConfigured}}
{{range $.StorageBars}}
<div class="storage-item">
<div class="storage-header">
<span class="storage-label">Külső HDD</span>
<span class="storage-value">{{fmtGB .HDDUsedGB}} / {{fmtGB .HDDTotalGB}} ({{printf "%.0f" .HDDPercent}}%)</span>
<span class="storage-label">{{.Label}}</span>
<span class="storage-value">{{fmtGB .UsedGB}} / {{fmtGB .TotalGB}} ({{printf "%.0f" .Percent}}%)</span>
</div>
<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>
{{end}}