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

Hangfire Search #2414

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions src/Hangfire.Core/Dashboard/Content/js/hangfire.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,14 @@
e.preventDefault();
});

$(this).on('keydown', '.search', function(e) {
if (e.key === 'Enter') {
const urlParams = new URLSearchParams(window.location.search);
urlParams.set('search', $(this).val());
window.location.search = urlParams.toString();
}
});

updateListState();
});
};
Expand Down
9 changes: 9 additions & 0 deletions src/Hangfire.Core/Dashboard/Content/resx/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/Hangfire.Core/Dashboard/Content/resx/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
<data name="LayoutPage_Footer_StorageTime" xml:space="preserve">
<value>Storage Time:</value>
</data>
<data name="LayoutPage_Footer_TimeIsOutOfSync" xml:space="preserve">
<data name="LayoutPage_Footer_TimeIsOutOfSync" xml:space="preserve">
<value>Application time is out of sync with storage time</value>
</data>
<data name="LayoutPage_Footer_Time" xml:space="preserve">
Expand Down Expand Up @@ -578,4 +578,7 @@
<data name="Metrics_SQLServer_LogFilesSize" xml:space="preserve">
<value>Log File(s) Used (MB)</value>
</data>
<data name="Search_Search" xml:space="preserve">
<value>Search</value>
</data>
</root>
5 changes: 5 additions & 0 deletions src/Hangfire.Core/Dashboard/HtmlHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ public NonEscapedString PerPageSelector([NotNull] Pager pager)
return RenderPartial(new PerPageSelector(pager));
}

public NonEscapedString Search(string search)
{
return RenderPartial(new Search(search));
}

public NonEscapedString RenderPartial(RazorPage partialPage)
{
partialPage.Assign(_page);
Expand Down
4 changes: 3 additions & 1 deletion src/Hangfire.Core/Dashboard/Pages/DeletedJobsPage.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

var monitor = Storage.GetMonitoringApi();
var pager = new Pager(from, perPage, DashboardOptions.DefaultRecordsPerPage, monitor.DeletedListCount());
var jobs = monitor.DeletedJobs(pager.FromRecord, pager.RecordsPerPage);
var search = Query("search");
var jobs = monitor.DeletedJobs(pager.FromRecord, pager.RecordsPerPage, search);
}

<div class="row">
Expand Down Expand Up @@ -45,6 +46,7 @@
</button>
}
@Html.PerPageSelector(pager)
@Html.Search(search)
</div>
<div class="table-responsive">
<table class="table" aria-describedby="page-title">
Expand Down
Loading