Dashboard: modular read-only overview page, stored in the config; UI cleanup

Modules are added and moved by drag and drop. Cleanup: no sideways jump between
pages, mixer strips stay together with few channels, equal card heights, compact
limiter cards without an amplifier, wider test meters, scrollable bottom bar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GivouandClaude Opus 5.5 committed 2026-11-02 17:23:36 +01:00
1 parent 5597fae3f3
commit 2ea9fa32bc
8 files changed
+502 -19

No files matched your search

+36 -3
View File
@@ -144,6 +144,27 @@ def clean_soundfield(data) -> dict:
}
DASH_TYPES = ("status", "meters", "mixer", "curve", "channel", "limiter", "routing", "delays", "fir", "notes")
def clean_dashboard(data) -> dict | None:
"""Modules of the dashboard page; None = never edited (the app shows a default page)."""
if not isinstance(data, dict) or not isinstance(data.get("modules"), list):
return None
modules = []
for m in data["modules"][:40]:
if not isinstance(m, dict) or m.get("type") not in DASH_TYPES:
continue
src = m.get("cfg") if isinstance(m.get("cfg"), dict) else {}
cfg = {"device": str(src.get("device") or "")[:64], "title": str(src.get("title") or "")[:40],
"kind": "out" if src.get("kind") == "out" else "in", "idx": int(_num(src.get("idx"), 0, 15, 0)),
"text": str(src.get("text") or "")[:2000]}
w = int(_num(m.get("w"), 3, 12, 4))
modules.append({"id": re.sub(r"[^\w-]", "", str(m.get("id") or ""))[:32] or uuid.uuid4().hex[:8], "type": m["type"],
"w": w if w in (3, 4, 6, 8, 12) else 4, "cfg": cfg})
return {"modules": modules}
def clean_colors(v) -> dict:
"""Channel colours: {"in0": "#rrggbb", "out3": ...}. Linked channels carry their group's colour; that a colour
belongs to one channel/group only is ensured by the colour picker (it knows the link groups)."""
@@ -202,6 +223,7 @@ class App:
self.failures: dict[str, tuple[int, float]] = {} # ip -> (failed attempts, locked until)
self.limiter: dict = clean_limiter({})
self.soundfield: dict = clean_soundfield({})
self.dashboard: dict | None = None
self.logo = ""
# desktop app: its own window logs in with a one-time token, other devices need the PIN
self.app_token: str | None = None
@@ -249,6 +271,8 @@ class App:
self.limiter = clean_limiter(cfg.get("limiter") or {})
if "soundfield" in cfg:
self.soundfield = clean_soundfield(cfg.get("soundfield"))
if "dashboard" in cfg:
self.dashboard = clean_dashboard(cfg.get("dashboard"))
if "logo" in cfg:
self.logo = clean_logo(cfg.get("logo"))
r = cfg.get("remote") or {}
@@ -264,7 +288,8 @@ class App:
"""App backup: devices, PIN (hashed), amplifiers/limiter data, remote access - no logins."""
return {"format": CONFIG_FORMAT, "version": 1, "exported": time.strftime("%Y-%m-%dT%H:%M:%S"),
"devices": [d.config() for d in self.real_devices()], "auth": self.auth,
"limiter": self.limiter, "remote": self.remote, "soundfield": self.soundfield, "logo": self.logo}
"limiter": self.limiter, "remote": self.remote, "soundfield": self.soundfield, "logo": self.logo,
"dashboard": self.dashboard}
async def restore_config(self, doc: dict, session: str):
if not isinstance(doc, dict) or doc.get("format") != CONFIG_FORMAT:
@@ -322,7 +347,7 @@ class App:
sessions = {k: v for k, v in self.sessions.items() if k not in self.app_sessions}
cfg = {"devices": [d.config() for d in self.real_devices()], "auth": self.auth,
"sessions": sessions, "limiter": self.limiter, "remote": self.remote, "locked": self.locked,
"soundfield": self.soundfield, "logo": self.logo,
"soundfield": self.soundfield, "logo": self.logo, "dashboard": self.dashboard,
"mute_all": {"active": self.mute_all["active"],
"restore": {k: v for k, v in self.mute_all["restore"].items() if k != "demo"}}}
if self.lang:
@@ -801,6 +826,13 @@ class App:
return {"logo": self.logo}
if path == "/api/logo":
return {"logo": self.logo}
if path == "/api/dashboard" and method == "PUT":
self.dashboard = clean_dashboard(body)
self.save()
self.broadcast({"type": "dashboard", "data": self.dashboard})
return self.dashboard
if path == "/api/dashboard":
return self.dashboard
if path == "/api/soundfield" and method == "PUT":
self.soundfield = clean_soundfield(body)
self.save()
@@ -1108,7 +1140,8 @@ class App:
self.clients.add(q)
try:
hello = {"type": "hello", "devices": [d.snapshot() for d in self.devices.values()], "limiter": self.limiter,
"demo": self.demo_info(), "muteall": self.mute_all_info(), "soundfield": self.soundfield, "logo": self.logo}
"demo": self.demo_info(), "muteall": self.mute_all_info(), "soundfield": self.soundfield, "logo": self.logo,
"dashboard": self.dashboard}
writer.write(f"data: {json.dumps(hello)}\n\n".encode())
await writer.drain()
while True: