55 lines
1.9 KiB
Plaintext
55 lines
1.9 KiB
Plaintext
@code {
|
|
[Parameter] public IReadOnlyList<ReplayEvent> Events { get; set; } = [];
|
|
[Parameter] public int MaxRows { get; set; } = 200;
|
|
|
|
private string GetBadgeClass(ReplayEventType type) => type switch
|
|
{
|
|
ReplayEventType.Decision => "badge-decision",
|
|
ReplayEventType.StateChange => "badge-statechange",
|
|
ReplayEventType.Warning => "badge-warning",
|
|
ReplayEventType.Anomaly => "badge-anomaly",
|
|
ReplayEventType.ServiceCall => "badge-servicecall",
|
|
_ => "badge-info"
|
|
};
|
|
}
|
|
|
|
@if (Events.Count == 0)
|
|
{
|
|
<div class="text-muted text-center py-4">No events recorded for this monitor.</div>
|
|
}
|
|
else
|
|
{
|
|
<div class="table-responsive" style="max-height: 400px; overflow-y: auto;">
|
|
<table class="table table-sm table-hover align-middle mb-0">
|
|
<thead class="sticky-top" style="background-color: #2b3035;">
|
|
<tr>
|
|
<th style="width: 100px;">Time</th>
|
|
<th style="width: 100px;">Type</th>
|
|
<th>Message</th>
|
|
<th>Details</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var evt in Events.Take(MaxRows))
|
|
{
|
|
<tr>
|
|
<td class="text-nowrap font-monospace small">
|
|
@evt.Timestamp.ToLocalTime().ToString("HH:mm:ss")
|
|
</td>
|
|
<td>
|
|
<span class="badge @GetBadgeClass(evt.EventType)">@evt.EventType</span>
|
|
</td>
|
|
<td class="small">@evt.Message</td>
|
|
<td class="text-muted small">@evt.Details</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
@if (Events.Count > MaxRows)
|
|
{
|
|
<div class="text-muted small mt-1">Showing @MaxRows of @Events.Count events</div>
|
|
}
|
|
}
|