Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F905000
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Aug 29, 7:08 PM
Size
6 KB
Mime Type
text/x-diff
Expires
Sun, Aug 31, 7:08 PM (20 h, 29 m)
Engine
blob
Format
Raw Data
Handle
252383
Attached To
rARCHIVING archiving
View Options
diff --git a/app/controllers/admin/hosts_controller.rb b/app/controllers/admin/hosts_controller.rb
index 0afab20..cb281ce 100644
--- a/app/controllers/admin/hosts_controller.rb
+++ b/app/controllers/admin/hosts_controller.rb
@@ -1,20 +1,32 @@
class Admin::HostsController < Admin::BaseController
- before_action :fetch_host, only: [:verify]
+ before_action :fetch_host, only: [:verify, :set_quota]
# GET /admin/hosts/unverified
def unverified
@hosts = Host.unverified
end
# POST /admin/hosts/1/verify
def verify
@host.verify(current_user.id)
redirect_to unverified_admin_hosts_path
end
+ # PUT /admin/hosts/1/set_quota
+ def set_quota
+ @host.quota = params[:host][:quota]
+ if @host.save
+ flash[:success] = 'Changes saved'
+ else
+ flash[:error] = 'Changes not saved'
+ end
+
+ redirect_to admin_client_path(@host.client)
+ end
+
private
def fetch_host
@host = Host.find(params[:id])
end
end
diff --git a/app/views/admin/clients/show.html.erb b/app/views/admin/clients/show.html.erb
index fc79cd3..c488a54 100644
--- a/app/views/admin/clients/show.html.erb
+++ b/app/views/admin/clients/show.html.erb
@@ -1,46 +1,71 @@
<%= render partial: 'header' %>
<div class="row right">
+ <%= link_to '#', data: { toggle: 'modal', target: ".js-quota:first"},
+ class: "btn btn-default", role: "button" do %>
+ <label class="glyphicon glyphicon-edit text-primary"></label>
+ Set Quota
+ <% end %>
+
<% if @client.host.can_set_inactive? %>
<%= link_to 'Disable client', disable_admin_client_path(@client), method: :post,
data: { confirm: 'This will disable the client. Are you sure?' },
class: "btn btn-warning", role: "button" %>
<% end %>
<% if @client.host.can_block? %>
<%= link_to 'Lock client', block_admin_client_path(@client), method: :post,
data: { confirm: 'This will disable and lock the client. Are you sure?' },
class: "btn btn-warning", role: "button" %>
<% end %>
<% if @client.host.blocked? %>
<%= link_to 'Unlock client', unblock_admin_client_path(@client), method: :post,
data: { confirm: 'This will unlock the client. Are you sure?' },
class: "btn btn-warning", role: "button" %>
<% end %>
<%= link_to 'Remove client', revoke_admin_client_path(@client), method: :delete,
data: { confirm: 'This will REMOVE the client from Bacula. Are you sure?' },
class: "btn btn-danger", role: "button" %>
</div>
<div class="row">
<div class="col-xs-4">
<h3>Client Details</h3>
</div>
<div class="col-xs-6">
<h3>Bacula Jobs</h3>
</div>
</div>
<div class="row">
<%= render partial: 'client_details' %>
<div class="col-xs-8">
<div class="row">
<% if @client.host %>
<%= render partial: 'jobs' %>
<% end %>
</div>
</div>
</div>
+
+<div class="modal fade js-quota" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="panel panel-default">
+ <div class="panel-heading">Set Quota for "<%= @client.name %>"</div>
+ <div class="panel-body">
+ <%= bootstrap_form_for(@client.host,
+ url: set_quota_admin_host_path(@client.host),
+ method: :put, layout: :inline) do |f| %>
+ <%= f.number_field :quota, min: 1 %>
+ <%= f.submit class: 'btn btn-success' %>
+ <% end %>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+
diff --git a/config/routes.rb b/config/routes.rb
index 41a7982..d1c4b6a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,106 +1,107 @@
Rails.application.routes.draw do
root 'application#index'
get 'faq' => 'application#faq'
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: [] do
collection do
get :unverified
end
member do
post :verify
+ put :set_quota
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]
resources :faqs
end
end
Event Timeline
Log In to Comment