diff --git a/app/controllers/admin/pools_controller.rb b/app/controllers/admin/pools_controller.rb index dadb7c0..69dd388 100644 --- a/app/controllers/admin/pools_controller.rb +++ b/app/controllers/admin/pools_controller.rb @@ -1,58 +1,36 @@ class Admin::PoolsController < Admin::BaseController - before_action :fetch_pool, only: [:show, :edit, :update] # GET /admin/pools def index @pools = Pool.all end # GET /admin/pools/new def new @pool = Pool.new end - # GET /admin/pools/:id/edit - def edit; end - - # GET /admin/pools/:id - def show; end - # POST /admin/pools def create @pool = Pool.new(fetch_params) if @pool.submit_to_bacula flash[:success] = 'Pool created succesfully' redirect_to admin_pools_path else flash[:alert] = 'Pool not created' render :new end end - # PATCH /admin/pools/:id - def update - if @pool.update_attributes(fetch_params) - flash[:success] = 'Pool updated succesfully' - redirect_to admin_pools_path - else - flash[:alert] = 'Pool not updated' - render :edit - end - end - private - def fetch_pool - @pool = Pool.find(params[:id]) - end - def fetch_params params.require(:pool).permit( [ :name, :name_confirmation, :vol_retention, :use_once, :auto_prune, :recycle, :max_vols, :max_vol_jobs, :max_vol_files, :max_vol_bytes, :label_format ] ) end end diff --git a/app/views/admin/pools/_pool.html.erb b/app/views/admin/pools/_pool.html.erb index 6300b7d..451bf8d 100644 --- a/app/views/admin/pools/_pool.html.erb +++ b/app/views/admin/pools/_pool.html.erb @@ -1,14 +1,14 @@ - <%= link_to "##{pool.id}", admin_pool_path(pool) %> - <%= link_to pool.name, admin_pool_path(pool) %> + <%= "##{pool.id}" %> + <%= pool.name %> <%= pool.max_vols %> <%= yes_no(pool.use_once) %> <%= pool.vol_retention_human %> <%= pool.max_vol_jobs %> <%= pool.max_vol_files %> <%= number_to_human_size pool.max_vol_bytes %> <%= yes_no(pool.auto_prune) %> <%= pool.label_format %> <%= yes_no(pool.recycle) %> <%= pool.pool_type %> diff --git a/config/routes.rb b/config/routes.rb index 89647b7..1d6b884 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,103 +1,103 @@ Rails.application.routes.draw do root 'application#index' post 'grnet' => 'application#grnet' get 'institutional' => 'application#institutional' match 'vima', to: 'application#vima', :via => [:get, :post] get 'logout' => 'application#logout' resources :clients, only: [:index, :show] do member do get :jobs get :logs get :stats post :stats get :users get :restore post :run_restore post :restore_selected delete :remove_user end collection do post :index end end resources :clients, only: [], param: :client_id do member do get :tree end end resources :invitations, only: [:create] get '/invitations/:host_id/:verification_code/accept' => 'invitations#accept', as: :accept_invitation resources :hosts, only: [:new, :create, :show, :edit, :update, :destroy] do member do post :submit_config post :disable delete :revoke end collection do get :fetch_vima_hosts, to: 'hosts#fetch_vima_hosts', as: :fetch_vima 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, :edit, :update, :destroy] resources :schedules, only: [:show, :new, :edit, :create, :update, :destroy] end namespace :admin do match '/', to: 'base#index', via: [:get, :post] get '/login' => 'base#login', as: :login resources :settings, only: [:index, :new, :create, :edit, :update] do member do delete :reset end end resources :clients, only: [:index, :show] do member do get :jobs get :logs get :stats post :stats get :configuration post :disable post :block post :unblock delete :revoke end end resources :hosts, only: [:show] do collection do get :unverified end member do post :verify end end resources :users, only: [:index, :new, :create, :show, :edit, :update] do member do patch :ban patch :unban end end - resources :pools, only: [:index, :new, :create, :show, :edit, :update] + resources :pools, only: [:index, :new, :create] end end diff --git a/spec/routing/admin/pools_routing_spec.rb b/spec/routing/admin/pools_routing_spec.rb index a49827d..b6ccbfc 100644 --- a/spec/routing/admin/pools_routing_spec.rb +++ b/spec/routing/admin/pools_routing_spec.rb @@ -1,32 +1,17 @@ require 'spec_helper' describe Admin::PoolsController do it 'routes GET /admin/pools' do expect(get('/admin/pools')).to route_to(controller: 'admin/pools', action: 'index') end it 'routes GET /admin/pools/new' do expect(get('/admin/pools/new')). to route_to(controller: 'admin/pools', action: 'new') end - it 'routes GET /admin/pools/1' do - expect(get('/admin/pools/1')). - to route_to(controller: 'admin/pools', action: 'show', id: '1') - end - - it 'routes GET /admin/pools/1/edit' do - expect(get('/admin/pools/1/edit')). - to route_to(controller: 'admin/pools', action: 'edit', id: '1') - end - it 'routes POST /admin/pools' do expect(post('/admin/pools')). to route_to(controller: 'admin/pools', action: 'create') end - - it 'routes PATCH /admin/pools/1' do - expect(patch('/admin/pools/1')). - to route_to(controller: 'admin/pools', action: 'update', id: '1') - end end