Commit 8595ca5f authored by Efthymia Bika's avatar Efthymia Bika
Browse files

Restore backup set

Add restore button to backup tab
Go to restore tab with prefilled values to restore
the whole set
parent 0a166a15
......@@ -102,8 +102,10 @@
}
if(disable) {
$("#save_button").hide();
$("#go_to_restore_button").show();
} else {
$("#save_button").show();
$("#go_to_restore_button").hide();
}
}
......@@ -134,6 +136,13 @@
return check_directory("res-directory");
}
function go_to_restore() {
g_res_directory = RESTORE_DEFAULT_DIR;
g_passphrase = $("#passphrase").val();
g_res_file = "";
g_timestamp = "";
$("#restore-tab-link").trigger("click");
}
</script>
</head>
......@@ -276,9 +285,9 @@
onclick="if(check_fields(false)) save_backup_set();">
<i class="fa fa-floppy-o"></i>&nbsp;Save</a>
</div>
<div class="small-6 columns">
<div class="small-3 columns">
<a id="go_to_restore_button" class="button radius left small"
onclick="">
onclick="go_to_restore()">
<i class="fa fa-cloud-download"></i>&nbsp;Restore</a>
</div>
</div>
......
......@@ -13,17 +13,24 @@
hide_error_divs();
function load_field_values() {
if(typeof selected_backup != 'undefined') {
$("#res-backup-name").val(selected_backup);
$("#res-cloud").val(backups[selected_backup].cloud);
$("#res-passphrase").val(backups[selected_backup].passphrase);
$("#res-backup-name").val(selected_backup);
$("#res-cloud").val(backups[selected_backup].cloud);
$("#res-passphrase").val(backups[selected_backup].passphrase);
if(typeof g_res_directory != 'undefined') {
$("#res-directory").html(g_res_directory);
}
if(typeof g_res_file != 'undefined') {
$("#res-file").val(g_res_file);
}
if(typeof g_timestamp != 'undefined') {
$("#timestamp").val(g_timestamp);
}
}
load_field_values();
if(typeof selected_backup != 'undefined' &&
typeof backups[selected_backup].first_backup != 'undefined') {
load_field_values();
}
function check_res_backup_name() {
var backup_name = $('#res-backup-name').val().replace(/^\s+|\s+$/gm,'');
......@@ -77,16 +84,10 @@
});
}
function check_res_fields(restore) {
if(!restore) {
return (check_res_backup_name()
&& check_directory("directory")
&& check_cloud()
&& check_res_passphrase());
}
return (check_directory("res-directory")
&& check_res_cloud()
&& check_res_backup_name());
function check_res_fields() {
return (check_res_backup_name()
&& check_directory("res-directory")
&& check_res_cloud());
}
</script>
</head>
......@@ -198,8 +199,8 @@
<div class="small-6 columns">&nbsp;</div>
<div class="small-6 columns">
<a id="restore_button" class="button radius right small"
onclick="if(check_res_fields(true)) backup(true);">
<i class="fa fa-cloud-download"></i>&nbsp;Restore</a>
onclick="if(check_res_fields()) backup(true);">
<i class="fa fa-cloud-download"></i>&nbsp;Restore Now</a>
</div>
</div>
</div>
......
function go_to_restore(name) {
function go_to_restore_single(name) {
g_res_directory = RESTORE_DEFAULT_DIR;
var time_path = $("#time-path").val();
if(time_path != "/") time_path += "/";
......@@ -40,7 +40,7 @@ function show_contents_by_date(error, stdout, stderr) {
.attr("id", "rest_icon_" + i)
.attr("title", "Restore")
.attr("class", "hide")
.attr("onclick", "go_to_restore('" + el.name + "')");
.attr("onclick", "go_to_restore_single('" + el.name + "')");
li.append(icon);
li.append(rest_icon);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment