v0.15.3: Show all storage paths on dashboard/monitoring + fix hub report
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user