jobs: add ability to search jobs on /jobs page.
Add ability to search jobs on the /jobs page by job type or by status. Fixes #2577 (Search filters for delayed jobs). This wasn't possible before with DelayedJobs because it stored the job data in a YAML string, which made it difficult to search jobs by type. GoodJobs stores job data in a JSON object, which is easier to search in Postgres.
This commit is contained in:
@@ -2,6 +2,12 @@
|
||||
<div id="a-index">
|
||||
<h1>Jobs</h1>
|
||||
|
||||
<%= search_form_for(jobs_path) do |f| %>
|
||||
<%= f.input :name, collection: ApplicationJob.job_classes.map { |klass| klass.name.titleize.delete_suffix(" Job") }, include_blank: true, selected: params[:search][:name] %>
|
||||
<%= f.input :status, collection: %w[Running Queued Finished Discarded], include_blank: true, selected: params[:search][:status] %>
|
||||
<%= f.submit "Search" %>
|
||||
<% end %>
|
||||
|
||||
<%= table_for @jobs, class: "striped autofit" do |t| %>
|
||||
<% t.column "Name" do |job| %>
|
||||
<%= job.job_class.titleize.delete_suffix(" Job") %>
|
||||
@@ -28,7 +34,7 @@
|
||||
<% end %>
|
||||
|
||||
<% t.column column: "control" do |job| %>
|
||||
<% if GoodJobPolicy.new(CurrentUser.user, job).update? %>
|
||||
<% if policy(job).update? %>
|
||||
<%= link_to "Run", run_job_path(job), method: :put, remote: true %> |
|
||||
<%= link_to "Retry", retry_job_path(job), method: :put, remote: true %> |
|
||||
<%= link_to "Cancel", cancel_job_path(job), method: :put, remote: true %> |
|
||||
|
||||
Reference in New Issue
Block a user