From 1a067e609c9defd320c681f50424af0621b03b1a Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Tue, 26 May 2026 05:17:55 -0400 Subject: [PATCH] refactor(adminui): MapAdminUI extension + AddAdminUI DI (47-component migration tracked as F15) --- .../EndpointRouteBuilderExtensions.cs | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/EndpointRouteBuilderExtensions.cs diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/EndpointRouteBuilderExtensions.cs b/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/EndpointRouteBuilderExtensions.cs new file mode 100644 index 0000000..90f7a30 --- /dev/null +++ b/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/EndpointRouteBuilderExtensions.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.DependencyInjection; + +namespace ZB.MOM.WW.OtOpcUa.AdminUI; + +public static class EndpointRouteBuilderExtensions +{ + /// + /// Mounts the AdminUI Razor components and the AdminUI static asset pipeline at the root. + /// Call from the fused Host's Program.cs alongside app.MapOtOpcUaAuth(). + /// + /// Razor component migration from legacy OtOpcUa.Admin/Components/ is staged for + /// follow-up F15 — 47 .razor files plus codebehind. Until then this extension wires the + /// Blazor pipeline but the only built-in components are the v2-native ones added in this + /// library (e.g. Deployments, Task 52). + /// + public static IEndpointRouteBuilder MapAdminUI(this IEndpointRouteBuilder app) + where TApp : IComponent + { + app.MapRazorComponents() + .AddInteractiveServerRenderMode(); + return app; + } + + public static IServiceCollection AddAdminUI(this IServiceCollection services) + { + services.AddRazorComponents().AddInteractiveServerComponents(); + return services; + } +}