Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/BootstrapBlazor.Server/Components/Pages/Online.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public partial class Online : IDisposable

private readonly DataTable _table = new();

private CancellationTokenSource? _cancellationTokenSource = null;
private CancellationTokenSource? _cancellationTokenSource;

private string? _clientId;

/// <summary>
Expand All @@ -50,7 +51,7 @@ protected override void OnAfterRender(bool firstRender)
{
var client = await WebClientService.GetClientInfo();
_clientId = client.Id;
_cancellationTokenSource ??= new();
_cancellationTokenSource ??= new CancellationTokenSource();
while (_cancellationTokenSource is { IsCancellationRequested: false })
{
try
Expand All @@ -59,7 +60,10 @@ protected override void OnAfterRender(bool firstRender)
await InvokeAsync(StateHasChanged);
await Task.Delay(10000, _cancellationTokenSource.Token);
}
catch { }
catch
{
// ignored
}
}
});
}
Expand All @@ -84,6 +88,7 @@ private void CreateTable()
private void BuildContext()
{
_table.Rows.Clear();
var rows = ConnectionService.Connections.Sort(["ConnectionTime"]);
foreach (var item in ConnectionService.Connections)
{
_table.Rows.Add(
Expand Down
12 changes: 12 additions & 0 deletions src/BootstrapBlazor.Server/Components/Pages/Online.razor.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
::deep .table-container {
--bb-table-row-active-bg: rgba(var(--bb-primary-color-rgb), 0.8);
--bb-table-row-hover-bg: rgba(var(--bb-primary-color-rgb), 0.8);
}

::deep .table-container .table tr.active > td {
color: #fff !important;
}

::deep .table-container .table tr.active > td a {
--bs-link-color-rgb: #fff;
}