From 7932da468f41e7c2c3fdeb44cc92b0eb8a9e9267 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 23 Jun 2018 22:05:25 +0100 Subject: Improve the jobs partial Use titles to provide additional information, add support for expired jobs and clean up the text. --- app/views/shared/_jobs.html.erb | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/app/views/shared/_jobs.html.erb b/app/views/shared/_jobs.html.erb index 71d93da..a507267 100644 --- a/app/views/shared/_jobs.html.erb +++ b/app/views/shared/_jobs.html.erb @@ -15,16 +15,30 @@ + Job: <%= job.job_class.constantize.try(:job_title, job) || job.job_class %> <% if job.finished_at %> - Job finished at <%= job.finished_at %> + + Finished + <%= distance_of_time_in_words_to_now( + job.run_at, include_seconds: true + ) %> ago + + <% elsif job.expired_at %> + + Canceled at + <%= distance_of_time_in_words_to_now( + job.expired_at, include_seconds: true + ) %> ago + <% else %> <% if job['error_count'] != 0 %> <%= job['error_count'] %> failures, @@ -59,7 +73,11 @@ <% elsif job.finished_at %>
- Finished after <%= job['error_count'] %> errors. + <% if job['error_count'] == 0 %> + Finished without any errors + <% else %> + Finished after <%= pluralize(job['error_count'], 'error') %>. + <% end %> <% if job.args.last == 'build' %> <%# TODO: Generalise this somehow %> -- cgit v1.2.3