Commit f9184ad9 authored by Efthymia Bika's avatar Efthymia Bika
Browse files

Fix first_backup

Write first backup field only the first time
parent 8595ca5f
......@@ -104,6 +104,10 @@ 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;
}
backups[backup_name] = backup_set;
render_backup_sets("");
......@@ -123,11 +127,7 @@ function delete_backup(backup) {
function write_first_backup() {
var backup_name = $("#backup-name").val().replace(/^\s+|\s+$/gm,'');
var first_backup = null;
$.each(backups, function(i, backup_set) {
if(backup_set.name == backup_name) {
backup_set.first_backup = Date.now();
}
});
backups[backup_name].first_backup = new Date();
write_conf_file(BACKUP_CONF_FILE, backups);
}
......@@ -140,7 +140,8 @@ function run_duplicity(restore) {
dirs = " swift://" + container_name + " " + directory;
}
var cmd = build_win_commands();
var dup_cmd = "duplicity " + include_arg + exclude_arg + file_arg + time_arg + dirs + ";";
var dup_cmd = "duplicity " + include_arg +
exclude_arg + file_arg + time_arg + dirs + ";";
exec(CYGWIN_BASH + " -c '" + cmd + dup_cmd + "'",
function(error, stdout, stderr){
......@@ -152,7 +153,8 @@ function run_duplicity(restore) {
} else {
$("#msg").html("");
$("#msg").removeClass("panel");
if(!restore) {
if(!restore &&
typeof backups[selected_backup].first_backup == 'undefined') {
write_first_backup();
}
}
......@@ -166,7 +168,8 @@ function run_duplicity(restore) {
if(restore) {
dirs = " swift://" + container_name + " " + directory;
}
var dup_cmd = "duplicity " + dup_verbosity + log_arg + include_arg + exclude_arg + file_arg + time_arg + dirs + ";";
var dup_cmd = "duplicity " + dup_verbosity + log_arg +
include_arg + exclude_arg + file_arg + time_arg + dirs + ";";
exec(dup_cmd , function(error, stdout, stderr) {
if(error) {
$("#msg").addClass("panel");
......@@ -176,7 +179,8 @@ function run_duplicity(restore) {
} else {
$("#msg").html("");
$("#msg").removeClass("panel");
if(!restore) {
if(!restore &&
typeof backups[container_name].first_backup == 'undefined') {
write_first_backup();
}
}
......
......@@ -27,7 +27,7 @@
}
}
if(typeof selected_backup != 'undefined' &&
if(selected_backup &&
typeof backups[selected_backup].first_backup != 'undefined') {
load_field_values();
}
......
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