fix(centralui): cap retained event-log rows; hint keyword search 7-day window (review 2026-10-21 07/M-3, lane D follow-up)
This commit is contained in:
@@ -24,6 +24,9 @@
|
||||
<ToastNotification @ref="_toast" />
|
||||
|
||||
<div class="collapse show" id="event-logs-filters">
|
||||
<div class="form-text mb-1" id="filter-keyword-hint">
|
||||
Keyword search covers at most the last 7 days unless a narrower From/To is set.
|
||||
</div>
|
||||
<div class="row mb-3 g-2 align-items-end">
|
||||
<div class="col-md-2">
|
||||
<label class="form-label small" for="filter-site">Site</label>
|
||||
@@ -67,6 +70,7 @@
|
||||
type="text"
|
||||
class="form-control form-control-sm"
|
||||
aria-label="Message contains"
|
||||
aria-describedby="filter-keyword-hint"
|
||||
@bind="_filterKeyword" />
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
@@ -152,7 +156,13 @@
|
||||
</table>
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<span class="text-muted small">Showing @_entries.Count entries</span>
|
||||
<span class="text-muted small">
|
||||
Showing @_entries.Count entries
|
||||
@if (_droppedCount > 0)
|
||||
{
|
||||
<text>(oldest @_droppedCount dropped — display is capped at @MaxRetainedRows rows)</text>
|
||||
}
|
||||
</span>
|
||||
<div>
|
||||
@if (_hasMore)
|
||||
{
|
||||
@@ -194,6 +204,26 @@
|
||||
// moved every expansion onto the wrong row. The id is stable by construction.
|
||||
private readonly HashSet<string> _expandedRows = new();
|
||||
|
||||
/// <summary>Ceiling on rows retained across "Load more" pages (review 2026-10-21 07/M-3).</summary>
|
||||
internal const int MaxRetainedRows = 1000;
|
||||
|
||||
private int _droppedCount;
|
||||
|
||||
/// <summary>
|
||||
/// Appends a page to the retained list, dropping the oldest (head) rows beyond
|
||||
/// <paramref name="cap"/> and un-expanding any dropped row. Returns the number dropped.
|
||||
/// </summary>
|
||||
internal static int AppendCapped(
|
||||
List<EventLogEntry> entries, IEnumerable<EventLogEntry> page, HashSet<string> expandedRows, int cap)
|
||||
{
|
||||
entries.AddRange(page);
|
||||
var excess = entries.Count - cap;
|
||||
if (excess <= 0) return 0;
|
||||
foreach (var dropped in entries.Take(excess)) expandedRows.Remove(dropped.Id);
|
||||
entries.RemoveRange(0, excess);
|
||||
return excess;
|
||||
}
|
||||
|
||||
private int ActiveFilterCount
|
||||
{
|
||||
get
|
||||
@@ -225,6 +255,7 @@
|
||||
private async Task Search()
|
||||
{
|
||||
_entries = new();
|
||||
_droppedCount = 0;
|
||||
_continuationToken = null;
|
||||
_expandedRows.Clear();
|
||||
await FetchPage();
|
||||
@@ -276,7 +307,7 @@
|
||||
if (response.Success)
|
||||
{
|
||||
_entries ??= new();
|
||||
_entries.AddRange(response.Entries);
|
||||
_droppedCount += AppendCapped(_entries, response.Entries, _expandedRows, MaxRetainedRows);
|
||||
_hasMore = response.HasMore;
|
||||
_continuationToken = response.ContinuationToken;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user