using Microsoft.AspNetCore.Components.Authorization; using Microsoft.Extensions.DependencyInjection; using ScadaLink.CentralUI.Auth; using ScadaLink.CentralUI.Components.Shared; using ScadaLink.CentralUI.ScriptAnalysis; namespace ScadaLink.CentralUI; public static class ServiceCollectionExtensions { public static IServiceCollection AddCentralUI(this IServiceCollection services) { services.AddRazorComponents() .AddInteractiveServerComponents(); services.AddHttpContextAccessor(); services.AddScoped(); services.AddCascadingAuthenticationState(); // Resolves the current user's permitted site set from their SiteId claims // so Deployment/Monitoring pages can enforce site scoping (CentralUI-002). services.AddScoped(); // Centralised dialog service: pages inject IDialogService and a single // in MainLayout renders the active dialog. See // Components/Shared/IDialogService.cs. services.AddScoped(); // Roslyn-backed C# analysis for the Monaco script editor. // Scoped because SharedScriptCatalog wraps a scoped service. services.AddMemoryCache(o => o.SizeLimit = 200); services.AddScoped(); services.AddScoped(); return services; } }