aboutsummaryrefslogtreecommitdiff
path: root/app/views/shared/_jobs.html.erb
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-04-07 15:30:44 +0100
committerChristopher Baines <mail@cbaines.net>2018-04-12 19:05:31 +0100
commit1f43c32aa4288f5aafafc426cfb955f84732d9e3 (patch)
tree691e37c60f99822e615662703a85b3c3e35a02e7 /app/views/shared/_jobs.html.erb
parent0a87ae262287d516b2a2c7c8db07c7d4393d5fa8 (diff)
downloadgovuk-mini-environment-admin-1f43c32aa4288f5aafafc426cfb955f84732d9e3.tar
govuk-mini-environment-admin-1f43c32aa4288f5aafafc426cfb955f84732d9e3.tar.gz
Improve the handling of jobs
Move the display in to a partial and improve. Handle the finished and enqueued jobs in a more consistent way.
Diffstat (limited to 'app/views/shared/_jobs.html.erb')
-rw-r--r--app/views/shared/_jobs.html.erb58
1 files changed, 58 insertions, 0 deletions
diff --git a/app/views/shared/_jobs.html.erb b/app/views/shared/_jobs.html.erb
new file mode 100644
index 0000000..e70e8ef
--- /dev/null
+++ b/app/views/shared/_jobs.html.erb
@@ -0,0 +1,58 @@
+
+<div class="panel-group"
+ id="accordion"
+ role="tablist"
+ aria-multiselectable="true">
+
+ <% jobs.each do |job| %>
+
+ <div class="panel panel-default">
+ <div class="panel-heading" role="tab" id="headingOne">
+ <h4 class="panel-title">
+ <a role="button"
+ data-toggle="collapse"
+ data-parent="#accordion"
+ href="#collapseOne"
+ aria-expanded="true"
+ aria-controls="collapseOne">
+ <%= job.job_class %>
+ </a>
+ <span class="pull-right">
+ <% if job.instance_of? FinishedTerraformJob %>
+ Job finished at <%= job.created_at %>
+ <% else %>
+ <%= job['error_count'] %> failures, retrying next in
+ <%= distance_of_time_in_words_to_now(
+ job.run_at, include_seconds: true
+ ) %>
+ <% end %>
+ </span>
+ </h4>
+ </div>
+ <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
+ <div class="panel-body">
+ <div class="row">
+ <div class="col-md-10">
+ <pre><%= job['last_error'] %></pre>
+ </div>
+ <div class="col-md-2">
+ <%= form_with(url: retry_now_que_job_path(job['job_id'])) do %>
+ <%= submit_tag(
+ 'Retry now',
+ class: 'btn btn-primary btn-lg btn-block'
+ ) %>
+ <% end %>
+ <%= form_with(url: cancel_que_job_path(job['job_id'])) do %>
+ <%= submit_tag(
+ 'Cancel Job',
+ class: 'btn btn-warning btn-lg btn-block',
+ style: 'margin-top: 5px;'
+ ) %>
+ <% end %>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <% end %>
+</div>