Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F886145
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 8, 9:20 PM
Size
8 KB
Mime Type
text/x-diff
Expires
Sun, Aug 10, 9:20 PM (10 h, 55 m)
Engine
blob
Format
Raw Data
Handle
245676
Attached To
rARCHIVING archiving
View Options
diff --git a/app/controllers/admin/clients_controller.rb b/app/controllers/admin/clients_controller.rb
index d954390..8bc27dc 100644
--- a/app/controllers/admin/clients_controller.rb
+++ b/app/controllers/admin/clients_controller.rb
@@ -1,120 +1,121 @@
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.joins(:host).includes(:jobs).distinct.all
@client_ids = @clients.map(&:id)
fetch_jobs_info
end
# Shows all clients that are not in Archiving but are still persisted to bacula
#
# GET /admin/clients/obsolete
def obsolete
in_archiving = Client.joins(:host).distinct.pluck(:ClientId)
@clients = Client.includes(:jobs).where.not(ClientId: in_archiving).
distinct.all
@client_ids = @clients.map(&:id)
fetch_jobs_info
@obsolete = true
render :index
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
+ # GET /admin/clients/1/logs?job_id=1
def logs
+ @job = @client.jobs.find(params[:job_id])
+ @logs = @job.logs.page(params[:page]).per(50)
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 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/admin/clients/_header.html.erb b/app/views/admin/clients/_header.html.erb
index 2fe85e4..224be0d 100644
--- a/app/views/admin/clients/_header.html.erb
+++ b/app/views/admin/clients/_header.html.erb
@@ -1,40 +1,39 @@
<p id="notice"><%= notice %></p>
<h2>
<%= @client.name %>
<%= host_status_label(@client.host) %>
</h2>
<% if local_assigns[:actions].presence == true %>
<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_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>
<% end %>
<%= tabs_with Client: admin_client_path(@client),
'Recent Jobs' => jobs_admin_client_path(@client),
Stats: stats_admin_client_path(@client),
- Logs: logs_admin_client_path(@client),
Config: configuration_admin_client_path(@client) %>
<br />
diff --git a/app/views/admin/clients/_log.html.erb b/app/views/admin/clients/_log.html.erb
index 0826e59..ddeee99 100644
--- a/app/views/admin/clients/_log.html.erb
+++ b/app/views/admin/clients/_log.html.erb
@@ -1,9 +1,9 @@
<tr>
<td><%= log.log_id %></td>
- <td><%= log.job.id %></td>
- <td><%= log.job.name %></td>
+ <td><%= @job.id %></td>
+ <td><%= @job.name %></td>
<td><%= log.time_formatted %></td>
<td style='max-width: 650px'><pre class='pre-scrollable'>
<%= log.log_text %>
</pre></td>
</tr>
diff --git a/app/views/admin/clients/_recent_job.html.erb b/app/views/admin/clients/_recent_job.html.erb
index a7ff17c..664f676 100644
--- a/app/views/admin/clients/_recent_job.html.erb
+++ b/app/views/admin/clients/_recent_job.html.erb
@@ -1,12 +1,14 @@
<tr class="<%= success_class(recent_job.job_status) %>">
<td><%= recent_job.name %></td>
- <td><%= recent_job.job_id %></td>
+ <td>
+ <%= link_to recent_job.job_id, logs_admin_client_path(@client.id, job_id: recent_job.job_id) %>
+ </td>
<td><%= recent_job.level_human %></td>
<td><%= recent_job.fileset %></td>
<td><%= recent_job.start_time_formatted %></td>
<td><%= recent_job.end_time_formatted %></td>
<td><%= recent_job.duration %></td>
<td><%= number_to_human_size(recent_job.job_bytes) %></td>
<td><%= number_by_magnitude(recent_job.job_files) %></td>
<td><%= recent_job.status_human %></td>
</tr>
diff --git a/app/views/admin/clients/logs.html.erb b/app/views/admin/clients/logs.html.erb
index 5388966..8725bed 100644
--- a/app/views/admin/clients/logs.html.erb
+++ b/app/views/admin/clients/logs.html.erb
@@ -1,46 +1,57 @@
-<%= render partial: 'header' %>
+<p id="notice"><%= notice %></p>
+
+<h2>
+ <%= @client.name %>
+ <%= host_status_label(@client.host) %>
+</h2>
+
+<ul class="nav nav-tabs" role="tablist">
+ <li role="presentation">
+ <%= link_to 'Client', admin_client_path(@client), 'aria-controls' => "client", role: "tab" %>
+ </li>
+ <li role="presentation" class="active">
+ <%= link_to 'Recent Jobs', jobs_admin_client_path(@client),
+ 'aria-controls' => "recent jobs", role: "tab" %>
+ <li role="presentation">
+ <%= link_to 'Stats', stats_admin_client_path(@client), 'aria-controls' => "stats", role: "tab" %>
+ </li>
+ <li role="presentation">
+ <%= link_to 'Config', configuration_admin_client_path(@client),
+ 'aria-controls' => "config", role: "tab" %>
+ </li>
+</ul>
+
+<br />
<div class='row'>
<div class='col-xs-3'>
<h3>Logs <small>(<%= @logs.count %>)</small></h3>
</div>
<div class="col-xs-4 right text-right">
<%= page_entries_info @logs, entry_name: 'log' %>
<%= paginate @logs %>
</div>
</div>
<div class="row">
<div class="col-xs-12">
- <%= bootstrap_form_tag(url: '', method: :get, layout: :inline) do |form| %>
- <%= form.text_field :start_date, value: @dates[:start],
- class: 'datepicker' %>
- <%= form.text_field :end_date, value: @dates[:end],
- class: 'datepicker' %>
- <%= form.submit 'Show Logs', class: 'btn btn-default' %>
- <% end %>
- </div>
-</div>
-
-<div class="row">
- <div class="col-xs-12">
<div class="datatable-wrapper">
<div class="table-responsive">
<table id="logs" class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>LogId</th>
<th>JobId</th>
<th>Job</th>
<th>Time</th>
<th class="no-order">Text</th>
</tr>
</thead>
<tbody>
<%= render partial: 'log', collection: @logs %>
</tbody>
</table>
</div>
</div>
</div>
</div>
Event Timeline
Log In to Comment