diff --git a/app/controllers/clients_controller.rb b/app/controllers/clients_controller.rb index c9211c9..354d912 100644 --- a/app/controllers/clients_controller.rb +++ b/app/controllers/clients_controller.rb @@ -1,55 +1,57 @@ class ClientsController < ApplicationController before_action :require_logged_in before_action :set_client, only: [:show, :jobs, :logs, :stats, :users] before_action :fetch_logs, only: [:logs] # GET /clients # POST /clients def index @client_ids = Client.for_user(current_user.id).pluck(:ClientId) @clients = Client.where(ClientId: @client_ids).includes(:jobs) @hosts = current_user.hosts.not_baculized fetch_jobs_info get_charts end # GET /clients/1 def show + @schedules = @client.host.job_templates.map(&:schedule) + @filesets = @client.host.job_templates.map(&:fileset) end # GET /clients/1/jobs def jobs @jobs = @client.recent_jobs.page(params[:page]) end # GET /clients/1/logs def logs; end # GET /clients/1/stats # POST /clients/1/stats def stats get_charts end # GET /clients/1/users def users @users = @client.host.users end private def set_client @client = Client.for_user(current_user.id).find(params[:id]) @client_ids = [@client.id] end def fetch_jobs_info @stats = JobStats.new(@client_ids) 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/clients/_job.html.erb b/app/views/clients/_job.html.erb index 5bd70dc..567ed70 100644 --- a/app/views/clients/_job.html.erb +++ b/app/views/clients/_job.html.erb @@ -1,13 +1,19 @@ <%= job.name %> <%= job.job_type %> - <%= job.fileset.try(:name) %> - <%= job.schedule_human %> + + <%= link_to job.fileset.name, '#', + data: { toggle: 'modal', target: ".js-fileset-#{job.fileset_id}:first"} %> + + + <%= link_to job.schedule_human, '#', + data: { toggle: 'modal', target: ".js-schedule-#{job.schedule_id}:first"} %> + <%= I18n.l(job.created_at, format: :long) %> <% if job.enabled? && job.baculized? && job.backup? %> <%= link_to 'Backup Now', backup_now_host_job_path(job.host, job), method: :post, class: "btn btn-success", role: "button" %> <% end %> diff --git a/app/views/clients/show.html.erb b/app/views/clients/show.html.erb index 2cf3ecc..0d132e5 100644 --- a/app/views/clients/show.html.erb +++ b/app/views/clients/show.html.erb @@ -1,23 +1,25 @@ <%= render partial: 'header' %>

Client Details

Bacula Jobs

<%= render partial: 'client_details' %>
<%= render partial: 'jobs' %>

<%= link_to 'Back to clients', clients_path %> + +<%= render partial: 'jobs/modals' %>