[CHANGE] event console own component
This commit is contained in:
@@ -9,7 +9,7 @@ namespace Manager.App.Components.Application.System;
|
||||
|
||||
public partial class EventConsole : ComponentBase
|
||||
{
|
||||
private const int BatchDelayMs = 1000;
|
||||
private const int BatchDelayMs = 2000;
|
||||
private List<ServiceEvent> _serviceEvents = [];
|
||||
private readonly List<ServiceEvent> _batchBuffer = [];
|
||||
private readonly SemaphoreSlim _batchLock = new(1, 1);
|
||||
@@ -17,6 +17,7 @@ public partial class EventConsole : ComponentBase
|
||||
private bool _autoScroll = true;
|
||||
private CancellationTokenSource _cts = new();
|
||||
private TimeZoneInfo _timeZone = TimeZoneInfo.Local;
|
||||
private Virtualize<ServiceEvent>? _virtualize;
|
||||
|
||||
[Parameter]
|
||||
public List<ServiceEvent> InitialEvents { get; set; } = [];
|
||||
@@ -109,12 +110,17 @@ public partial class EventConsole : ComponentBase
|
||||
_serviceEvents.AddRange(batch);
|
||||
_lastBatchUpdate = DateTime.UtcNow;
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
if (_virtualize != null)
|
||||
{
|
||||
await _virtualize.RefreshDataAsync();
|
||||
}
|
||||
|
||||
if (_autoScroll)
|
||||
{
|
||||
await JsRuntime.InvokeVoidAsync("scrollToBottom", _consoleContainer);
|
||||
}
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
_updateScheduled = false;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user