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

Add GoodJob::Job#display_name to allow customizing dashboard job display #1008

Merged
merged 2 commits into from
Jul 13, 2023
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
6 changes: 6 additions & 0 deletions app/models/good_job/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ def display_serialized_params
})
end

# Used when displaying this job in the GoodJob dashboard.
# @return [String]
def display_name
job_class
end

# Tests whether the job is being executed right now.
# @return [Boolean]
def running?
Expand Down
2 changes: 1 addition & 1 deletion app/views/good_job/batches/_jobs.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<div class="row align-items-center">
<div class="col-lg-4">
<%= tag.code link_to(job.id, job_path(job), class: "small text-muted text-decoration-none") %>
<%= tag.h5 tag.code(link_to(job.job_class, job_path(job), class: "text-reset text-decoration-none")), class: "text-reset mb-0" %>
<%= tag.h5 tag.code(link_to(job.display_name, job_path(job), class: "text-reset text-decoration-none")), class: "text-reset mb-0" %>
</div>
<div class="col-4 col-lg-1 text-lg-center">
<div class="d-lg-none small text-muted mt-1"><%=t "good_job.models.job.queue" %></div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/good_job/jobs/_table.erb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<%= check_box_tag 'job_ids[]', job.id, false, id: dom_id(job, :checkbox), data: { "checkbox-toggle-each": "job_ids" } %>
<div class="ms-2">
<%= tag.code link_to(job.id, job_path(job), class: "small text-muted text-decoration-none") %>
<%= tag.h5 tag.code(link_to(job.job_class, job_path(job), class: "text-reset text-decoration-none")), class: "text-reset mb-0" %>
<%= tag.h5 tag.code(link_to(job.display_name, job_path(job), class: "text-reset text-decoration-none")), class: "text-reset mb-0" %>
<% if job.error %>
<div class="mt-1 small">
<strong class="small"><%=t "good_job.shared.error" %>:</strong>
Expand Down
2 changes: 1 addition & 1 deletion app/views/good_job/jobs/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</nav>
<div class="row align-items-center">
<div class="col-md-5">
<h2 class="mb-2 mb-md-0"><%= tag.code @job.job_class %></h2>
<h2 class="mb-2 mb-md-0"><%= tag.code @job.display_name %></h2>
</div>
<div class="col-6 col-md-2">
<div class="small text-muted text-uppercase"><%= t "good_job.models.job.queue" %></div>
Expand Down