feat(audit): every row keeps its date; dividers for Today, Yesterday, Last 7 days, Older (#5214)
The operator found "Today 08:03" in place of a date odd on the audit log,
and asked for the recency groups as dividers instead. |when now always
writes the date ("Thu 8 Oct 08:03"); mark_day_groups gives each entry its
group in the reader's zone, and a divider row opens each group. A scrolled
page carries the group the last one ended in, so it is not opened twice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
from __future__ import annotations
|
||||
import json
|
||||
from quart import Blueprint, render_template, request, current_app
|
||||
from quart import Blueprint, render_template, request, current_app, session
|
||||
from sqlalchemy import select
|
||||
from steward.ansible.inventory_gen import scope_labels
|
||||
from steward.audit.service import AREAS, action_text, detail_facts, entity_labels
|
||||
from steward.audit.service import AREAS, action_text, detail_facts, entity_labels, mark_day_groups
|
||||
from steward.auth.middleware import require_role
|
||||
from steward.core import formatting as fmt
|
||||
from steward.core.paging import keyset, next_page
|
||||
from steward.models.audit import AuditEvent
|
||||
from steward.models.users import UserRole
|
||||
@@ -46,7 +47,9 @@ async def list_events():
|
||||
item["action"] = action_text(e.action)
|
||||
item["facts"] = detail_facts(item["detail"], scopes)
|
||||
|
||||
ctx = {"events": parsed, "after": after, "action_filter": action_filter, "areas": AREAS}
|
||||
last_group = mark_day_groups(parsed, fmt.zone(session.get("tz")), request.args.get("group", ""))
|
||||
ctx = {"events": parsed, "after": after, "action_filter": action_filter, "areas": AREAS,
|
||||
"last_group": last_group}
|
||||
if request.args.get("before"):
|
||||
return await render_template("audit/_rows.html", **ctx)
|
||||
return await render_template("audit/list.html", **ctx)
|
||||
|
||||
Reference in New Issue
Block a user