Hangfire: How to add more page in Dashboard?

Created on 13 Jun 2016  路  6Comments  路  Source: HangfireIO/Hangfire

How to add more page in Dashboard?

question

Most helpful comment

In short, you should do the following steps:

  • Install the RazorGenerator extension for Visual Studio (here is GitHub repo).
  • Create a .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 *@
  • Set the CustomTool property of a .cshtml file to RazorGenerator. After this step, a new class will appear in your project.
  • Register page for a route for a new class:
using Hangfire.Dashboard;
RouteCollection.Routes.AddRazorPage("/batches/started", x => new StartedBatchesPage());
  • Add a new navigation menu item:
NavigationMenu.Items.Add(page => new MenuItem("Batches", page.Url.To("/batches/started")));

All 6 comments

following

In short, you should do the following steps:

  • Install the RazorGenerator extension for Visual Studio (here is GitHub repo).
  • Create a .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 *@
  • Set the CustomTool property of a .cshtml file to RazorGenerator. After this step, a new class will appear in your project.
  • Register page for a route for a new class:
using Hangfire.Dashboard;
RouteCollection.Routes.AddRazorPage("/batches/started", x => new StartedBatchesPage());
  • Add a new navigation menu item:
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 ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeffsugden picture jeffsugden  路  4Comments

osmanrahimi picture osmanrahimi  路  3Comments

shorbachuk picture shorbachuk  路  4Comments

odinserj picture odinserj  路  4Comments

pwueje picture pwueje  路  4Comments