diff --git a/internal/web/ui/templates/monitor.html b/internal/web/ui/templates/monitor.html index 07caa3a..34d6563 100644 --- a/internal/web/ui/templates/monitor.html +++ b/internal/web/ui/templates/monitor.html @@ -22,7 +22,7 @@ function loadAll() { var devices = [ {{range .Devices}}{{if .Online}} - {id:"{{.DeviceID}}",name:"{{.DisplayName}}",ip:"{{.IP}}",media:"{{.MediaPort}}"}, + {id:"{{.DeviceID}}",name:"{{.DisplayName}}"}, {{end}}{{end}} ]; if (devices.length === 0) { @@ -33,12 +33,7 @@ function loadAll() { var promises = devices.map(function(dev) { return fetch('/ui/api/monitor/channels?device_id=' + encodeURIComponent(dev.id)) .then(function(r) { return r.json(); }) - .then(function(data) { - var chs = data.channels || []; - return chs.map(function(ch) { - return {device:dev.name, channel:ch.name, ip:dev.ip, media:dev.media}; - }); - }) + .then(function(data) { return (data.channels||[]).map(function(ch) { ch._dev = dev.name; return ch; }); }) .catch(function() { return []; }); }); @@ -52,11 +47,19 @@ function loadAll() { var cols = all.length <= 2 ? all.length : 2; wall.style.gridTemplateColumns = "repeat(" + cols + ",minmax(0,1fr))"; var html = ""; - all.forEach(function(item) { + all.forEach(function(ch) { html += '