Commit 1cf8bfc0 authored by Efthymia Bika's avatar Efthymia Bika
Browse files

Change backups map key

Now key form is Cloud/Backup Name
parent a69a9b14
......@@ -51,11 +51,11 @@
var li = $("<li></li>")
.attr("class", "clearfix backup-box")
.attr("id", "box_" + backup.name);
var a = $("<a>" + backup.name + "</a>")
var a = $("<a>" + backup.cloud + "/" + backup.name + "</a>")
.attr("href", "#")
.attr("id", "box_a_" + backup.name)
.attr("class", "left")
.attr("onclick", "go_to_backup('" + backup.name + "')");
.attr("onclick", "go_to_backup('" + backup.cloud + "/" + backup.name + "')");
li.append(a);
......@@ -63,7 +63,7 @@
.attr("href", "#")
.attr("class", "right")
.click(function() {
if(confirm("Are you sure you want to delete " + backup.name + '?' +
if(confirm("Are you sure you want to delete " + backup.cloud + "/" + backup.name + '?' +
"\nNOTE: To actually remove backup sets from remote" +
" container you have to manually purge it.")) {
delete_backup(backup);
......
......@@ -10,14 +10,9 @@
populate_clouds("");
}
if(typeof selected_backup != 'undefined') {
$.each(backups, function(i, backup) {
if(backup.name == selected_backup) {
$("#selected-bar").html(backup.name);
$("#selected-bar").show();
load_backup(backup);
return;
}
});
$("#selected-bar").html(selected_backup);
$("#selected-bar").show();
load_backup(backups[selected_backup]);
} else {
$("#selected-bar").hide();
load_backup();
......
......@@ -104,11 +104,11 @@ function save_backup_set() {
container = backup_set.container;
backup_set.exclude = exclude;
backup_set.include = include;
if(typeof backups[backup_name] != 'undefined' &&
typeof backups[backup_name].first_backup != 'undefined') {
backup_set.first_backup = backups[backup_name].first_backup;
if(typeof backups[cloud + "/" + backup_name] != 'undefined' &&
typeof backups[cloud + "/" + backup_name].first_backup != 'undefined') {
backup_set.first_backup = backups[cloud + "/" + backup_name].first_backup;
}
backups[backup_name] = backup_set;
backups[cloud + "/" + backup_name] = backup_set;
render_backup_sets("");
write_conf_file(BACKUP_CONF_FILE, backups);
......@@ -117,7 +117,7 @@ function save_backup_set() {
}
function delete_backup(backup) {
delete backups[backup.name];
delete backups[backup.cloud + "/" + backup.name];
render_backup_sets("");
write_conf_file(BACKUP_CONF_FILE, backups);
$(".tabs").hide();
......@@ -126,8 +126,10 @@ function delete_backup(backup) {
function write_first_backup() {
var backup_name = $("#backup-name").val().replace(/^\s+|\s+$/gm,'');
var cloud = $("#cloud").val();
var first_backup = null;
backups[backup_name].first_backup = new Date();
backups[cloud + "/" + backup_name].first_backup = new Date();
write_conf_file(BACKUP_CONF_FILE, backups);
}
......@@ -125,6 +125,13 @@ function run_duplicity(restore) {
container_name = $("#backup-name").val();
}
var cloud = "";
if(restore) {
cloud = $("#res-cloud").val();
} else {
cloud = $("#cloud").val();
}
var log_file = path.join(BAAS_LOG_DIR, "dup_" + new Date().toISOString() + ".log");
var log_arg = " --log-file '" + log_file + "' ";
......@@ -154,7 +161,7 @@ function run_duplicity(restore) {
$("#msg").html("");
$("#msg").removeClass("panel");
if(!restore &&
typeof backups[selected_backup].first_backup == 'undefined') {
typeof backups[cloud + "/" + selected_backup].first_backup == 'undefined') {
write_first_backup();
}
}
......@@ -180,7 +187,7 @@ function run_duplicity(restore) {
$("#msg").html("");
$("#msg").removeClass("panel");
if(!restore &&
typeof backups[container_name].first_backup == 'undefined') {
typeof backups[cloud + "/" + container_name].first_backup == 'undefined') {
write_first_backup();
}
}
......
......@@ -13,7 +13,7 @@
hide_error_divs();
function load_field_values() {
$("#res-backup-name").val(selected_backup);
$("#res-backup-name").val(backups[selected_backup].name);
$("#res-cloud").val(backups[selected_backup].cloud);
$("#res-passphrase").val(backups[selected_backup].passphrase);
if(typeof g_res_directory != 'undefined') {
......
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