docs+ui: backfill XML doc comments and finish dashboard layout pass
Adds missing <summary>/<param> XML docs across 99 server, worker, and test files so CommentChecker reports zero issues (TreatWarningsAsErrors needs the analyzer clean). Bundles in WIP dashboard work: NavSection extraction, MainLayout/site.css/js styling alignment, and DashboardOptions/Auth tweaks.
This commit is contained in:
@@ -17,6 +17,7 @@ public sealed class AlarmsHub : Hub
|
||||
/// <summary>Method name used to push <c>AlarmFeedMessage</c> values to clients.</summary>
|
||||
public const string AlarmMessage = "AlarmFeed";
|
||||
|
||||
/// <inheritdoc />
|
||||
public override async Task OnConnectedAsync()
|
||||
{
|
||||
await Groups.AddToGroupAsync(Context.ConnectionId, AllAlarmsGroup).ConfigureAwait(false);
|
||||
|
||||
@@ -16,6 +16,7 @@ public sealed class AlarmsHubPublisher(
|
||||
IHubContext<AlarmsHub> hubContext,
|
||||
ILogger<AlarmsHubPublisher> logger) : BackgroundService
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
// Loop forever — when StreamAsync completes (monitor restart, etc.)
|
||||
|
||||
@@ -14,6 +14,9 @@ public sealed class DashboardEventBroadcaster(
|
||||
IHubContext<EventsHub> hubContext,
|
||||
ILogger<DashboardEventBroadcaster> logger) : IDashboardEventBroadcaster
|
||||
{
|
||||
/// <summary>Publishes an MX event to connected dashboard clients.</summary>
|
||||
/// <param name="sessionId">The session identifier.</param>
|
||||
/// <param name="mxEvent">The MX event to publish.</param>
|
||||
public void Publish(string sessionId, MxEvent mxEvent)
|
||||
{
|
||||
if (string.IsNullOrEmpty(sessionId) || mxEvent is null)
|
||||
|
||||
@@ -16,6 +16,9 @@ public sealed class DashboardHubConnectionFactory(
|
||||
HubTokenService tokens,
|
||||
AuthenticationStateProvider authState)
|
||||
{
|
||||
/// <summary>Creates a new hub connection to the specified hub path.</summary>
|
||||
/// <param name="hubPath">The relative hub path (e.g., "/hubs/snapshot").</param>
|
||||
/// <returns>A configured hub connection with automatic reconnection and token authentication.</returns>
|
||||
public HubConnection Create(string hubPath)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(hubPath);
|
||||
|
||||
@@ -15,6 +15,7 @@ public sealed class DashboardSnapshotHub(IDashboardSnapshotService snapshotServi
|
||||
/// <summary>Method name used to push snapshot updates to clients.</summary>
|
||||
public const string SnapshotMessage = "SnapshotUpdated";
|
||||
|
||||
/// <inheritdoc />
|
||||
public override async Task OnConnectedAsync()
|
||||
{
|
||||
await Clients.Caller.SendAsync(SnapshotMessage, snapshotService.GetSnapshot()).ConfigureAwait(false);
|
||||
|
||||
@@ -26,6 +26,10 @@ public sealed class DashboardSnapshotPublisher : BackgroundService
|
||||
private readonly ILogger<DashboardSnapshotPublisher> _logger;
|
||||
private readonly TimeSpan _reconnectDelay;
|
||||
|
||||
/// <summary>Initializes a new instance of the DashboardSnapshotPublisher class.</summary>
|
||||
/// <param name="snapshotService">The snapshot service to subscribe to.</param>
|
||||
/// <param name="hubContext">The SignalR hub context for broadcasting.</param>
|
||||
/// <param name="logger">The logger instance.</param>
|
||||
public DashboardSnapshotPublisher(
|
||||
IDashboardSnapshotService snapshotService,
|
||||
IHubContext<DashboardSnapshotHub> hubContext,
|
||||
@@ -34,9 +38,12 @@ public sealed class DashboardSnapshotPublisher : BackgroundService
|
||||
{
|
||||
}
|
||||
|
||||
// Internal hook for the Server-042 regression test: tests inject a
|
||||
// very short reconnect delay so the assertion doesn't wait the full
|
||||
// 5s. Production wiring always uses the 5s default via the public ctor.
|
||||
/// <summary>Initializes a new instance of the DashboardSnapshotPublisher class with custom reconnect delay.</summary>
|
||||
/// <remarks>Internal hook for testing: tests inject a very short reconnect delay so assertions don't wait full 5s.</remarks>
|
||||
/// <param name="snapshotService">The snapshot service to subscribe to.</param>
|
||||
/// <param name="hubContext">The SignalR hub context for broadcasting.</param>
|
||||
/// <param name="logger">The logger instance.</param>
|
||||
/// <param name="reconnectDelay">The delay before reconnecting after a subscription failure.</param>
|
||||
internal DashboardSnapshotPublisher(
|
||||
IDashboardSnapshotService snapshotService,
|
||||
IHubContext<DashboardSnapshotHub> hubContext,
|
||||
@@ -49,6 +56,7 @@ public sealed class DashboardSnapshotPublisher : BackgroundService
|
||||
_reconnectDelay = reconnectDelay;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
// Loop forever — when WatchSnapshotsAsync completes or throws, reopen
|
||||
|
||||
@@ -21,6 +21,9 @@ public sealed class EventsHub : Hub
|
||||
/// <summary>Method name used to push individual <c>MxEvent</c> values to clients.</summary>
|
||||
public const string EventMessage = "MxEvent";
|
||||
|
||||
/// <summary>Computes the SignalR group name for a given session id.</summary>
|
||||
/// <param name="sessionId">The session id.</param>
|
||||
/// <returns>The group name for the session.</returns>
|
||||
public static string GroupName(string sessionId) => $"session:{sessionId}";
|
||||
|
||||
/// <summary>
|
||||
@@ -56,6 +59,9 @@ public sealed class EventsHub : Hub
|
||||
return Groups.AddToGroupAsync(Context.ConnectionId, GroupName(sessionId));
|
||||
}
|
||||
|
||||
/// <summary>Unsubscribes the calling SignalR connection from the per-session events group.</summary>
|
||||
/// <param name="sessionId">Session id to unsubscribe the caller from.</param>
|
||||
/// <returns>A task representing the unsubscription operation.</returns>
|
||||
public Task UnsubscribeSession(string sessionId)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(sessionId))
|
||||
|
||||
@@ -10,5 +10,8 @@ namespace ZB.MOM.WW.MxGateway.Server.Dashboard.Hubs;
|
||||
/// </summary>
|
||||
public interface IDashboardEventBroadcaster
|
||||
{
|
||||
/// <summary>Publishes an MxEvent to all dashboard clients subscribed to the session.</summary>
|
||||
/// <param name="sessionId">The session identifier.</param>
|
||||
/// <param name="mxEvent">The MxEvent to publish.</param>
|
||||
void Publish(string sessionId, MxEvent mxEvent);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user