From 0328d677563b4050c5727be92d3e4c51940c8ccc Mon Sep 17 00:00:00 2001 From: Wittiest <30442914+Wittiest@users.noreply.github.com> Date: Thu, 17 Oct 2024 21:07:41 -0700 Subject: [PATCH 1/2] Fix badge color for running jobs --- app/views/good_job/batches/_jobs.erb | 4 ++-- app/views/good_job/jobs/_table.erb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/good_job/batches/_jobs.erb b/app/views/good_job/batches/_jobs.erb index fbbe467e..1f1d307a 100644 --- a/app/views/good_job/batches/_jobs.erb +++ b/app/views/good_job/batches/_jobs.erb @@ -35,13 +35,13 @@
<%= t "good_job.models.job.attempts" %>
- <% if job.executions_count > 0 && job.status != :finished %> + <% if job.error && job.status != :finished %> <%= tag.span job.executions_count, class: "badge rounded-pill bg-danger", data: { bs_toggle: "popover", bs_trigger: "hover focus click", bs_placement: "bottom", - bs_content: job.recent_error, + bs_content: job.display_error, } %> <% else %> diff --git a/app/views/good_job/jobs/_table.erb b/app/views/good_job/jobs/_table.erb index 07c197b6..2bce30f5 100644 --- a/app/views/good_job/jobs/_table.erb +++ b/app/views/good_job/jobs/_table.erb @@ -84,7 +84,7 @@
<%= t "good_job.models.job.attempts" %>
- <% if job.executions_count > 0 && job.status != :succeeded %> + <% if job.error && job.status != :finished %> <%= tag.span job.executions_count, class: "badge rounded-pill bg-danger", data: { bs_toggle: "popover", From 1b7ffb0280f4cbe95c9ab24578a69b53a4329dbc Mon Sep 17 00:00:00 2001 From: "Ben Sheldon [he/him]" Date: Wed, 23 Oct 2024 12:57:54 -0700 Subject: [PATCH 2/2] Show warning color if job is finished with multiple attempts/executions; fix usage of nonexistent `:finished` status --- app/views/good_job/batches/_jobs.erb | 7 ++++--- app/views/good_job/jobs/_table.erb | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/views/good_job/batches/_jobs.erb b/app/views/good_job/batches/_jobs.erb index 1f1d307a..f6daf9dd 100644 --- a/app/views/good_job/batches/_jobs.erb +++ b/app/views/good_job/batches/_jobs.erb @@ -35,7 +35,7 @@
<%= t "good_job.models.job.attempts" %>
- <% if job.error && job.status != :finished %> + <% if job.error %> <%= tag.span job.executions_count, class: "badge rounded-pill bg-danger", data: { bs_toggle: "popover", @@ -45,7 +45,8 @@ } %> <% else %> - <%= job.executions_count %> + <% executions_badge_color = job.executions_count > 1 ? "bg-warning" : "bg-secondary" %> + <%= job.executions_count %> <% end %>
@@ -79,7 +80,7 @@ <% end %>
  • - <%= link_to job_path(job.id), method: :delete, class: "dropdown-item #{'disabled' unless job.status.in? [:discarded, :finished]}", title: t(".actions.destroy"), data: { confirm: t(".actions.confirm_destroy"), disable: true } do %> + <%= link_to job_path(job.id), method: :delete, class: "dropdown-item #{'disabled' unless job.finished?}", title: t(".actions.destroy"), data: { confirm: t(".actions.confirm_destroy"), disable: true } do %> <%= render_icon "trash" %> <%= t "good_job.actions.destroy" %> <% end %> diff --git a/app/views/good_job/jobs/_table.erb b/app/views/good_job/jobs/_table.erb index 2bce30f5..ac860915 100644 --- a/app/views/good_job/jobs/_table.erb +++ b/app/views/good_job/jobs/_table.erb @@ -84,7 +84,7 @@
  • <%= t "good_job.models.job.attempts" %>
    - <% if job.error && job.status != :finished %> + <% if job.error %> <%= tag.span job.executions_count, class: "badge rounded-pill bg-danger", data: { bs_toggle: "popover", @@ -94,7 +94,8 @@ } %> <% else %> - <%= job.executions_count %> + <% executions_badge_color = job.executions_count > 1 ? "bg-warning" : "bg-secondary" %> + <%= job.executions_count %> <% end %>