diff --git a/app/controllers/admin/base_controller.rb b/app/controllers/admin/base_controller.rb
new file mode 100644
index 0000000..835b2df
--- /dev/null
+++ b/app/controllers/admin/base_controller.rb
@@ -0,0 +1,24 @@
+class Admin::BaseController < ApplicationController
+ before_action :require_admin
+
+ def index
+ @client_ids = Client.pluck(:ClientId)
+ get_charts
+ render 'admin/index'
+ end
+
+ protected
+
+ def get_charts
+ days_ago = params.fetch(:days_back, 7).to_i rescue 7
+ @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(:admin?)
+
+ flash[:alert] = 'You need to log in first'
+ redirect_to root_path
+ end
+end
diff --git a/app/views/admin/index.html.erb b/app/views/admin/index.html.erb
new file mode 100644
index 0000000..be1cc05
--- /dev/null
+++ b/app/views/admin/index.html.erb
@@ -0,0 +1,3 @@
+
BaaS
+
+<%= render partial: 'clients/client_graphs', locals: { path: admin_path } %>
diff --git a/app/views/shared/_nav.html.erb b/app/views/shared/_nav.html.erb
index 148beee..fefa4ff 100644
--- a/app/views/shared/_nav.html.erb
+++ b/app/views/shared/_nav.html.erb
@@ -1,29 +1,34 @@
diff --git a/config/routes.rb b/config/routes.rb
index b2d7f87..d8f978d 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,24 +1,28 @@
Rails.application.routes.draw do
+ root 'clients#index'
+
resources :clients, only: [:index, :show]
resources :hosts, only: [:new, :create, :show, :edit, :update, :destroy] do
member do
post :submit_config
get :restore
post :run_restore
delete :revoke
end
resources :jobs, only: [:new, :create, :show, :edit, :update, :destroy] do
member do
patch :toggle_enable
post :backup_now
end
end
resources :filesets, only: [:show, :new, :create, :destroy]
resources :schedules, only: [:show, :new, :edit, :create, :update, :destroy]
end
- root 'clients#index'
+ namespace :admin do
+ get '/' => 'base#index'
+ end
end