feat(ui): audit log, alert history and Ansible runs load as you scroll (#5211)
#5211 "Lists load as you scroll: audit, alert history, Ansible runs" (milestone 477), per preference 172. - core/paging.py: keyset paging over (time, id), newest first, with an opaque "<iso>|<id>" cursor; a page reads one row past itself to know whether another follows. No OFFSET, so rows added while someone scrolls never shift the pages after them. - _macros.html scroll_more / scroll_end and static/scroll-more.js, written once: an IntersectionObserver with a 600px margin fetches the next page before the reader reaches the end; "Loading more…" while in flight, "End of the list." at the end, and a failed page says so with a Retry button instead of re-firing on every scroll. - Audit log: no "Load more" link and no 500-row cap. - Alert history: no 200-row stop with "pick a shorter range"; alert_svc.history takes the cursor, so the MCP tool and the page share one query. - Ansible runs: no silent cap of 50. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -39,7 +39,20 @@ async def test_the_page_names_and_links_the_entity(app):
|
||||
"entity": {"label": "api check", "url": None, "gone": True}},
|
||||
]
|
||||
async with app.test_request_context("/audit/"):
|
||||
page = await render_template("audit/list.html", events=events, limit=200, action_filter="")
|
||||
page = await render_template("audit/list.html", events=events, after=None, action_filter="")
|
||||
assert '<a href="/hosts/h1">web-1</a>' in page
|
||||
assert "api check" in page and "(deleted)" in page
|
||||
assert "h1</td>" not in page # no bare id where a name is known
|
||||
|
||||
|
||||
|
||||
async def test_the_log_continues_itself_instead_of_a_load_more_link(app):
|
||||
events = [{"event": _ev("host", "h1", "host.renamed"), "detail": {}, "entity": None}]
|
||||
async with app.test_request_context("/audit/"):
|
||||
more = await render_template("audit/list.html", events=events,
|
||||
after="2026-10-07T03:00:00+00:00|0190abc", action_filter="host.")
|
||||
last = await render_template("audit/_rows.html", events=events, after=None, action_filter="")
|
||||
assert ('data-scroll-more hx-get="/audit/?before=2026-10-07T03%3A00%3A00%2B00%3A00%7C0190abc'
|
||||
'&action=host."') in more
|
||||
assert "Load more" not in more
|
||||
assert "data-scroll-more" not in last and "End of the list." in last
|
||||
|
||||
Reference in New Issue
Block a user