feat(audit): /logs page — view + download recent audit log files
Adds a Streamlit page at ``/logs`` listing every
``datatools-*.jsonl`` file in ``audit_log_dir()`` (7-day window
per the retention sweep in b3ae913). Each entry shows filename,
mtime, byte size, and a ``st.download_button``. Today's file
gets its own section at the top.
The page also surfaces both paths as copyable monospace text:
the active log path (so users can grep/cat it directly on their
machine) and the folder path (so they can paste into Explorer /
Finder).
Wired into navigation via ``st.Page("pages/_Logs.py", ...)`` with
``url_path="logs"``. The sidebar entry is hidden by the same
``hide_streamlit_chrome`` CSS rule that hides ``/activate`` and
``/close`` — same pattern, same ``:has()`` + plain-fallback
selectors so the LinkContainer collapses cleanly in modern
browsers and the anchor is at least un-clickable in older ones.
License gate is OFF for this page (``gate_license=False``) — if a
user's license expires they may need logs to file a support
request; locking them out of their own audit history would be
hostile.
Next commit will wire the popover link.
Rollback: ``git revert HEAD`` removes the page and its nav entry;
the audit log itself keeps working.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -116,6 +116,12 @@ def _build_navigation() -> dict[str, list]:
|
||||
icon=":material/key:",
|
||||
url_path="activate",
|
||||
)
|
||||
logs = st.Page(
|
||||
"pages/_Logs.py",
|
||||
title="Logs",
|
||||
icon=":material/description:",
|
||||
url_path="logs",
|
||||
)
|
||||
close = st.Page(
|
||||
"pages/99_Close.py",
|
||||
title=_t("nav.close_title") or "Close",
|
||||
@@ -129,7 +135,7 @@ def _build_navigation() -> dict[str, list]:
|
||||
# ``href``, leaving Home visible and no orphan section header /
|
||||
# drilldown marker in the sidebar.
|
||||
return {
|
||||
"": [home, activate, close],
|
||||
"": [home, activate, logs, close],
|
||||
section_label("cleaners"): by_section["cleaners"],
|
||||
section_label("transformations"): by_section["transformations"],
|
||||
section_label("automations"): by_section["automations"],
|
||||
|
||||
Reference in New Issue
Block a user