From b6c53cd855af16d90bac5f9b0d78b8c5f6cf5baf Mon Sep 17 00:00:00 2001 From: Scott Schneider Date: Fri, 10 Apr 2015 09:38:55 -0700 Subject: [PATCH] Redirect / to /dashboard --- lib/vmpooler/api.rb | 14 +++++++++++--- lib/vmpooler/dashboard.rb | 9 +++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 lib/vmpooler/dashboard.rb diff --git a/lib/vmpooler/api.rb b/lib/vmpooler/api.rb index 2219614..70bd319 100644 --- a/lib/vmpooler/api.rb +++ b/lib/vmpooler/api.rb @@ -17,11 +17,19 @@ module Vmpooler end get '/' do - erb :dashboard, locals: { - site_name: $config[:config]['site_name'] || 'vmpooler' - } + redirect to('/dashboard/') end + # Load dashboard components + begin + require "dashboard" + rescue LoadError + require File.expand_path(File.join(File.dirname(__FILE__), 'dashboard')) + end + + use Vmpooler::Dashboard + + # Load API components %w( dashboard reroute v1 ).each do |lib| begin require "api/#{lib}" diff --git a/lib/vmpooler/dashboard.rb b/lib/vmpooler/dashboard.rb new file mode 100644 index 0000000..56259d6 --- /dev/null +++ b/lib/vmpooler/dashboard.rb @@ -0,0 +1,9 @@ +module Vmpooler + class Dashboard < Sinatra::Base + get '/dashboard/?' do + erb :dashboard, locals: { + site_name: $config[:config]['site_name'] || 'vmpooler' + } + end + end +end