From 742e1f401fd11bfc5280ed943fb2fad122ad122a Mon Sep 17 00:00:00 2001 From: Robbware Date: Mon, 9 Oct 2023 16:34:55 +0100 Subject: [PATCH 1/2] Add the ability to override the TopMenu component on the MainLayout Revert "Add the ability to override the TopMenu component on the MainLayout" This reverts commit 46c30435d8007ecdde20135c7f281fd59fc335b2. Use IOC to load all Items within the TopMenu --- COMET.Web.Common/Shared/TopMenu.razor | 4 ---- COMETwebapp/Program.cs | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/COMET.Web.Common/Shared/TopMenu.razor b/COMET.Web.Common/Shared/TopMenu.razor index 3a1861de..f7bbdab4 100644 --- a/COMET.Web.Common/Shared/TopMenu.razor +++ b/COMET.Web.Common/Shared/TopMenu.razor @@ -39,10 +39,6 @@ } - - - - @foreach (var menuEntry in this.RegistrationService.RegisteredAuthorizedMenuEntries.Where(x => x.IsSubclassOf(typeof(MenuEntryBase)))) { diff --git a/COMETwebapp/Program.cs b/COMETwebapp/Program.cs index 5f7f0f0c..943652ba 100644 --- a/COMETwebapp/Program.cs +++ b/COMETwebapp/Program.cs @@ -50,6 +50,7 @@ namespace COMETwebapp using System.Reflection; using COMET.Web.Common; + using COMET.Web.Common.Shared.TopMenuEntry; using COMETwebapp.ViewModels.Components.BookEditor; @@ -75,7 +76,7 @@ public static async Task Main(string[] args) { options.Applications = Applications.ExistingApplications; options.AdditionalAssemblies.Add(Assembly.GetAssembly(typeof(Program))); - options.AdditionalMenuEntries.AddRange(new List{typeof(ShowHideDeprecatedThings), typeof(AboutMenu)}); + options.AdditionalMenuEntries.AddRange(new List{ typeof(ApplicationMenu), typeof(ModelMenu), typeof(SessionMenu), typeof(ShowHideDeprecatedThings), typeof(AboutMenu)}); }); builder.Services.AddScoped(_ => new HttpClient() From 92da305fddbb9dab6f69a91dd9cb37af67949704 Mon Sep 17 00:00:00 2001 From: Robbware Date: Mon, 9 Oct 2023 16:52:13 +0100 Subject: [PATCH 2/2] Fix TopMenu tests --- COMET.Web.Common.Tests/Shared/TopMenuTestFixture.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/COMET.Web.Common.Tests/Shared/TopMenuTestFixture.cs b/COMET.Web.Common.Tests/Shared/TopMenuTestFixture.cs index 2408d0b9..3c4e0c7e 100644 --- a/COMET.Web.Common.Tests/Shared/TopMenuTestFixture.cs +++ b/COMET.Web.Common.Tests/Shared/TopMenuTestFixture.cs @@ -87,7 +87,12 @@ public void Setup() this.autoRefreshService = new Mock(); this.sourceList = new SourceList(); this.sessionService.Setup(x => x.OpenIterations).Returns(this.sourceList); - this.registeredMenuEntries = new List(); + this.registeredMenuEntries = new List() + { + typeof(ApplicationMenu), + typeof(ModelMenu), + typeof(SessionMenu) + }; this.registeredApplications = new List(); this.registrationService = new Mock(); this.registrationService.Setup(x => x.RegisteredAuthorizedMenuEntries).Returns(this.registeredMenuEntries);