Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F1615105
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Mar 21, 6:28 PM
Size
3 KB
Mime Type
text/x-diff
Expires
Mon, Mar 23, 6:28 PM (1 d, 15 h)
Engine
blob
Format
Raw Data
Handle
354301
Attached To
rWEBDNS WebDNS (edet4)
View Options
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 @@
-<h2>Pending Jobs</h2>
+<% @job_categories.each do |title, jobs| %>
+<h2><%= title%> Jobs</h2>
<table class="table table-striped">
<thead>
<tr>
<th>Id</th>
<th>Created at</th>
<th>Domain</th>
<th>Type</th>
<th>Args</th>
<th>Retries</th>
<th>Controls</th>
</tr>
</thead>
<tbody>
- <% @pending.each do |job| %>
+ <% jobs.each do |job| %>
<tr>
<td><%= job.id %></td>
<td><%= job.created_at %></td>
<% if job.domain %>
<td><%= link_to job.domain.name, domain_path(job.domain) %></td>
<% else %>
<td><%= job.arguments['zone'] %></td>
<% end %>
<td><%= job.job_type %></td>
<% if job.args.size > 70 %>
<td data-toggle="tooltip" data-placement="right" title="<%= job.args %>"><%= truncate(job.args, length: 70) %></td>
<% else %>
<td><%= job.args %></td>
<% end %>
<td><%= job.retries %></td>
<td><%= link_to_destroy admin_job_path(job), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
-
-<h2>Completed Jobs</h2>
-<table class="table table-striped">
- <thead>
- <tr>
- <th>Id</th>
- <th>Created At</th>
- <th>Domain</th>
- <th>Type</th>
- <th>Args</th>
- <th>Retries</th>
- <th>Controls</th>
- </tr>
- </thead>
-
- <tbody>
- <% @completed.each do |job| %>
- <tr class="<%= job.failed? ? 'warning' : '' %>">
- <td><%= job.id %></td>
- <td><%= job.created_at %></td>
- <% if job.domain %>
- <td><%= link_to job.domain.name, domain_path(job.domain) %></td>
- <% else %>
- <td><%= job.arguments['zone'] %></td>
- <% end %>
- <td><%= job.job_type %></td>
- <td><%= job.args %></td>
- <td><%= job.retries %></td>
- <td><%= link_to_destroy admin_job_path(job), method: :delete, data: { confirm: 'Are you sure?' } %></td>
- </tr>
- <% end %>
- </tbody>
-</table>
+<% end %>
Event Timeline
Log In to Comment