diff --git a/app/controllers/admin/base_controller.rb b/app/controllers/admin/base_controller.rb
index 051c184..f4276de 100644
--- a/app/controllers/admin/base_controller.rb
+++ b/app/controllers/admin/base_controller.rb
@@ -1,31 +1,36 @@
class Admin::BaseController < ApplicationController
before_action :require_admin, except: [:login]
# GET /admin
# POST /admin
def index
@client_ids = Client.pluck(:ClientId)
get_charts
@global_stats = GlobalStats.new.stats
+
+ @jobs = Job.includes(:file_set, :logs, :client).
+ where('EndTime > ?', days_ago.days.ago).
+ order(EndTime: :desc)
+
render 'admin/index'
end
# GET /admin/login
def login
render 'admin/login'
end
protected
def get_charts
@job_status = ChartGenerator.job_statuses(@client_ids, days_ago)
@job_stats = ChartGenerator.job_stats(@client_ids, days_ago - 1)
end
def require_admin
return if current_user.try(:has_admin_access?)
flash[:alert] = 'You need to log in first'
redirect_to admin_login_path
end
end
diff --git a/app/views/admin/index.html.erb b/app/views/admin/index.html.erb
index b1f74d3..cc42608 100644
--- a/app/views/admin/index.html.erb
+++ b/app/views/admin/index.html.erb
@@ -1,12 +1,14 @@
<%= bootstrap_form_tag(url: admin_path, method: :post, layout: :inline) do |f| %>
<%= f.select(:days_back, [['1 week', 7], ['2 weeks', 14], ['1 month', 30]], selected: params[:days_back]) %>
<%= f.submit 'See Stats', class: "btn btn-primary" %>
<% end %>
<%= render partial: 'clients/client_graphs', locals: { path: admin_path } %>
+
+<%= render partial: 'admin/jobs/jobs' %>
diff --git a/app/views/admin/jobs/_jobs.html.erb b/app/views/admin/jobs/_jobs.html.erb
new file mode 100644
index 0000000..83b8838
--- /dev/null
+++ b/app/views/admin/jobs/_jobs.html.erb
@@ -0,0 +1,9 @@
+
+
+
Recent Jobs (<%= @jobs.count %>)
+
+
+
+
+ <%= render partial: 'admin/jobs/recent_jobs' %>
+
diff --git a/app/views/admin/jobs/_recent_job.html.erb b/app/views/admin/jobs/_recent_job.html.erb
new file mode 100644
index 0000000..bac4d3c
--- /dev/null
+++ b/app/views/admin/jobs/_recent_job.html.erb
@@ -0,0 +1,15 @@
+
+ <%= recent_job.name %> |
+ <%= recent_job.client.name %> |
+ <%= recent_job.job_id %> |
+ <%= recent_job.level_human %> |
+ <%= recent_job.fileset %> |
+ <%= recent_job.start_time_formatted %> |
+ <%= recent_job.end_time_formatted %> |
+ <%= recent_job.duration %> |
+ <%= number_to_human_size(recent_job.job_bytes) %> |
+ <%= number_by_magnitude(recent_job.job_files) %> |
+ <%= recent_job.status_human %> |
+ <%= recent_job.encryption %> |
+ <%= recent_job.compression %> |
+
diff --git a/app/views/admin/jobs/_recent_jobs.html.erb b/app/views/admin/jobs/_recent_jobs.html.erb
new file mode 100644
index 0000000..07df9d7
--- /dev/null
+++ b/app/views/admin/jobs/_recent_jobs.html.erb
@@ -0,0 +1,26 @@
+
+
+
+
+
+ Name |
+ Client |
+ JobId |
+ Level |
+ Fileset |
+ Started At |
+ Finished At |
+ Duration |
+ Bytes |
+ Files |
+ Status |
+ Encryption |
+ Compression |
+
+
+
+ <%= render partial: 'admin/jobs/recent_job', collection: @jobs %>
+
+
+
+