diff --git a/app/assets/javascripts/clients.js b/app/assets/javascripts/clients.js index 1a77cee..f28100b 100644 --- a/app/assets/javascripts/clients.js +++ b/app/assets/javascripts/clients.js @@ -1,39 +1,41 @@ $(document).ready(function() { if ($('#select-files').size() > 0) { $('#file-selector').hide(); + $('#reset-button').hide(); $('#select-files').click(function() { $('#file-selector').show(); + $('#reset-button').show(); }); } }); $(document).ready(function() { if ($('#file-submitter').size() > 0) { $("#file-tree").on("select_node.jstree", function(evt, data) { add_input(data.node.id); }); $("#file-tree").on("deselect_node.jstree", function(evt, data) { remove_input(data.node.id); }); } if ($('#invitation_user_id').size() > 0) { $('#invitation_user_id').chosen(); } }); function add_input(id) { $('#file-submitter'). append(''); if ($('.js-file-input').size() > 0 && $('#file-submitter > input[type="submit"]').attr('disabled') == 'disabled') { $('#file-submitter > input[type="submit"]').attr('disabled', false); } } function remove_input(id) { $('#js-file-id-' + id).remove(); if ($('.js-file-input').size() == 0) { $('#file-submitter > input[type="submit"]').attr('disabled', true); } } diff --git a/app/views/clients/_file_selector.html.erb b/app/views/clients/_file_selector.html.erb index 10f3e61..7b7c98c 100644 --- a/app/views/clients/_file_selector.html.erb +++ b/app/views/clients/_file_selector.html.erb @@ -1,15 +1,22 @@

Files

LOADING

-<%= form_tag(restore_selected_client_path, { id: 'file-submitter', style: 'display:none' }) do %> - <%= submit_tag 'Restore Selected Files', class: 'btn btn-default', disabled: true %> -<% end %> +
+ <%= form_tag(restore_selected_client_path, { id: 'file-submitter', style: 'display:none' }) do %> + <%= submit_tag 'Restore Selected Files', class: 'btn btn-default', disabled: true %> + <% end %> +
+ +
+ <%= link_to 'Cancel', restore_client_path(@client), role: 'button', + class: 'btn btn-default text-warning' %> +
diff --git a/app/views/clients/restore.html.erb b/app/views/clients/restore.html.erb index 0c8d37b..8e356f0 100644 --- a/app/views/clients/restore.html.erb +++ b/app/views/clients/restore.html.erb @@ -1,74 +1,77 @@
<% if @client.is_backed_up? %>

Restore files for "<%= @client.name %>"

<%= bootstrap_form_tag(url: run_restore_client_path(@client), remote: true, layout: :horizontal, label_col: 'col-xs-4', control_col: 'col-xs-7', html: { id: 'basic-form' } ) do |f| %> <%= help_block('Restore to most recent backup by leaving date and time blank', 'col-xs-4', 'col-xs-7') %> <%= f.text_field :restore_date %> <%= f.time_select :restore_time, ignore_date: true, minute_step: 30, prompt: true %> <%= f.select(:fileset, options_from_collection_for_select(@client.file_sets, :id, :file_set)) %> <%= f.text_field :restore_location, placeholder: '/tmp/default_restore' %>
<%= help_block( 'Restore and backup clients must have the same encryption key'.html_safe, 'col-xs-4', 'col-xs-7') %> <%= f.select( :restore_client, options_from_collection_for_select(@restore_clients, :id, :name, @client.id), label: tooltip_label('Restore Client', 'Client where the backup will be restored to')) %>
<%= f.submit 'Select Specific Files', id: 'select-files', class: 'btn btn-primary' %>

<%= f.submit 'Restore All Files', class: 'btn btn-warning text-right', data: { confirm: "This will restore all your files" } %>
<% end %>
<% else %>

Can not issue a restore for this client. It does not have any successful backups

<% end %> - <%= link_to 'Back to client', client_path(@client), class: 'btn btn-danger', role: 'button' %> + <%= link_to client_path(@client), class: 'btn btn-default' do %> + + Back to client + <% end %>
<%= render partial: 'file_selector' %>