Small rework of backup view + add backup download button

This commit is contained in:
Alexandre Aubin 2020-09-06 21:23:17 +02:00
parent 9154692d63
commit 9a6529d6f7
2 changed files with 18 additions and 30 deletions

View file

@ -102,19 +102,21 @@
data.locale = y18n.locale; data.locale = y18n.locale;
c.view('backup/backup_info', data, function() { c.view('backup/backup_info', data, function() {
// Configure buttons "select all" and "select none"
// Remove active style from buttons
$(".select_all-none input").click(function(){ $(this).toggleClass("active"); });
// Select all checkbox in this panel // Select all checkbox in this panel
$(".select_all").click(function(){ $('button[data-action="select_all"]').on('click', function() {
$(this).parents(".panel").children(".list-group").find("input").prop("checked", true); $(this).parents(".panel").children(".list-group").find("input").prop("checked", true);
}); });
// Deselect all checkbox in this panel // Deselect all checkbox in this panel
$(".select_none").click(function(){ $('button[data-action="select_none"]').on('click', function() {
$(this).parents(".panel").children(".list-group").find("input").prop("checked", false); $(this).parents(".panel").children(".list-group").find("input").prop("checked", false);
}); });
$('button[data-action="download"]').on('click', function() {
var archive = $(this).data('archive');
window.open('https://' + store.get('url') + '/backup/download/'+archive, '_blank');
});
// Delete button // Delete button
$('button[data-action="delete"]').on('click', function() { $('button[data-action="delete"]').on('click', function() {
var storage = $(this).data('storage'); var storage = $(this).data('storage');

View file

@ -9,7 +9,13 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title"><span class="fa-fw fa-info-circle"></span> {{t 'infos'}}</h2> <h2 class="panel-title" style="display: inline-block;"><span class="fa-fw fa-info-circle"></span> {{t 'infos'}}</h2>
<button class="btn btn-sm btn-success pull-right" data-action="download" data-storage="{{storage.id}}" data-archive="{{name}}">
<span class="fa-download"></span> {{t 'download'}}
</button>
<button class="btn btn-sm btn-danger slide pull-right" data-action="delete" data-storage="{{storage.id}}" data-archive="{{name}}">
<span class="fa-trash-o"></span> {{t 'delete'}}
</button>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<dl class="dl-horizontal"> <dl class="dl-horizontal">
@ -25,14 +31,12 @@
<form action="#/backup/{{storage.id}}/{{name}}/restore" method="POST" class="form-horizontal"> <form action="#/backup/{{storage.id}}/{{name}}/restore" method="POST" class="form-horizontal">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title"> <h2 class="panel-title" style="display: inline-block;">
<span class="fa-fw fa-archive"></span> <span class="fa-fw fa-archive"></span>
{{t 'backup_content'}} {{t 'backup_content'}}
<span class="select_all-none pull-right">
<input type="button" role="select_all" class="btn btn-default slide back select_all" value="{{t 'select_all'}}" />
<input type="button" role="select_none" class="btn btn-default slide back select_none" value="{{t 'select_none'}}" />
</span>
</h2> </h2>
<button type="button" data-action="select_all" class="btn btn-sm btn-default pull-right">{{t 'select_all'}}</button>
<button type="button" data-action="select_none" class="btn btn-sm btn-default pull-right">{{t 'select_none'}}</button>
</div> </div>
{{#if items}} {{#if items}}
<div class="list-group"> <div class="list-group">
@ -73,21 +77,3 @@
{{/if}} {{/if}}
</div> </div>
</form> </form>
<div class="separator"></div>
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">
<span class="fa-fw fa-wrench"></span> {{t 'operations'}}
</h2>
</div>
<div class="panel-body">
<div class="container">
<p>{{t 'backup_archive_delete'}}</p>
<button class="btn btn-danger slide" data-action="delete" data-storage="{{storage.id}}" data-archive="{{name}}">
<span class="fa-trash-o"></span> {{t 'delete'}}
</button>
</div>
</div>
</div>