diff --git a/app/views/clients/_actions.html.erb b/app/views/clients/_actions.html.erb new file mode 100644 index 0000000..89ae5b8 --- /dev/null +++ b/app/views/clients/_actions.html.erb @@ -0,0 +1,47 @@ +<div class="row"> + <div class="col-xs-12"> + <% if @client.is_backed_up? %> + <%= button_or_disabled(@client.host.blocked?, 'Restore Files', + restore_client_path(@client), + class: "btn btn-warning", role: "button") %> + <% end %> + + <% if @client.host %> + <%= link_to host_path(@client.host), class: "btn btn-default", role: "button" do %> + <label class="glyphicon glyphicon-edit text-primary"></label> + Manage Client + <% end %> + <% end %> + + <%= link_to fd_config_host_path(@client.host, token: current_user.token), + class: "btn btn-default", role: "button", download: 'fd_config' do %> + <label class="glyphicon glyphicon-download-alt text-primary"></label> + Download Config + <% end %> + + <%= link_to '#', data: { toggle: 'modal', target: "#js-fd-config"} do %> + <label class='glyphicon glyphicon-info-sign'></label> + <% end %> + </div> +</div> + +<br/> + +<%= link_to 'Back to clients', clients_path %> + +<div id="js-fd-config" class="modal" tabindex="-1" role="dialog" aria-labelledby="ConfigModal"> + <div class="modal-dialog modal-lg"> + <div class="modal-content container"> + <br /> + <div class="panel panel-default"> + <div class="panel-heading">Config Download</div> + <div class="panel-body"> + You can also download the config like this: + <pre> +<%= "$ wget #{fd_config_host_url(@client.host, token: current_user.token)}" %> + </pre> + </div> + </div> + </div> + </div> +</div> diff --git a/app/views/clients/_client_details.html.erb b/app/views/clients/_client_details.html.erb index f2ce313..eec2634 100644 --- a/app/views/clients/_client_details.html.erb +++ b/app/views/clients/_client_details.html.erb @@ -1,85 +1,52 @@ <div class="col-xs-4"> <div class="table-responsive"> <table class="table table-striped table-bordered table-condensed "> <tr> <td>Name</td> <td><%= @client.name %></td> </tr> <tr> <td>Uname</td> <td><%= @client.uname %></td> </tr> <tr> <td>Active Jobs</td> <td><%= @client.running_jobs %></td> </tr> <tr> <td>Last Backup</td> <td> <%= @client.last_job_date_formatted %> </td> </tr> <tr> <td>File Retention</td> <td><%= @client.file_retention_days %> days</td> </tr> <tr> <td>Job Retention</td> <td><%= @client.job_retention_days %> days</td> </tr> <tr> <td>Total Space Used</td> <td><%= number_to_human_size @client.backup_jobs_size %></td> </tr> <tr> <td>Client Quota</td> <td><%= number_to_human_size @client.quota %></td> </tr> <tr> <td>Space Used %</td> <td> <% if @client.quota.to_f > 0 %> <%= pretty_percentage(@client.backup_jobs_size.to_f / @client.quota, @client.quota) %> <% end %> </td> </tr> <tr> <td>Files count</td> <td><%= number_by_magnitude(@client.files_count) %></td> </tr> </table> </div> - <div> - <% if @client.is_backed_up? %> - <%= button_or_disabled(@client.host.blocked?, 'Restore Files', - restore_client_path(@client), - class: "btn btn-warning", role: "button") %> - <% end %> - <%= link_to fd_config_host_path(@client.host, token: current_user.token), - class: "btn btn-default", role: "button", download: 'fd_config' do %> - <label class="glyphicon glyphicon-download-alt text-primary"></label> - Download Config - <% end %> - - <%= link_to '#', data: { toggle: 'modal', target: "#js-fd-config"} do %> - <label class='glyphicon glyphicon-info-sign'></label> - <% end %> - </div> </div> - -<div id="js-fd-config" class="modal" tabindex="-1" role="dialog" aria-labelledby="ConfigModal"> - <div class="modal-dialog modal-lg"> - <div class="modal-content container"> - <br /> - <div class="panel panel-default"> - <div class="panel-heading">Config Download</div> - <div class="panel-body"> - You can also download the config like this: - <pre> -<%= "$ wget #{fd_config_host_url(@client.host, token: current_user.token)}" %> - </pre> - </div> - </div> - </div> - </div> - </div> diff --git a/app/views/clients/_header.html.erb b/app/views/clients/_header.html.erb index 43c7a5c..d603eea 100644 --- a/app/views/clients/_header.html.erb +++ b/app/views/clients/_header.html.erb @@ -1,15 +1,10 @@ <p id="notice"><%= notice %></p> -<% if @client.host %> - <div class="row right"> - <%= link_to 'Manage Client', host_path(@client.host), class: "btn btn-primary", role: "button" %> - </div> -<% end %> <%= breadcrumb_with Client: client_path(@client), Jobs: jobs_client_path(@client), Stats: stats_client_path(@client), Logs: logs_client_path(@client), Users: users_client_path(@client) %> <h2> <%= @client.name %> <small><%= host_status_label(@client.host) %></small> </h2> diff --git a/app/views/clients/show.html.erb b/app/views/clients/show.html.erb index 5820291..b532fb3 100644 --- a/app/views/clients/show.html.erb +++ b/app/views/clients/show.html.erb @@ -1,25 +1,23 @@ <%= render partial: 'header' %> <div class="row"> <div class="col-xs-4"> <h3>Client Details</h3> </div> <div class="col-xs-6"> <h3>Backup Jobs</h3> </div> </div> <div class="row"> <%= render partial: 'client_details' %> <div class="col-xs-8"> <div class="row"> <%= render partial: 'jobs' %> </div> </div> </div> -<br/> - -<%= link_to 'Back to clients', clients_path %> +<%= render partial: 'actions' %> <%= render partial: 'jobs/modals' %>