Page MenuHomeGRNET

No OneTemporary

File Metadata

Created
Wed, Oct 15, 11:25 AM
diff --git a/app/controllers/admin/clients_controller.rb b/app/controllers/admin/clients_controller.rb
index 8c29a4f..b3ed6bf 100644
--- a/app/controllers/admin/clients_controller.rb
+++ b/app/controllers/admin/clients_controller.rb
@@ -1,106 +1,106 @@
class Admin::ClientsController < Admin::BaseController
before_action :fetch_client, only: [:show, :jobs, :logs, :stats, :configuration,
:disable, :revoke, :block, :unblock]
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
if !@client.host.present?
flash[:alert] = 'Client not configured through Archiving'
return redirect_to admin_clients_path
end
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
# POST /admin/clients/1/disable
def disable
if @client.host.disable_jobs_and_update
flash[:success] = 'Client disabled'
else
flash[:error] = 'Something went wrong, try again later'
end
redirect_to admin_client_path(@client)
end
# POST /admin/clients/1/block
def block
if @client.host.disable_jobs_and_lock
flash[:success] = 'Client is disabled and locked'
else
flash[:error] = 'Something went wrong, try again'
end
redirect_to admin_client_path(@client)
end
# POST /admin/clients/1/unblock
def unblock
if @client.host.unblock
- flash[:success] = 'Client can know be configured by users'
+ flash[:success] = 'Client can now be configured by users'
else
flash[:error] = 'Client is still locked'
end
redirect_to admin_client_path(@client)
end
# DELETE /admin/clients/1/revoke
def revoke
if @client.host.remove_from_bacula(true)
flash[:success] = 'Client removed. It will be visible to until its jobs get cleaned up'
else
flash[:error] = 'Something went wrong, try again later'
end
redirect_to admin_clients_path
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
@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/hosts/show.html.erb b/app/views/hosts/show.html.erb
index 4376b2d..14fd87d 100644
--- a/app/views/hosts/show.html.erb
+++ b/app/views/hosts/show.html.erb
@@ -1,33 +1,33 @@
-<%= notifier(@host.display_message) unless @host.deployed? %>
+<%= notifier(@host.display_message) unless @host.deployed? || @host.blocked? %>
<%= render partial: 'header' %>
<div class="row">
<div id='host-tabs' class='tab-content'>
<div role="tabpanel" class="tab-pane active" id="details">
<%= render partial: "host_details" %>
</div>
<div role="tabpanel" class="tab-pane" id="jobs">
<%= render partial: "jobs/job_templates" %>
</div>
<div role="tabpanel" class="tab-pane" id="fd-config">
<%= render partial: "fd_config" %>
</div>
</div>
</div>
<%= render partial: 'jobs/modals' %>
<script type='text/javascript'>
var hash = document.location.hash;
var prefix = "tab_";
if (hash) {
$('.nav-tabs a[href="'+hash.replace(prefix,"")+'"]').tab('show');
}
// Change hash for page-reload
$('.nav-tabs a').on('shown', function (e) {
window.location.hash = e.target.hash.replace("#", "#" + prefix);
});
</script>

Event Timeline