diff --git a/control/internal/web/ui.go b/control/internal/web/ui.go index 4946bf2..9ded025 100644 --- a/control/internal/web/ui.go +++ b/control/internal/web/ui.go @@ -1075,10 +1075,9 @@ func (u *UI) pageDashboard(w http.ResponseWriter, r *http.Request) { u.render(w, r, "dashboard", data) } -func (u *UI) pageConsole(w http.ResponseWriter, r *http.Request) { +func (u *UI) consolePageData() PageData { u.ensureDevicesLoaded() data := PageData{Title: "运行看板"} - data.Message = strings.TrimSpace(r.URL.Query().Get("msg")) devices := u.registry.GetDevices() data.Devices = devices @@ -1316,6 +1315,12 @@ func (u *UI) pageConsole(w http.ResponseWriter, r *http.Request) { data.ConsoleVideoSources = unassigned data.ConsoleAllVideoSources = allSources + return data +} + +func (u *UI) pageConsole(w http.ResponseWriter, r *http.Request) { + data := u.consolePageData() + data.Message = strings.TrimSpace(r.URL.Query().Get("msg")) u.render(w, r, "console", data) } @@ -5957,8 +5962,9 @@ func (u *UI) actionDeviceFaceGalleryReload(w http.ResponseWriter, r *http.Reques } func (u *UI) pageMonitor(w http.ResponseWriter, r *http.Request) { - u.ensureDevicesLoaded() - u.render(w, r, "monitor", PageData{Title: "视频监控", Devices: u.registry.GetDevices()}) + data := u.consolePageData() + data.Title = "视频监控" + u.render(w, r, "monitor", data) } func (u *UI) apiMonitorChannels(w http.ResponseWriter, r *http.Request) { diff --git a/control/internal/web/ui/templates/monitor.html b/control/internal/web/ui/templates/monitor.html index 647372c..18c9a0a 100644 --- a/control/internal/web/ui/templates/monitor.html +++ b/control/internal/web/ui/templates/monitor.html @@ -6,134 +6,105 @@
所有在线设备的实时画面
- +
-
加载中…
+ {{$hasCard := false}} + {{range $cd := .ConsoleDevices}}{{if $cd.Device.Online}}{{range $ch := $cd.Channels}} + {{$hasCard = true}} +
+
+ {{$cd.Device.DisplayName}} · {{if $ch.SourceName}}{{$ch.SourceName}}{{else}}{{$ch.Display}}{{end}} +
+ +
+ {{end}}{{end}}{{end}} + {{if not $hasCard}} +
暂无在线设备的视频通道
+ {{end}}
{{end}}