Skip to content

Commit

Permalink
Merge pull request #472 from RHEAGROUP/Fix/allow-override-of-topmenut…
Browse files Browse the repository at this point in the history
…ype-on-mainlayout

Add the ability to override the TopMenu component on the MainLayout via IOC
  • Loading branch information
Robbware authored Oct 10, 2023
2 parents 29f2a48 + 92da305 commit db5f137
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 6 additions & 1 deletion COMET.Web.Common.Tests/Shared/TopMenuTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ public void Setup()
this.autoRefreshService = new Mock<IAutoRefreshService>();
this.sourceList = new SourceList<Iteration>();
this.sessionService.Setup(x => x.OpenIterations).Returns(this.sourceList);
this.registeredMenuEntries = new List<Type>();
this.registeredMenuEntries = new List<Type>()
{
typeof(ApplicationMenu),
typeof(ModelMenu),
typeof(SessionMenu)
};
this.registeredApplications = new List<Application>();
this.registrationService = new Mock<IRegistrationService>();
this.registrationService.Setup(x => x.RegisteredAuthorizedMenuEntries).Returns(this.registeredMenuEntries);
Expand Down
4 changes: 0 additions & 4 deletions COMET.Web.Common/Shared/TopMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
}
</TitleTemplate>
<Items>
<ApplicationMenu />
<ModelMenu />
<SessionMenu />

@foreach (var menuEntry in this.RegistrationService.RegisteredAuthorizedMenuEntries.Where(x => x.IsSubclassOf(typeof(MenuEntryBase))))
{
<DynamicComponent Type="@menuEntry"/>
Expand Down
3 changes: 2 additions & 1 deletion COMETwebapp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ namespace COMETwebapp
using System.Reflection;

using COMET.Web.Common;
using COMET.Web.Common.Shared.TopMenuEntry;

using COMETwebapp.ViewModels.Components.BookEditor;

Expand All @@ -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<Type>{typeof(ShowHideDeprecatedThings), typeof(AboutMenu)});
options.AdditionalMenuEntries.AddRange(new List<Type>{ typeof(ApplicationMenu), typeof(ModelMenu), typeof(SessionMenu), typeof(ShowHideDeprecatedThings), typeof(AboutMenu)});
});

builder.Services.AddScoped(_ => new HttpClient()
Expand Down

0 comments on commit db5f137

Please sign in to comment.