Skip to content

Truncate string arguments displayed in failed jobs index #265

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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: 7 additions & 2 deletions app/helpers/mission_control/jobs/jobs_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ def job_title(job)
job.job_class_name
end

def job_arguments(job)
renderable_job_arguments_for(job).join(", ")
def job_arguments(job, truncate: false)
args = renderable_job_arguments_for(job).join(", ")
if truncate && args.length > 800
"#{args[0..800]}..."
else
args
end
end

def failed_job_error(job)
Expand Down
2 changes: 1 addition & 1 deletion app/views/mission_control/jobs/jobs/_job.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<%= link_to job_title(job), application_job_path(@application, job.job_id) %>

<% if job.serialized_arguments.present? %>
<div class="is-family-monospace"><%= job_arguments(job) %></div>
<div class="is-family-monospace"><%= job_arguments(job, truncate: true) %></div>
<% end %>

<div class="has-text-grey is-size-7">Enqueued <%= time_distance_in_words_with_title(job.enqueued_at.to_datetime) %> ago</div>
Expand Down