@page "/alarms/historian"
@using Microsoft.AspNetCore.Components.Web
@using ZB.MOM.WW.OtOpcUa.Admin.Services
@using ZB.MOM.WW.OtOpcUa.Core.AlarmHistorian
@rendermode RenderMode.InteractiveServer
@inject HistorianDiagnosticsService Diag
Alarm historian
Local store-and-forward queue that ships alarm events to Aveva Historian via Galaxy.Host.
Drain state
@_status.DrainState
Queue depth
@_status.QueueDepth.ToString("N0")
Dead-letter depth
@_status.DeadLetterDepth.ToString("N0")
Last success
@(_status.LastSuccessUtc?.ToString("u") ?? "—")
@if (!string.IsNullOrEmpty(_status.LastError))
{
Last error: @_status.LastError
}
@if (_retryResult is not null)
{
Requeued @_retryResult row(s) for retry.
}
@code {
private HistorianSinkStatus _status = new(0, 0, null, null, null, HistorianDrainState.Disabled);
private int? _retryResult;
protected override void OnInitialized() => _status = Diag.GetStatus();
private Task RefreshAsync()
{
_status = Diag.GetStatus();
_retryResult = null;
return Task.CompletedTask;
}
private Task RetryDeadLetteredAsync()
{
_retryResult = Diag.TryRetryDeadLettered();
_status = Diag.GetStatus();
return Task.CompletedTask;
}
private static string BadgeFor(HistorianDrainState s) => s switch
{
HistorianDrainState.Idle => "chip-ok",
HistorianDrainState.Draining => "chip-idle",
HistorianDrainState.BackingOff => "chip-warn",
HistorianDrainState.Disabled => "chip-idle",
_ => "chip-idle",
};
}