HangfireIO / HangfireIO/Hangfire
Unable to override Pager.RecordsPerPageUrl()
- Dominant language
- C#
- Stars
- 10.1k
- Forks
- 1.8k
- Avg merge
- 1h 19m
- Merged PRs (30d)
- 1
Description
Hi,
This is a really small issue. The ["Pager" class](https://github.com/HangfireIO/Hangfire/blob/master/src/Hangfire.Core/Dashboard/Pager.cs) has two methods to build the URL for each pager link:
```cs
public virtual string PageUrl(int page)
{
if (page < 1 || page > TotalPageCount) return "#";
return BasePageUrl + "?from=" + (page - 1) * RecordsPerPage + "&count=" + RecordsPerPage;
}
public string RecordsPerPageUrl(int perPage)
{
if (perPage <= 0) return "#";
return BasePageUrl + "?from=0&count=" + perPage;
}
```
IMHO, the method "RecordsPerPageUrl()" should be "virtual" too.
I was trying to inherit this pager to create a new one where I can include custom querystring parameters. This approach works OK for "PageUrl()" override, but it's actually impossible to complete the inherited class, because I'm unable to override "RecordsPerPageUrl()".
This means I can only customize the bottom pager, but not the top one where you select the number of records per page.
Contributor guide
Research direction
Start with src/Hangfire.Core/Dashboard/Pager.cs and compare RecordsPerPageUrl(int perPage) with the existing virtual PageUrl(int page) method. Make the records-per-page URL customizable for inherited pagers, and verify that the top pager can preserve custom query-string parameters as described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100