%= form_with(url: "", method: :get, local: true, id: "filter_form") do |form| %>
<%= search_field_tag "query", params[:query], class: "form-control", placeholder: "Search by class, job id, job params, and error text." %>
<%= form.submit "Search", name: nil, class: "btn btn-primary" %>
<%= link_to "Clear all", filter.to_params(job_class: nil, state: nil, queue_name: nil, query: nil), class: "btn btn-secondary" %>
<% end %>
<%= javascript_tag nonce: true do %>
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll("#job_class_filter, #job_state_filter, #job_queue_filter").forEach((filter) => {
filter.addEventListener("change", () => {
document.querySelector("#filter_form").submit();
});
})
})
<% end %>