refactor(centralui): AuditResultsGrid adopts KeysetPager + AuditFilterBar adopts DateTimeRangeFilter (T35g)

This commit is contained in:
Joseph Doherty
2026-06-18 20:03:40 -04:00
parent a3ac77dd41
commit 1d82e6bc8c
3 changed files with 26 additions and 31 deletions
@@ -91,18 +91,17 @@
<div class="col-auto" data-test="filter-custom-range">
@if (_model.TimeRange == AuditTimeRangePreset.Custom)
{
<div class="d-flex gap-1 align-items-end">
<div>
<label class="form-label small mb-1" for="audit-from">From (UTC)</label>
<input id="audit-from" type="datetime-local" class="form-control form-control-sm"
@bind="_model.CustomFromUtc" />
</div>
<div>
<label class="form-label small mb-1" for="audit-to">To (UTC)</label>
<input id="audit-to" type="datetime-local" class="form-control form-control-sm"
@bind="_model.CustomToUtc" />
</div>
</div>
@* DateTimeRangeFilter is INPUT-ONLY: it surfaces the raw datetime-local
picks (DateTimeKind.Unspecified) straight into the model's range fields.
The local→UTC conversion still happens later in Apply()/LocalInputToUtc,
exactly as before. IdPrefix="audit" keeps the audit-from/audit-to ids. *@
<DateTimeRangeFilter From="_model.CustomFromUtc"
FromChanged="@(v => _model.CustomFromUtc = v)"
To="_model.CustomToUtc"
ToChanged="@(v => _model.CustomToUtc = v)"
IdPrefix="audit"
FromLabel="From (UTC)"
ToLabel="To (UTC)" />
}
else
{
@@ -72,24 +72,20 @@
</table>
</div>
<div class="d-flex justify-content-between align-items-center">
<span class="text-muted small">Page @_pageNumber · @_rows.Count rows</span>
@* CentralUI-032: keyset paging is naturally forward-only, but the
in-component _cursorStack lets the user step back through previous
pages by replaying the prior cursor. The Previous button is gated
on the stack having at least one prior cursor — i.e. we are not on
the first page. *@
<div class="btn-group">
<button class="btn btn-outline-secondary btn-sm"
data-test="grid-prev-page"
disabled="@(_loading || !CanGoBack)"
@onclick="PrevPage">Previous page</button>
<button class="btn btn-outline-secondary btn-sm"
data-test="grid-next-page"
disabled="@(_loading || _rows.Count < _pageSize)"
@onclick="NextPage">Next page</button>
</div>
</div>
@* CentralUI-032: keyset paging is naturally forward-only, but the
in-component _cursorStack lets the user step back through previous
pages by replaying the prior cursor. The Previous button is gated
on CanGoBack (the stack having at least one prior cursor — i.e. we
are not on the first page); HasNextPage mirrors the prior "short
page = end" signal (a full page suggests more rows may follow). All
cursor logic stays page-side; KeysetPager is purely presentational. *@
<KeysetPager PageNumber="_pageNumber"
RowCount="_rows.Count"
CanGoBack="CanGoBack"
HasNextPage="@(!_loading && _rows.Count >= _pageSize)"
Disabled="_loading"
OnPrevious="PrevPage"
OnNext="NextPage" />
</div>
@code {
@@ -95,7 +95,7 @@ public class AuditResultsGridTests : BunitContext
var cut = Render<AuditResultsGrid>(p => p.Add(c => c.Filter, new AuditLogQueryFilter()));
cut.Find("[data-test=\"grid-next-page\"]").Click();
cut.Find("[data-test=\"keyset-next\"]").Click();
// Two service calls: initial + next.
Assert.Equal(2, _calls.Count);