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:
@@ -277,3 +277,30 @@ class RequestContextMiddleware:
|
||||
lvl = logging.WARNING if (code or 500) >= 500 else logging.INFO
|
||||
_http_log.log(lvl, "http %s %s status=%s ms=%d", method, scope.get("path"), code, ms)
|
||||
_ctx.reset(token)
|
||||
|
||||
|
||||
# ── download (plan step 2.6f) ────────────────────────────────────────────────
|
||||
|
||||
def log_dir() -> Path:
|
||||
"""Where the daily files are: the active handler's folder, else the default."""
|
||||
return _file_handler.directory if _file_handler is not None else default_log_dir()
|
||||
|
||||
|
||||
def list_log_files(directory: Path | None = None) -> list[dict]:
|
||||
"""[{date, name, size}] newest first, for the manager's log download."""
|
||||
d = directory or log_dir()
|
||||
out = []
|
||||
if d.is_dir():
|
||||
for f in d.glob(f"{FILE_PREFIX}*.log"):
|
||||
m = _FILE_RE.match(f.name)
|
||||
if m:
|
||||
out.append({"date": m.group(1), "name": f.name, "size": f.stat().st_size})
|
||||
return sorted(out, key=lambda x: x["date"], reverse=True)
|
||||
|
||||
|
||||
def log_file_for(date_str: str, directory: Path | None = None) -> Path | None:
|
||||
"""The file of one UTC day, or None (bad date or no file). Only names we write."""
|
||||
if not re.fullmatch(r"\d{4}-\d{2}-\d{2}", date_str or ""):
|
||||
return None
|
||||
f = (directory or log_dir()) / f"{FILE_PREFIX}{date_str}.log"
|
||||
return f if f.is_file() else None
|
||||
|
||||
Reference in New Issue
Block a user