aboutsummaryrefslogtreecommitdiff
path: root/app/views/shared/_jobs.html.erb
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-06-23 22:05:25 +0100
committerChristopher Baines <mail@cbaines.net>2018-06-23 22:05:25 +0100
commit7932da468f41e7c2c3fdeb44cc92b0eb8a9e9267 (patch)
tree95a852ab5ec00d1743b9328e24ed13a0afd9d4df /app/views/shared/_jobs.html.erb
parentd0448444536721054748b98dbf84228b7a6c43da (diff)
downloadgovuk-mini-environment-admin-7932da468f41e7c2c3fdeb44cc92b0eb8a9e9267.tar
govuk-mini-environment-admin-7932da468f41e7c2c3fdeb44cc92b0eb8a9e9267.tar.gz
Improve the jobs partial
Use titles to provide additional information, add support for expired jobs and clean up the text.
Diffstat (limited to 'app/views/shared/_jobs.html.erb')
-rw-r--r--app/views/shared/_jobs.html.erb22
1 files 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 @@
<a role="button"
data-toggle="collapse"
data-parent="#accordion"
+ title="Job id: <%= job.id %>"
href="#job_<%= job.id %>"
aria-expanded="true"
aria-controls="job_<%= job.id %>"
>
+ Job:
<%= job.job_class.constantize.try(:job_title, job) || job.job_class %>
<span class="caret"></span>
</a>
<span class="pull-right">
<% if job.finished_at %>
- Job finished at <%= job.finished_at %>
+ <span title="<%= job.finished_at %>">
+ Finished
+ <%= distance_of_time_in_words_to_now(
+ job.run_at, include_seconds: true
+ ) %> ago
+ </span>
+ <% elsif job.expired_at %>
+ <span title="<%= job.expired_at %>">
+ Canceled at
+ <%= distance_of_time_in_words_to_now(
+ job.expired_at, include_seconds: true
+ ) %> ago
+ </span>
<% else %>
<% if job['error_count'] != 0 %>
<%= job['error_count'] %> failures,
@@ -59,7 +73,11 @@
</div>
<% elsif job.finished_at %>
<div class="col-md-12">
- 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 %>