1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2025-04-20 02:52:11 +00:00

Changed indentation to match the old one

This commit is contained in:
hija 2020-08-26 19:46:09 +02:00
parent df6fcf3bd2
commit 8085246fed

View File

@ -1,15 +1,15 @@
<style> <style>
#backup-status th { text-align: center; } #backup-status th { text-align: center; }
#backup-status tr.full-backup td { font-weight: bold; } #backup-status tr.full-backup td { font-weight: bold; }
</style> </style>
<h2>Backup Status</h2> <h2>Backup Status</h2>
<p>The box makes an incremental backup each night. By default the backup is stored on the machine itself, but you can also have it stored on Amazon S3.</p> <p>The box makes an incremental backup each night. By default the backup is stored on the machine itself, but you can also have it stored on Amazon S3.</p>
<h3>Configuration</h3> <h3>Configuration</h3>
<form class="form-horizontal" role="form" onsubmit="set_custom_backup(); return false;"> <form class="form-horizontal" role="form" onsubmit="set_custom_backup(); return false;">
<div class="form-group"> <div class="form-group">
<label for="backup-target-type" class="col-sm-2 control-label">Backup to:</label> <label for="backup-target-type" class="col-sm-2 control-label">Backup to:</label>
<div class="col-sm-2"> <div class="col-sm-2">
@ -137,7 +137,6 @@
<input type="text" placeholder="B2 Bucket" class="form-control" rows="1" id="backup-target-b2-bucket" onchange="compute_b2_url()"> <input type="text" placeholder="B2 Bucket" class="form-control" rows="1" id="backup-target-b2-bucket" onchange="compute_b2_url()">
</div> </div>
</div> </div>
<div class="form-group backup-target-b2"> <div class="form-group backup-target-b2">
<label for="backup-target-b2-url" class="col-sm-2 control-label">B2 Backup URL</label> <label for="backup-target-b2-url" class="col-sm-2 control-label">B2 Backup URL</label>
<div class="col-sm-8"> <div class="col-sm-8">
@ -157,13 +156,13 @@
<button id="set-s3-backup-button" type="submit" class="btn btn-primary">Save</button> <button id="set-s3-backup-button" type="submit" class="btn btn-primary">Save</button>
</div> </div>
</div> </div>
</form> </form>
<h3>Available backups</h3> <h3>Available backups</h3>
<p>The backup location currently contains the backups listed below. The total size of the backups is currently <span id="backup-total-size"></span>.</p> <p>The backup location currently contains the backups listed below. The total size of the backups is currently <span id="backup-total-size"></span>.</p>
<table id="backup-status" class="table" style="width: auto"> <table id="backup-status" class="table" style="width: auto">
<thead> <thead>
<th colspan="2">When</th> <th colspan="2">When</th>
<th>Type</th> <th>Type</th>
@ -172,18 +171,18 @@
</thead> </thead>
<tbody> <tbody>
</tbody> </tbody>
</table> </table>
<script> <script>
function toggle_form() { function toggle_form() {
var target_type = $("#backup-target-type").val(); var target_type = $("#backup-target-type").val();
$(".backup-target-local, .backup-target-rsync, .backup-target-s3, .backup-target-b2").hide(); $(".backup-target-local, .backup-target-rsync, .backup-target-s3, .backup-target-b2").hide();
$(".backup-target-" + target_type).show(); $(".backup-target-" + target_type).show();
init_inputs(target_type); init_inputs(target_type);
} }
function nice_size(bytes) { function nice_size(bytes) {
var powers = ['bytes', 'KB', 'MB', 'GB', 'TB']; var powers = ['bytes', 'KB', 'MB', 'GB', 'TB'];
while (true) { while (true) {
if (powers.length == 1) break; if (powers.length == 1) break;
@ -197,10 +196,9 @@
else else
bytes = Math.round(bytes*10)/10; bytes = Math.round(bytes*10)/10;
return bytes + " " + powers[0]; return bytes + " " + powers[0];
} }
function show_system_backup() { function show_system_backup() {
// TODO: b3
show_custom_backup() show_custom_backup()
$('#backup-status tbody').html("<tr><td colspan='2' class='text-muted'>Loading...</td></tr>") $('#backup-status tbody').html("<tr><td colspan='2' class='text-muted'>Loading...</td></tr>")
@ -246,9 +244,9 @@
total_disk_size += r.unmatched_file_size; total_disk_size += r.unmatched_file_size;
$('#backup-total-size').text(nice_size(total_disk_size)); $('#backup-total-size').text(nice_size(total_disk_size));
}) })
} }
function show_custom_backup() { function show_custom_backup() {
$(".backup-target-local, .backup-target-rsync, .backup-target-s3, .backup-target-b2").hide(); $(".backup-target-local, .backup-target-rsync, .backup-target-s3, .backup-target-b2").hide();
api( api(
"/system/backup/config", "/system/backup/config",
@ -291,9 +289,9 @@
} }
toggle_form() toggle_form()
}) })
} }
function set_custom_backup() { function set_custom_backup() {
var target_type = $("#backup-target-type").val(); var target_type = $("#backup-target-type").val();
var target_user = $("#backup-target-user").val(); var target_user = $("#backup-target-user").val();
var target_pass = $("#backup-target-pass").val(); var target_pass = $("#backup-target-pass").val();
@ -307,7 +305,7 @@
target = "rsync://" + $("#backup-target-rsync-user").val() + "@" + $("#backup-target-rsync-host").val() target = "rsync://" + $("#backup-target-rsync-user").val() + "@" + $("#backup-target-rsync-host").val()
+ "/" + $("#backup-target-rsync-path").val(); + "/" + $("#backup-target-rsync-path").val();
target_user = ''; target_user = '';
} else if (target_type == "b2"){ } else if (target_type == "b2") {
target = $('#backup-target-b2-url').val(); target = $('#backup-target-b2-url').val();
target_user = ''; target_user = '';
target_pass = ''; target_pass = '';
@ -333,9 +331,9 @@
show_modal_error("Backup configuration", $("<p/>").text(r)); show_modal_error("Backup configuration", $("<p/>").text(r));
}); });
return false; return false;
} }
function init_inputs(target_type) { function init_inputs(target_type) {
function set_host(host) { function set_host(host) {
if(host !== 'other') { if(host !== 'other') {
$("#backup-target-s3-host").val(host); $("#backup-target-s3-host").val(host);
@ -349,15 +347,14 @@
}); });
set_host($('#backup-target-s3-host-select').val()); set_host($('#backup-target-s3-host-select').val());
} }
} }
function compute_b2_url(){ function compute_b2_url(){
if ($('#backup-target-b2-user').val() && $('#backup-target-b2-pass').val() && $('#backup-target-b2-bucket').val()){ if ($('#backup-target-b2-user').val() && $('#backup-target-b2-pass').val() && $('#backup-target-b2-bucket').val()){
$('#backup-target-b2-url').val('b2://' + $('#backup-target-b2-user').val() + ':' + $('#backup-target-b2-pass').val() $('#backup-target-b2-url').val('b2://' + $('#backup-target-b2-user').val() + ':' + $('#backup-target-b2-pass').val()
+ '@' + $('#backup-target-b2-bucket').val()); + '@' + $('#backup-target-b2-bucket').val());
}else{ }else{
$('#backup-target-b2-url').val(''); $('#backup-target-b2-url').val('');
} }
} }
</script>
</script>