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

Fix badge color for running jobs #1525

Merged
Merged
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
9 changes: 5 additions & 4 deletions app/views/good_job/batches/_jobs.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,18 @@
</div>
<div class="col-4 col-lg-1 text-lg-end">
<div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.job.attempts" %></div>
<% if job.executions_count > 0 && job.status != :finished %>
<% if job.error %>
<%= 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 %>
<span class="badge bg-secondary rounded-pill"><%= job.executions_count %></span>
<% executions_badge_color = job.executions_count > 1 ? "bg-warning" : "bg-secondary" %>
<span class="badge rounded-pill <%= executions_badge_color %>"><%= job.executions_count %></span>
<% end %>
</div>
<div class="mt-3 mt-lg-0 col d-flex gap-3 align-items-center justify-content-end">
Expand Down Expand Up @@ -79,7 +80,7 @@
<% end %>
</li>
<li>
<%= 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 %>
Expand Down
5 changes: 3 additions & 2 deletions app/views/good_job/jobs/_table.erb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
</div>
<div class="col-4 col-lg-1 text-lg-end">
<div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.job.attempts" %></div>
<% if job.executions_count > 0 && job.status != :succeeded %>
<% if job.error %>
<%= tag.span job.executions_count, class: "badge rounded-pill bg-danger",
data: {
bs_toggle: "popover",
Expand All @@ -94,7 +94,8 @@
}
%>
<% else %>
<span class="badge bg-secondary rounded-pill"><%= job.executions_count %></span>
<% executions_badge_color = job.executions_count > 1 ? "bg-warning" : "bg-secondary" %>
<span class="badge rounded-pill <%= executions_badge_color %>"><%= job.executions_count %></span>
<% end %>
</div>
<div class="mt-3 mt-lg-0 col">
Expand Down