fix(admin): add InteractiveServer render mode to all interactive Blazor pages; fix wrong hub URLs

Eight pages were using @onclick handlers, Timers, or HubConnections but had no @rendermode,
causing interactivity to be silently dead under static SSR. Added @rendermode RenderMode.InteractiveServer
(with the required @using Microsoft.AspNetCore.Components.Web) to: AlarmsHistorian, Certificates,
Fleet, Home, Hosts, Reservations, DraftEditor, and ImportEquipment.

Also fixed two hub URL bugs: AclsTab and RedundancyTab were connecting to the non-existent
/hubs/fleet-status path; corrected to /hubs/fleet which matches the MapHub<FleetStatusHub>
call in Program.cs. Build: 0 errors, 0 warnings.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Joseph Doherty
2026-05-18 04:03:08 -04:00
parent 75b91ebb97
commit 43291d7fdd
10 changed files with 19 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
@page "/alarms/historian" @page "/alarms/historian"
@using Microsoft.AspNetCore.Components.Web
@using ZB.MOM.WW.OtOpcUa.Admin.Services @using ZB.MOM.WW.OtOpcUa.Admin.Services
@using ZB.MOM.WW.OtOpcUa.Core.AlarmHistorian @using ZB.MOM.WW.OtOpcUa.Core.AlarmHistorian
@rendermode RenderMode.InteractiveServer
@inject HistorianDiagnosticsService Diag @inject HistorianDiagnosticsService Diag
<h1 class="page-title">Alarm historian</h1> <h1 class="page-title">Alarm historian</h1>

View File

@@ -1,6 +1,8 @@
@page "/certificates" @page "/certificates"
@attribute [Microsoft.AspNetCore.Authorization.Authorize(Roles = AdminRoles.FleetAdmin)] @attribute [Microsoft.AspNetCore.Authorization.Authorize(Roles = AdminRoles.FleetAdmin)]
@using Microsoft.AspNetCore.Components.Web
@using ZB.MOM.WW.OtOpcUa.Admin.Services @using ZB.MOM.WW.OtOpcUa.Admin.Services
@rendermode RenderMode.InteractiveServer
@inject CertTrustService Certs @inject CertTrustService Certs
@inject AuthenticationStateProvider AuthState @inject AuthenticationStateProvider AuthState
@inject ILogger<Certificates> Log @inject ILogger<Certificates> Log

View File

