diff --git a/src/ScadaLink.CentralUI/EndpointExtensions.cs b/src/ScadaLink.CentralUI/EndpointExtensions.cs index a231d8d..e5fb009 100644 --- a/src/ScadaLink.CentralUI/EndpointExtensions.cs +++ b/src/ScadaLink.CentralUI/EndpointExtensions.cs @@ -1,18 +1,24 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Routing; using ScadaLink.CentralUI.Auth; -using ScadaLink.CentralUI.Components; +using ScadaLink.CentralUI.Components.Layout; namespace ScadaLink.CentralUI; public static class EndpointExtensions { - public static IEndpointRouteBuilder MapCentralUI(this IEndpointRouteBuilder endpoints) + /// + /// Maps the Central UI endpoints. The caller must provide the root App component type + /// from the Host assembly so that blazor.web.js is served correctly. + /// + public static IEndpointRouteBuilder MapCentralUI(this IEndpointRouteBuilder endpoints) + where TApp : Microsoft.AspNetCore.Components.IComponent { endpoints.MapAuthEndpoints(); - endpoints.MapRazorComponents() - .AddInteractiveServerRenderMode(); + endpoints.MapRazorComponents() + .AddInteractiveServerRenderMode() + .AddAdditionalAssemblies(typeof(MainLayout).Assembly); return endpoints; } diff --git a/src/ScadaLink.CentralUI/_Imports.razor b/src/ScadaLink.CentralUI/_Imports.razor index 7c5491f..c7695c0 100644 --- a/src/ScadaLink.CentralUI/_Imports.razor +++ b/src/ScadaLink.CentralUI/_Imports.razor @@ -4,6 +4,7 @@ @using Microsoft.AspNetCore.Components.Forms @using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Web +@using static Microsoft.AspNetCore.Components.Web.RenderMode @using ScadaLink.CentralUI @using ScadaLink.CentralUI.Components.Layout @using ScadaLink.CentralUI.Components.Shared diff --git a/src/ScadaLink.CentralUI/Components/App.razor b/src/ScadaLink.Host/Components/App.razor similarity index 58% rename from src/ScadaLink.CentralUI/Components/App.razor rename to src/ScadaLink.Host/Components/App.razor index 416a4b8..ad950ba 100644 --- a/src/ScadaLink.CentralUI/Components/App.razor +++ b/src/ScadaLink.Host/Components/App.razor @@ -65,39 +65,10 @@ border-radius: 0.5rem; } - + - - - - - - @if (context.User.Identity?.IsAuthenticated != true) - { - - } - else - { - - } - - -

Checking authorization...

-
-
-
- - -
-

Page Not Found

-

The requested page does not exist.

- Return to Dashboard -
-
-
-
-
+
- +