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:
@@ -84,3 +84,20 @@
|
||||
{%- if kwargs.get('confirm') %} data-confirm="{{ kwargs.confirm }}"{% endif %}>{{ icon }}</button>
|
||||
{%- endif -%}
|
||||
{%- endmacro %}
|
||||
|
||||
{# A list that continues itself (#5211, pref 172; static/scroll-more.js).
|
||||
scroll_more ends a page while there are more rows: it fetches `url` (the
|
||||
next page, built with core.paging's cursor) when it comes near the
|
||||
viewport, and is replaced by that page's rows. scroll_end ends the last
|
||||
page. Pass `cols` inside a table body, to render as a full-width row. #}
|
||||
{% macro scroll_more(url, cols=none) -%}
|
||||
{%- if cols %}<tr data-scroll-more hx-get="{{ url }}" hx-trigger="scroll-more" hx-swap="outerHTML"><td colspan="{{ cols }}">
|
||||
{%- else %}<div data-scroll-more hx-get="{{ url }}" hx-trigger="scroll-more" hx-swap="outerHTML">{% endif -%}
|
||||
<span class="field-hint" role="status" aria-live="polite" data-scroll-status>Loading more…</span>
|
||||
{%- if cols %}</td></tr>{% else %}</div>{% endif %}
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro scroll_end(cols=none, text="End of the list.") -%}
|
||||
{%- if cols %}<tr><td colspan="{{ cols }}"><span class="field-hint" role="status">{{ text }}</span></td></tr>
|
||||
{%- else %}<p class="field-hint" role="status">{{ text }}</p>{% endif %}
|
||||
{%- endmacro %}
|
||||
|
||||
Reference in New Issue
Block a user