@@ -223,7 +223,7 @@ else
{ {
if (!firstRender || _hub is not null) return; if (!firstRender || _hub is not null) return;
_hub = new HubConnectionBuilder() _hub = new HubConnectionBuilder()
.WithUrl(Nav.ToAbsoluteUri("/hubs/fleet-status")) .WithUrl(Nav.ToAbsoluteUri("/hubs/fleet"))
.WithAutomaticReconnect() .WithAutomaticReconnect()
.Build(); .Build();
_hub.On<NodeAclChangedMessage>("NodeAclChanged", async msg => _hub.On<NodeAclChangedMessage>("NodeAclChanged", async msg =>

View File

@@ -1,8 +1,10 @@
@page "/clusters/{ClusterId}/draft/{GenerationId:long}" @page "/clusters/{ClusterId}/draft/{GenerationId:long}"
@attribute [Microsoft.AspNetCore.Authorization.Authorize] @attribute [Microsoft.AspNetCore.Authorization.Authorize]
@using Microsoft.AspNetCore.Components.Web
@using ZB.MOM.WW.OtOpcUa.Admin.Services @using ZB.MOM.WW.OtOpcUa.Admin.Services
@using ZB.MOM.WW.OtOpcUa.Configuration.Enums @using ZB.MOM.WW.OtOpcUa.Configuration.Enums
@using ZB.MOM.WW.OtOpcUa.Configuration.Validation @using ZB.MOM.WW.OtOpcUa.Configuration.Validation
@rendermode RenderMode.InteractiveServer
@inject GenerationService GenerationSvc @inject GenerationService GenerationSvc
@inject DraftValidationService ValidationSvc @inject DraftValidationService ValidationSvc
@inject NavigationManager Nav @inject NavigationManager Nav

View File

@@ -1,7 +1,9 @@
@page "/clusters/{ClusterId}/draft/{GenerationId:long}/import-equipment" @page "/clusters/{ClusterId}/draft/{GenerationId:long}/import-equipment"
@attribute [Microsoft.AspNetCore.Authorization.Authorize] @attribute [Microsoft.AspNetCore.Authorization.Authorize]
@using Microsoft.AspNetCore.Components.Authorization @using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.Web
@using ZB.MOM.WW.OtOpcUa.Admin.Services @using ZB.MOM.WW.OtOpcUa.Admin.Services
@rendermode RenderMode.InteractiveServer
@using ZB.MOM.WW.OtOpcUa.Configuration.Entities @using ZB.MOM.WW.OtOpcUa.Configuration.Entities
@using ZB.MOM.WW.OtOpcUa.Configuration.Enums @using ZB.MOM.WW.OtOpcUa.Configuration.Enums
@inject DriverInstanceService DriverSvc @inject DriverInstanceService DriverSvc

View File

@@ -131,7 +131,7 @@ else
private async Task ConnectHubAsync() private async Task ConnectHubAsync()
{ {
_hub = new HubConnectionBuilder() _hub = new HubConnectionBuilder()
.WithUrl(Nav.ToAbsoluteUri("/hubs/fleet-status")) .WithUrl(Nav.ToAbsoluteUri("/hubs/fleet"))
.WithAutomaticReconnect() .WithAutomaticReconnect()
.Build(); .Build();

View File

@@ -1,7 +1,9 @@
@page "/fleet" @page "/fleet"
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.EntityFrameworkCore @using Microsoft.EntityFrameworkCore
@using ZB.MOM.WW.OtOpcUa.Configuration @using ZB.MOM.WW.OtOpcUa.Configuration
@using ZB.MOM.WW.OtOpcUa.Configuration.Entities @using ZB.MOM.WW.OtOpcUa.Configuration.Entities
@rendermode RenderMode.InteractiveServer
@inject IServiceScopeFactory ScopeFactory @inject IServiceScopeFactory ScopeFactory
@implements IDisposable @implements IDisposable

View File

@@ -1,6 +1,8 @@
@page "/" @page "/"
@using Microsoft.AspNetCore.Components.Web
@using ZB.MOM.WW.OtOpcUa.Admin.Services @using ZB.MOM.WW.OtOpcUa.Admin.Services
@using ZB.MOM.WW.OtOpcUa.Configuration.Entities @using ZB.MOM.WW.OtOpcUa.Configuration.Entities
@rendermode RenderMode.InteractiveServer
@inject ClusterService ClusterSvc @inject ClusterService ClusterSvc
@inject GenerationService GenerationSvc @inject GenerationService GenerationSvc
@inject NavigationManager Nav @inject NavigationManager Nav

View File

@@ -1,9 +1,11 @@
@page "/hosts" @page "/hosts"
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.SignalR.Client @using Microsoft.AspNetCore.SignalR.Client
@using Microsoft.EntityFrameworkCore @using Microsoft.EntityFrameworkCore
@using ZB.MOM.WW.OtOpcUa.Admin.Hubs @using ZB.MOM.WW.OtOpcUa.Admin.Hubs
@using ZB.MOM.WW.OtOpcUa.Admin.Services @using ZB.MOM.WW.OtOpcUa.Admin.Services
@using ZB.MOM.WW.OtOpcUa.Configuration.Enums @using ZB.MOM.WW.OtOpcUa.Configuration.Enums
@rendermode RenderMode.InteractiveServer
@inject IServiceScopeFactory ScopeFactory @inject IServiceScopeFactory ScopeFactory
@inject NavigationManager Nav @inject NavigationManager Nav
@implements IAsyncDisposable @implements IAsyncDisposable

View File

@@ -1,8 +1,10 @@
@page "/reservations" @page "/reservations"
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Web
@using ZB.MOM.WW.OtOpcUa.Admin.Services @using ZB.MOM.WW.OtOpcUa.Admin.Services
@using ZB.MOM.WW.OtOpcUa.Configuration.Entities @using ZB.MOM.WW.OtOpcUa.Configuration.Entities
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Policy = "CanPublish")] @attribute [Authorize(Policy = "CanPublish")]
@rendermode RenderMode.InteractiveServer
@inject ReservationService ReservationSvc @inject ReservationService ReservationSvc
<h1 class="page-title">External-ID reservations</h1> <h1 class="page-title">External-ID reservations</h1>