aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-07-01 09:10:48 +0100
committerChristopher Baines <mail@cbaines.net>2018-07-01 09:10:48 +0100
commitafd83a42629ab865d1338c823dd04556c00e52cf (patch)
tree984e840ae4a1176687d1f382eae8581b77792b1b
parent5ba97ad556728c5a74aa86b1d18b98f4ad5e38a9 (diff)
downloadgovuk-mini-environment-admin-release_3.tar
govuk-mini-environment-admin-release_3.tar.gz
Add a really basic que_jobs index pagerelease_3
-rw-r--r--app/controllers/que_jobs_controller.rb4
-rw-r--r--app/views/que_jobs/index.html.erb7
-rw-r--r--app/views/shared/_jobs.html.erb2
-rw-r--r--config/routes.rb2
4 files changed, 13 insertions, 2 deletions
diff --git a/app/controllers/que_jobs_controller.rb b/app/controllers/que_jobs_controller.rb
index 36d5558..a4607d9 100644
--- a/app/controllers/que_jobs_controller.rb
+++ b/app/controllers/que_jobs_controller.rb
@@ -19,6 +19,10 @@
# <http://www.gnu.org/licenses/>.
class QueJobsController < ApplicationController
+ def index
+ @jobs = QueJob.order(id: :desc)
+ end
+
def cancel
Que.execute :expire_job, [job_id]
diff --git a/app/views/que_jobs/index.html.erb b/app/views/que_jobs/index.html.erb
new file mode 100644
index 0000000..0824ef9
--- /dev/null
+++ b/app/views/que_jobs/index.html.erb
@@ -0,0 +1,7 @@
+
+<%= render(
+ partial: 'shared/jobs',
+ locals: {
+ jobs: @jobs
+ }
+) %>
diff --git a/app/views/shared/_jobs.html.erb b/app/views/shared/_jobs.html.erb
index de6d7c1..951fa06 100644
--- a/app/views/shared/_jobs.html.erb
+++ b/app/views/shared/_jobs.html.erb
@@ -88,7 +88,7 @@
<% if job.args.last == 'build' %>
<%# TODO: Generalise this somehow %>
<dl class="dl-horizontal">
- <% @mini_environment.backend_data.each do |(key, value)| %>
+ <% (@mini_environment.try(:backend_data) || []).each do |(key, value)| %>
<dt><%= key %></dt>
<dd><pre><%= value %></pre></dd>
<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index ce7b624..8e55628 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -33,7 +33,7 @@ Rails.application.routes.draw do
end
end
- resources :que_jobs, only: [] do
+ resources :que_jobs, only: %i[index] do
member do
post 'cancel'
post 'retry_now'