diff --git a/app/controllers/admin/jobs_controller.rb b/app/controllers/admin/jobs_controller.rb
index 16b14a7..2f59da4 100644
--- a/app/controllers/admin/jobs_controller.rb
+++ b/app/controllers/admin/jobs_controller.rb
@@ -1,20 +1,22 @@
module Admin
class JobsController < ApplicationController
before_action :authenticate_user!
before_action :admin_only!
# GET /jobs
def index
- @pending = Job.pending
- @completed = Job.completed.order('id desc')
+ @job_categories = {
+ 'Pending' => Job.pending,
+ 'Completed' => Job.completed.order('id desc')
+ }
end
# DELETE /jobs/1
def destroy
@job = Job.find(params[:id])
@job.destroy
redirect_to admin_jobs_url, notice: "#{@job.id} was successfully destroyed."
end
end
end
diff --git a/app/views/admin/jobs/index.html.erb b/app/views/admin/jobs/index.html.erb
index 5318f90..9462c91 100644
--- a/app/views/admin/jobs/index.html.erb
+++ b/app/views/admin/jobs/index.html.erb
@@ -1,70 +1,39 @@
-
Pending Jobs
+<% @job_categories.each do |title, jobs| %>
+<%= title%> Jobs
Id |
Created at |
Domain |
Type |
Args |
Retries |
Controls |
- <% @pending.each do |job| %>
+ <% jobs.each do |job| %>
<%= job.id %> |
<%= job.created_at %> |
<% if job.domain %>
<%= link_to job.domain.name, domain_path(job.domain) %> |
<% else %>
<%= job.arguments['zone'] %> |
<% end %>
<%= job.job_type %> |
<% if job.args.size > 70 %>
<%= truncate(job.args, length: 70) %> |
<% else %>
<%= job.args %> |
<% end %>
<%= job.retries %> |
<%= link_to_destroy admin_job_path(job), method: :delete, data: { confirm: 'Are you sure?' } %> |
<% end %>
-
-Completed Jobs
-
-
-
- Id |
- Created At |
- Domain |
- Type |
- Args |
- Retries |
- Controls |
-
-
-
-
- <% @completed.each do |job| %>
-
- <%= job.id %> |
- <%= job.created_at %> |
- <% if job.domain %>
- <%= link_to job.domain.name, domain_path(job.domain) %> |
- <% else %>
- <%= job.arguments['zone'] %> |
- <% end %>
- <%= job.job_type %> |
- <%= job.args %> |
- <%= job.retries %> |
- <%= link_to_destroy admin_job_path(job), method: :delete, data: { confirm: 'Are you sure?' } %> |
-
- <% end %>
-
-
+<% end %>