Skip to content

Commit

Permalink
Add button to toggle all job params in Dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
bensheldon committed Sep 7, 2021
1 parent b9b2f5b commit 30f8fa7
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions engine/app/views/good_job/shared/_jobs_table.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@
<div class="table-responsive">
<table class="table card-table table-bordered table-hover table-sm mb-0">
<thead>
<th>GoodJob ID</th>
<th>ActiveJob ID</th>
<th>Job Class</th>
<th>Queue</th>
<th>Scheduled At</th>
<th>Error</th>
<th>ActiveJob Params</th>
<th>Actions</th>
<tr>
<th>GoodJob ID</th>
<th>ActiveJob ID</th>
<th>Job Class</th>
<th>Queue</th>
<th>Scheduled At</th>
<th>Error</th>
<th>
ActiveJob Params&nbsp;
<%= tag.button "Toggle", type: "button", class: "btn btn-sm btn-outline-primary", role: "button",
data: { bs_toggle: "collapse", bs_target: ".job-params" },
aria: { expanded: false, controls: jobs.map { |job| "##{dom_id(job, "params")}" }.join(" ") }
%>
</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% jobs.each do |job| %>
Expand All @@ -22,10 +30,10 @@
<td class="text-break"><%= truncate(job.error, length: 1_000) %></td>
<td>
<%= tag.button "Preview", type: "button", class: "btn btn-sm btn-outline-primary", role: "button",
data: {bs_toggle: "collapse", bs_target: "##{dom_id(job, 'params')}"},
aria: {expanded: false, controls: dom_id(job, "params")}
data: { bs_toggle: "collapse", bs_target: "##{dom_id(job, 'params')}" },
aria: { expanded: false, controls: dom_id(job, "params") }
%>
<%= tag.pre JSON.pretty_generate(job.serialized_params), id: dom_id(job, "params"), class: "collapse" %>
<%= tag.pre JSON.pretty_generate(job.serialized_params), id: dom_id(job, "params"), class: "collapse job-params" %>
</td>
<td>
<%= button_to job_path(job.id), method: :delete, class: "btn btn-sm btn-outline-danger", title: "Delete job" do %>
Expand Down

0 comments on commit 30f8fa7

Please sign in to comment.