How to add more page in Dashboard?
following
In short, you should do the following steps:
.cshtml file with the following content. You can see more examples in the Hangfire repository.@* Generator: Template TypeVisibility: Internal GeneratePrettyNames: true *@
@inherits RazorPage
@* The rest of a page *@
CustomTool property of a .cshtml file to RazorGenerator. After this step, a new class will appear in your project.using Hangfire.Dashboard;
RouteCollection.Routes.AddRazorPage("/batches/started", x => new StartedBatchesPage());
NavigationMenu.Items.Add(page => new MenuItem("Batches", page.Url.To("/batches/started")));
Register page for a route
any class is ok?
when call this class?
Set the CustomTool property of a .cshtml file to RazorGenerator. After this step, a new class will appear in your project.
You should use class created by RazorGenerator.
You may also need to override its namespace.
C#
@* Generator: Template
TypeVisibility: Internal
GeneratePrettyNames: true
Namespace: Hangfire.Dashboard.Pages
*@
@odinserj I couldn't find any extension or way to add a route
RouteCollection.Routes.AddRazorPage("/batches/started", x => new StartedBatchesPage());
Should it be DashboardRoutes.Routes ?
Most helpful comment
In short, you should do the following steps:
.cshtmlfile with the following content. You can see more examples in the Hangfire repository.CustomToolproperty of a.cshtmlfile toRazorGenerator. After this step, a new class will appear in your project.