Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to override the TopMenu component on the MainLayout via IOC #472

Merged
merged 2 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
using System.Reflection;

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

using COMETwebapp.ViewModels.Components.BookEditor;

Expand All @@ -59,7 +60,7 @@
/// Point of entry of the application
/// </summary>
[ExcludeFromCodeCoverage]
public class Program

Check warning on line 63 in COMETwebapp/Program.cs

View workflow job for this annotation

GitHub Actions / Build

Add a 'protected' constructor or the 'static' keyword to the class declaration. (https://rules.sonarsource.com/csharp/RSPEC-1118)

Check warning on line 63 in COMETwebapp/Program.cs

View workflow job for this annotation

GitHub Actions / Build

Add a 'protected' constructor or the 'static' keyword to the class declaration. (https://rules.sonarsource.com/csharp/RSPEC-1118)

Check warning on line 63 in COMETwebapp/Program.cs

View workflow job for this annotation

GitHub Actions / Build

Add a 'protected' constructor or the 'static' keyword to the class declaration. (https://rules.sonarsource.com/csharp/RSPEC-1118)
{
/// <summary>
/// Point of entry of the application
Expand All @@ -75,7 +76,7 @@
{
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
Loading