diff --git a/app/controllers/admin/clients_controller.rb b/app/controllers/admin/clients_controller.rb index 5d20566..06b1f50 100644 --- a/app/controllers/admin/clients_controller.rb +++ b/app/controllers/admin/clients_controller.rb @@ -1,53 +1,57 @@ class Admin::ClientsController < Admin::BaseController - before_action :fetch_client, only: [:show, :jobs, :logs, :stats] + before_action :fetch_client, only: [:show, :jobs, :logs, :stats, :configuration] before_action :fetch_logs, only: [:logs] # Shows all available clients # # GET /admin/clients def index @clients = Client.includes(:jobs).all @client_ids = @clients.map(&:id) fetch_jobs_info end # Shows a specific client # # GET /admin/clients/1 def show get_charts end # GET /admin/clients/1/jobs def jobs @jobs = @client.recent_jobs.page(params[:page]) end # GET /admin/clients/1/logs def logs end # GET /admin/clients/1/stats # POST /admin/clients/1/stats def stats get_charts end + # GET /admin/clients/1/configuration + def configuration + end + private # Fetches the client based on the given id def fetch_client @client = Client.find(params[:id]) @client_ids = [@client.id] end def fetch_jobs_info @stats = JobStats.new end 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 end diff --git a/app/views/admin/clients/_header.html.erb b/app/views/admin/clients/_header.html.erb index a19da88..0ffe29f 100644 --- a/app/views/admin/clients/_header.html.erb +++ b/app/views/admin/clients/_header.html.erb @@ -1,11 +1,12 @@

<%= notice %>

<%= breadcrumb_with Client: admin_client_path(@client), Jobs: jobs_admin_client_path(@client), Stats: stats_admin_client_path(@client), - Logs: logs_admin_client_path(@client) %> + Logs: logs_admin_client_path(@client), + Config: configuration_admin_client_path(@client) %>

<%= @client.name %> <%= host_status_label(@client.host) %>

diff --git a/app/views/admin/clients/configuration.html.erb b/app/views/admin/clients/configuration.html.erb new file mode 100644 index 0000000..db53153 --- /dev/null +++ b/app/views/admin/clients/configuration.html.erb @@ -0,0 +1,15 @@ +<%= render partial: 'header' %> + +
+
+

Bacula Configuration

+
+
+ +
+
+
+<%= @client.bacula_config %>
+    
+
+
diff --git a/config/routes.rb b/config/routes.rb index 1fee145..8dae782 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,58 +1,59 @@ Rails.application.routes.draw do root 'clients#index' resources :clients, only: [:index, :show] do member do get :jobs get :logs get :stats post :stats end collection do post :index end end 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 namespace :admin do match '/', to: 'base#index', via: [:get, :post] resources :clients, only: [:index, :show] do member do get :jobs get :logs get :stats post :stats + get :configuration end end resources :hosts, only: [:show] do collection do get :unverified end member do post :verify end end end end