refactor(adminui): MapAdminUI extension + AddAdminUI DI (47-component migration tracked as F15)

This commit is contained in:
Joseph Doherty
2026-05-26 05:17:55 -04:00
parent 5e31449529
commit 1a067e609c

View File

@@ -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
{
/// <summary>
/// Mounts the AdminUI Razor components and the AdminUI static asset pipeline at the root.
/// Call from the fused Host's Program.cs alongside <c>app.MapOtOpcUaAuth()</c>.
///
/// Razor component migration from legacy <c>OtOpcUa.Admin/Components/</c> 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. <c>Deployments</c>, Task 52).
/// </summary>
public static IEndpointRouteBuilder MapAdminUI<TApp>(this IEndpointRouteBuilder app)
where TApp : IComponent
{
app.MapRazorComponents<TApp>()
.AddInteractiveServerRenderMode();
return app;
}
public static IServiceCollection AddAdminUI(this IServiceCollection services)
{
services.AddRazorComponents().AddInteractiveServerComponents();
return services;
}
}