feat(manager): notification bell, sign-in/venue/print settings, log download (platform-v2 2.6f)

- Bell in the header: /api/platform/notifications with unread count, live via
  the new LiveProvider (one createLiveClient connection) on platform_notification
  and reconnect; mark read / all; warning+critical pop a toast.
- Settings: Sign-in card (manager/waiter/device modes, require username, one
  session per manager/waiter, username autofill) replaces the dead v1
  security.login_method card; new "Venue & language" tab (language, time zone);
  print alert threshold in Printing. Tab labels are i18n keys.
- Technical > Log files: list + download of the daily logs (owner-level).
  Backend: GET /api/system/logs, /api/system/logs/{date} (core.settings.manage),
  error system.log_not_found.
- Setup wizard asks staff language and time zone (setup/init stores them).
- @xenia/ui theme helpers (applyTheme, getStoredTheme); the manager stays light
  until phase 6 converts the older pages (owner decision 2026-11-14).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 09:01:26 +02:00
co-authored by Claude Opus 5.5
parent 92bc1b0113
commit 2426ffddad
36 changed files with 995 additions and 92 deletions
+35
View File
@@ -0,0 +1,35 @@
"""Log download for the manager (plan step 2.6f): list + one day's file, owner-level."""
import pytest
from core import logging as xlog
@pytest.fixture
def logs(tmp_path, monkeypatch):
(tmp_path / "xenia-2026-11-13.log").write_text("2026-11-13T10:00:00.000Z INFO x [req=- user=- device=-] hello\n", encoding="utf-8")
(tmp_path / "xenia-2026-11-14.log").write_text("today\n", encoding="utf-8")
(tmp_path / "other.txt").write_text("not a log", encoding="utf-8")
monkeypatch.setattr(xlog, "log_dir", lambda: tmp_path)
return tmp_path
def test_list_and_download(client, make_user, login, logs):
h = login(make_user(role="owner"))
rows = client.get("/api/system/logs", headers=h).json()
assert [r["date"] for r in rows] == ["2026-11-14", "2026-11-13"] and rows[1]["size"] > 10
r = client.get("/api/system/logs/2026-11-13", headers=h)
assert r.status_code == 200 and "hello" in r.text
assert 'filename="xenia-2026-11-13.log"' in r.headers["content-disposition"]
def test_missing_and_bad_dates(client, make_user, login, logs):
h = login(make_user(role="owner"))
for d in ("2026-01-01", "..%2Fpos", "x"):
r = client.get(f"/api/system/logs/{d}", headers=h)
assert r.status_code == 404, (d, r.text)
assert client.get("/api/system/logs/2026-01-01", headers=h).json()["error"]["code"] == "system.log_not_found"
def test_needs_settings_permission(client, make_user, login, logs):
h = login(make_user(role="staff_manager"))
assert client.get("/api/system/logs", headers=h).json()["error"]["code"] == "access.denied"