-
-
-
-
-
-
-
-
+
+
+
Recent faults
+ View sessions →
+
+
-
-
-
Galaxy Repository
-
- View browse details →
-
+
+
+
+ Supporting counters and repository details
+ Uptime and cumulative counters
-
-
-
-
-
-
+
+
+
+
+
- @if (!string.IsNullOrWhiteSpace(Snapshot.Galaxy.LastError))
- {
- @* Overview stays compact; the Galaxy page renders the error in full. *@
- @DashboardDisplay.Abbreviate(Snapshot.Galaxy.LastError, 160)
- }
-
-
-
+
+
+
Galaxy Repository
+
+ Repository status →
+ Browse attributes →
+
+
+
+
+
+
+
+
+
+ @if (!string.IsNullOrWhiteSpace(Snapshot.Galaxy.LastError))
+ {
+ @DashboardDisplay.Abbreviate(Snapshot.Galaxy.LastError, 160) Open Repository status for complete diagnostics.
+ }
+
+
}
@code {
diff --git a/src/ZB.MOM.WW.MxGateway.Server/Dashboard/Components/Shared/FaultList.razor b/src/ZB.MOM.WW.MxGateway.Server/Dashboard/Components/Shared/FaultList.razor
index e337ada1..b45f7bfd 100644
--- a/src/ZB.MOM.WW.MxGateway.Server/Dashboard/Components/Shared/FaultList.razor
+++ b/src/ZB.MOM.WW.MxGateway.Server/Dashboard/Components/Shared/FaultList.razor
@@ -1,6 +1,34 @@
@if (Faults.Count == 0)
{
- No faults recorded.
+ No fault records in this snapshot.
+}
+else if (Compact)
+{
+
+ @foreach (DashboardFaultSummary fault in Faults)
+ {
+
+ @fault.Source
+ @if (fault.Message.Length > 160)
+ {
+
+ @DashboardDisplay.Abbreviate(fault.Message)
+ @fault.Message
+
+ }
+ else { @fault.Message
}
+
+
Observed @DashboardDisplay.DateTime(fault.ObservedAt)
+
Session
+ @if (!string.IsNullOrWhiteSpace(fault.SessionId))
+ { @fault.SessionId }
+ else { @DashboardDisplay.Text(fault.SessionId) }
+
+
Worker @(fault.WorkerProcessId?.ToString(System.Globalization.CultureInfo.InvariantCulture) ?? "-")
+
+
+ }
+
}
else
{
@@ -22,10 +50,25 @@ else
| @DashboardDisplay.DateTime(fault.ObservedAt) |
@fault.Source |
- @DashboardDisplay.Text(fault.SessionId) |
+
+ @if (!string.IsNullOrWhiteSpace(fault.SessionId))
+ {
+ @fault.SessionId
+ }
+ else { @DashboardDisplay.Text(fault.SessionId) }
+ |
@(fault.WorkerProcessId?.ToString(System.Globalization.CultureInfo.InvariantCulture) ?? "-") |
|
- @DashboardDisplay.Abbreviate(fault.Message) |
+
+ @if (fault.Message.Length > 160)
+ {
+
+ @DashboardDisplay.Abbreviate(fault.Message)
+ @fault.Message
+
+ }
+ else { @fault.Message }
+ |
}
@@ -34,6 +77,9 @@ else
}
@code {
+ [Parameter]
+ public bool Compact { get; set; }
+
[Parameter]
public IReadOnlyList Faults { get; set; } = [];
}
diff --git a/src/ZB.MOM.WW.MxGateway.Server/wwwroot/css/site.css b/src/ZB.MOM.WW.MxGateway.Server/wwwroot/css/site.css
index 2a651362..e734152e 100644
--- a/src/ZB.MOM.WW.MxGateway.Server/wwwroot/css/site.css
+++ b/src/ZB.MOM.WW.MxGateway.Server/wwwroot/css/site.css
@@ -566,3 +566,17 @@ code {
@media (pointer: coarse) {
.browse-layout button, .browse-search-controls .form-control { min-width: 44px; min-height: 44px; }
}
+
+.supporting-counters > summary, .fault-diagnostic > summary { cursor: pointer; }
+.fault-diagnostic pre {
+ max-height: 16rem; overflow: auto; margin: .5rem 0 0; padding: .65rem;
+ white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono);
+ font-size: .78rem; color: var(--ink); background: var(--zebra-bg);
+ border: 1px solid var(--rule); border-radius: 4px;
+}
+
+/* Fault messages lead on narrow screens; every snapshot field remains present. */
+.fault-summaries { display: grid; gap: 1rem; }
+.fault-summary { min-width: 0; overflow-wrap: anywhere; }
+.fault-summary + .fault-summary { border-top: 1px solid var(--rule); padding-top: 1rem; }
+.fault-context { display: flex; flex-wrap: wrap; gap: .25rem 1rem; color: var(--ink-faint); font-size: .875rem; }
diff --git a/src/ZB.MOM.WW.MxGateway.Tests/Dashboard/DashboardHomeRenderTests.cs b/src/ZB.MOM.WW.MxGateway.Tests/Dashboard/DashboardHomeRenderTests.cs
new file mode 100644
index 00000000..e6dbc69e
--- /dev/null
+++ b/src/ZB.MOM.WW.MxGateway.Tests/Dashboard/DashboardHomeRenderTests.cs
@@ -0,0 +1,85 @@
+using System.Runtime.CompilerServices;
+using System.Text.RegularExpressions;
+using Microsoft.AspNetCore.Components;
+using Microsoft.AspNetCore.Components.Web;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+using ZB.MOM.WW.MxGateway.Server.Dashboard;
+using ZB.MOM.WW.MxGateway.Server.Dashboard.Components.Pages;
+
+namespace ZB.MOM.WW.MxGateway.Tests.Dashboard;
+
+/// Snapshot composition contracts; no gateway workers or external services.
+public sealed class DashboardHomeRenderTests
+{
+ /// Fault context precedes operational metrics and links the affected existing route.
+ [Fact]
+ public async Task FaultSnapshot_LeadsWithActionableFaultAndPreservesAllCounters()
+ {
+ string html = await RenderAsync(withFault: true);
+ Assert.Contains("Fixture worker failed", html, StringComparison.Ordinal);
+ Assert.Contains("href=\"sessions/fixture-session\"", html, StringComparison.Ordinal);
+ Assert.True(html.IndexOf("Recent faults", StringComparison.OrdinalIgnoreCase) < html.IndexOf("Open sessions", StringComparison.OrdinalIgnoreCase));
+ string supporting = Regex.Match(html, "]*data-testid=\"supporting-counters\"[^>]*>(.*?) ", RegexOptions.Singleline).Groups[1].Value;
+ Assert.NotEmpty(supporting);
+ foreach (string label in new[] { "Uptime", "Commands failed", "Events received", "Faults", "Queue overflows", "Last deploy", "Objects", "Attributes", "Historized", "Alarms", "Last refresh" })
+ Assert.Contains(label, supporting, StringComparison.OrdinalIgnoreCase);
+ foreach (string value in new[] { "104", "105", "106", "107", "201", "202", "203", "204", "205" })
+ Assert.Contains(value, supporting, StringComparison.Ordinal);
+ Assert.Contains("Repository status", html, StringComparison.Ordinal);
+ Assert.Contains("Browse attributes", html, StringComparison.Ordinal);
+ }
+
+ /// A zero-session snapshot stays truthful; complete escaped diagnostics need no hover.
+ [Fact]
+ public async Task LongFault_HasKeyboardDisclosureAndEscapedCompleteDiagnostic()
+ {
+ string html = await RenderAsync(withFault: true, longFault: true);
+ Assert.Contains("fixture", html, StringComparison.Ordinal);
+ Assert.Contains("role=\"region\"", html, StringComparison.Ordinal);
+ }
+
+ /// No fault record is reported explicitly rather than synthesized from lifetime counters.
+ [Fact]
+ public async Task HealthySnapshot_ShowsNoRecordedFaultsAndRealZeroSessionCount()
+ {
+ string html = await RenderAsync(withFault: false);
+ Assert.Contains("No fault records in this snapshot.", html, StringComparison.Ordinal);
+ Assert.Contains("Open sessions", html, StringComparison.OrdinalIgnoreCase);
+ Assert.Contains("Healthy", html, StringComparison.Ordinal);
+ }
+
+ private static async Task RenderAsync(bool withFault, bool longFault = false)
+ {
+ DateTimeOffset at = new(2026, 11, 13, 20, 0, 0, TimeSpan.Zero);
+ DashboardSnapshot snapshot = new(at, at.AddHours(-3), TimeSpan.FromHours(3), withFault ? "Degraded" : "Healthy", "fixture", withFault ? [new("fixture-session", "synthetic", ZB.MOM.WW.MxGateway.Contracts.Proto.SessionState.Faulted, null, null, null, at, at, null, 123, null, null, 0, "Fixture fault")] : [], [],
+ [new("mxgateway.sessions.open", 0), new("mxgateway.workers.running", 102), new("mxgateway.events.worker_queue.depth", 103),
+ new("mxgateway.commands.failed", 104), new("mxgateway.events.received", 105), new("mxgateway.faults", 106), new("mxgateway.queues.overflows", 107)],
+ withFault ? [new("Worker", "fixture-session", 123, "Faulted", "Fixture worker failed" + (longFault ? new string('x', 300) + "" : ""), at)] : [], [], null!,
+ DashboardGalaxySummary.Unknown with { Status = DashboardGalaxyStatus.Healthy, LastDeployTime = at, LastSuccessAt = at, LastQueriedAt = at, ObjectCount = 201, AreaCount = 202, AttributeCount = 203, HistorizedAttributeCount = 204, AlarmAttributeCount = 205 });
+ ServiceCollection services = new();services.AddLogging();
+ services.AddSingleton(new SnapshotService(snapshot));
+ services.AddSingleton();
+ services.AddSingleton();
+ await using ServiceProvider provider = services.BuildServiceProvider();
+ await using HtmlRenderer renderer = new(provider, provider.GetRequiredService());
+ return await renderer.Dispatcher.InvokeAsync(async () => (await renderer.RenderComponentAsync()).ToHtmlString());
+ }
+ private sealed class SnapshotService(DashboardSnapshot snapshot) : IDashboardSnapshotService
+ {
+ public DashboardSnapshot GetSnapshot() => snapshot;
+ public IAsyncEnumerable WatchSnapshotsAsync(CancellationToken cancellationToken) => new IdleFeed().WatchAsync(cancellationToken);
+ }
+ private sealed class IdleFeed : IDashboardSnapshotFeed
+ {
+ public async IAsyncEnumerable WatchAsync([EnumeratorCancellation] CancellationToken cancellationToken)
+ { await Task.Delay(Timeout.Infinite, cancellationToken);yield break; }
+ }
+ private sealed class FixtureNavigation : NavigationManager
+ {
+ public FixtureNavigation() => Initialize("http://localhost/", "http://localhost/");
+ protected override void NavigateToCore(string uri, bool forceLoad) => throw new NotSupportedException("Read-only renderer");
+ }
+}