fix(centralui): single relay toast, paging/skip polish, extra Site Calls tests

This commit is contained in:
Joseph Doherty
2026-05-21 04:59:12 -04:00
parent 7e9d74697b
commit d73b459057
5 changed files with 190 additions and 28 deletions

View File

@@ -201,6 +201,9 @@
backwards and the response's NextAfter* cursor to step forwards. *@
<div class="d-flex justify-content-between align-items-center">
<span class="text-muted small">
@* No "of N" total: keyset paging has no cheap total-count, so
the label is intentionally page-number-only. Do not "fix"
this by adding a total — that would require a COUNT(*). *@
Page @(_cursorStack.Count + 1) · @_siteCalls.Count rows
</span>
<div>

View File

@@ -224,10 +224,20 @@ public partial class SiteCallsReport
}
/// <summary>
/// Surface a relay outcome on the toast. The <see cref="SiteCallRelayOutcome.SiteUnreachable"/>
/// case is deliberately distinct from a generic failure — the action was not
/// applied but the operator can retry once the site is back online.
/// Surface a relay outcome on the toast — exactly one toast per relay
/// response. The <see cref="SiteCallRelayOutcome.SiteUnreachable"/> case is
/// deliberately distinct from a generic failure: the action was not applied
/// but the operator can retry once the site is back online.
/// </summary>
/// <remarks>
/// The <see cref="SiteCallRelayOutcome"/> switch is exhaustive, so it owns
/// the single toast. <paramref name="siteReachable"/> is a redundant
/// cross-check on the same signal (the contract sets it <c>false</c> only
/// for <see cref="SiteCallRelayOutcome.SiteUnreachable"/>); it is folded
/// INTO the <see cref="SiteCallRelayOutcome.OperationFailed"/> case rather
/// than firing a second toast — an <c>OperationFailed</c> response that also
/// reports an unreachable site shows the unreachable wording, once.
/// </remarks>
private void ShowRelayOutcome(
SiteCallRelayOutcome outcome, bool siteReachable, string? errorMessage, string appliedMessage)
{
@@ -245,19 +255,19 @@ public partial class SiteCallsReport
?? "Site unreachable — the relay did not reach the owning site. "
+ "Try again once the site is back online.");
break;
case SiteCallRelayOutcome.OperationFailed when !siteReachable:
// An OperationFailed response that nonetheless reports the site
// unreachable: trust the reachability signal and show the
// unreachable wording instead of the generic failure message.
_toast.ShowError(errorMessage
?? "Site unreachable — the relay did not reach the owning site. "
+ "Try again once the site is back online.");
break;
case SiteCallRelayOutcome.OperationFailed:
default:
_toast.ShowError(errorMessage ?? "The site could not apply the action.");
break;
}
// Defensive: a non-Applied/non-Unreachable outcome that somehow reports an
// unreachable site still gets the unreachable wording.
if (outcome != SiteCallRelayOutcome.SiteUnreachable && !siteReachable
&& outcome != SiteCallRelayOutcome.Applied)
{
_toast.ShowError("Site unreachable — the relay did not reach the owning site.");
}
}
private async Task ShowDetail(SiteCallSummary c)
@@ -353,6 +363,8 @@ public partial class SiteCallsReport
? null
: new DateTimeOffset(DateTime.SpecifyKind(value.Value, DateTimeKind.Utc));
// A Guid's "N" format is always exactly 32 hex chars, so the [..12] slice is
// always in range — no length guard needed.
private static string ShortId(Guid id) => id.ToString("N")[..12];
private static string StatusBadgeClass(string status) => status switch