diff --git a/internal/service/model_management.go b/internal/service/model_management.go index 8f94b84..6ae6630 100644 --- a/internal/service/model_management.go +++ b/internal/service/model_management.go @@ -38,6 +38,7 @@ type ModelStatusCell struct { type ModelStatusRow struct { DeviceID string `json:"device_id"` DeviceName string `json:"device_name"` + DeviceIP string `json:"device_ip"` Online bool `json:"online"` NeedsSync bool `json:"needs_sync"` Cells []ModelStatusCell `json:"cells"` @@ -175,6 +176,7 @@ func BuildModelStatusBoard(standardModels []storage.StandardModelRecord, devices row := ModelStatusRow{ DeviceID: device.DeviceID, DeviceName: device.DisplayName(), + DeviceIP: device.IP, Online: device.Online, Cells: make([]ModelStatusCell, 0, len(standardModels)), ExtraModels: make([]InstalledModelStatus, 0), diff --git a/internal/service/registry.go b/internal/service/registry.go index b4d16f8..724a93f 100644 --- a/internal/service/registry.go +++ b/internal/service/registry.go @@ -2,6 +2,7 @@ package service import ( "encoding/json" + "sort" "strings" "sync" "time" @@ -158,6 +159,12 @@ func (s *RegistryService) GetDevices() []*models.Device { for _, dev := range s.devices { list = append(list, dev) } + sort.Slice(list, func(i, j int) bool { + if list[i].IP != list[j].IP { + return list[i].IP < list[j].IP + } + return list[i].DisplayName() < list[j].DisplayName() + }) return list } diff --git a/internal/web/ui/templates/models.html b/internal/web/ui/templates/models.html index cb70912..e55e3ce 100644 --- a/internal/web/ui/templates/models.html +++ b/internal/web/ui/templates/models.html @@ -87,7 +87,7 @@
{{.DeviceName}}
-
{{.DeviceID}}
+
{{.DeviceIP}}
{{range .Cells}} diff --git a/internal/web/ui/templates/resources.html b/internal/web/ui/templates/resources.html index 29dbe2d..a53983d 100644 --- a/internal/web/ui/templates/resources.html +++ b/internal/web/ui/templates/resources.html @@ -85,7 +85,7 @@
{{.DeviceName}}
-
{{.DeviceID}}
+
{{.DeviceIP}}
{{range .Cells}} diff --git a/safesightd-linux-arm64 b/safesightd-linux-arm64 index f13288c..f45de98 100644 Binary files a/safesightd-linux-arm64 and b/safesightd-linux-arm64 differ