fix(health-monitoring): resolve HealthMonitoring-015 — nullable LastReportReceivedAt
A heartbeat-registered site that has never sent a full report now has
LastReportReceivedAt = null instead of the year-0001 sentinel. TimestampDisplay
accepts DateTimeOffset? and renders null as a placeholder ('awaiting first
report') rather than a ~2000-year-stale date. Cross-module: HealthMonitoring +
CentralUI.
This commit is contained in:
@@ -71,7 +71,7 @@
|
||||
<strong class="fs-5">@siteName@(isCentral ? "" : $" ({siteId})")</strong>
|
||||
</div>
|
||||
<small class="text-muted">
|
||||
Last report: <TimestampDisplay Value="@state.LastReportReceivedAt" Format="HH:mm:ss" />
|
||||
Last report: <TimestampDisplay Value="@state.LastReportReceivedAt" Format="HH:mm:ss" NullText="awaiting first report" />
|
||||
| Last heartbeat: <TimestampDisplay Value="@state.LastHeartbeatAt" Format="HH:mm:ss" />
|
||||
| Seq: @state.LastSequenceNumber
|
||||
</small>
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
@* Displays a UTC DateTimeOffset formatted for display. Tooltip shows UTC value. *@
|
||||
@* Displays a UTC DateTimeOffset formatted for display. Tooltip shows UTC value.
|
||||
A null Value renders as a plain "never" placeholder — used for timestamps that
|
||||
have not happened yet (e.g. a heartbeat-only site with no full report). *@
|
||||
|
||||
<span title="@Value.UtcDateTime.ToString("yyyy-MM-dd HH:mm:ss") UTC">@Value.LocalDateTime.ToString(Format)</span>
|
||||
@if (Value is { } value)
|
||||
{
|
||||
<span title="@value.UtcDateTime.ToString("yyyy-MM-dd HH:mm:ss") UTC">@value.LocalDateTime.ToString(Format)</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="text-muted">@NullText</span>
|
||||
}
|
||||
|
||||
@code {
|
||||
[Parameter, EditorRequired] public DateTimeOffset Value { get; set; }
|
||||
[Parameter, EditorRequired] public DateTimeOffset? Value { get; set; }
|
||||
[Parameter] public string Format { get; set; } = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
/// <summary>Text shown when <see cref="Value"/> is null.</summary>
|
||||
[Parameter] public string NullText { get; set; } = "never";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user