Commit 9ba8cbcd authored by Efthymia Bika's avatar Efthymia Bika
Browse files

Remove redundant code

Init container name when loading set or saving a new one
parent 7ed9869f
var container = "";
function load_backup(backup) {
$(".tabs").show();
$(".tabs-content").show();
......@@ -20,6 +22,7 @@ function load_backup(backup) {
if(backup) {
container = backup.container;
$("#backup-name").val(backup.name);
$("#directory").html(backup.local_dir);
$("#cloud").val(backup.cloud);
......@@ -37,6 +40,7 @@ function load_backup(backup) {
$("#exclude").val(backup.exclude);
$("#include").val(backup.include);
} else {
container = "";
$("#backup-name").val('');
$("#directory").html('');
$("#res-directory").html('');
......@@ -81,6 +85,7 @@ function save_backup_set() {
backup_set.cloud = cloud;
backup_set.passphrase = passphrase;
backup_set.container = "Backup_" + backup_name;
container = backup_set.container;
backup_set.exclude = exclude;
backup_set.include = include;
backups.push(backup_set);
......
......@@ -36,14 +36,6 @@ function build_win_commands() {
function run_duplicity(restore) {
var container = null;
var backup_name = $("#backup-name").val().replace(/^\s+|\s+$/gm,'');
$.each(backups, function(i, backup_set) {
if(backup_set.name == backup_name) {
container = backup_set.container;
}
});
var file_arg = "";
var file_to_restore = $("#res-file").val();
if(restore && file_to_restore) {
......@@ -158,13 +150,6 @@ function load_status() {
$("#loader").show();
$("#status").html("");
var container = null;
var backup_name = $("#backup-name").val().replace(/^\s+|\s+$/gm,'');
$.each(backups, function(i, backup_set) {
if(backup_set.name == backup_name) {
container = backup_set.container;
}
});
function puts(error, stdout, stderr) {
if(error) {
$("#msg").html(error);
......@@ -190,14 +175,6 @@ function load_contents() {
$("#loader").show();
$("#contents").html("");
var container = null;
var backup_name = $("#backup-name").val().replace(/^\s+|\s+$/gm,'');
$.each(backups, function(i, backup_set) {
if(backup_set.name == backup_name) {
container = backup_set.container;
}
});
function puts(error, stdout, stderr) {
if(error) {
$("#msg").html(error);
......
......@@ -76,13 +76,6 @@ function get_contents_by_date(value) {
$("#time-head-error small").text('');
$("#time-head-error small").hide();
}
var container = null;
var backup_name = $("#backup-name").val().replace(/^\s+|\s+$/gm,'');
$.each(backups, function(i, backup_set) {
if(backup_set.name == backup_name) {
container = backup_set.container;
}
});
var time_cmd = "python src/timeview.py timeviews/ swift://" +
container + " get " + value + " " + time_path
......@@ -98,13 +91,6 @@ function get_contents_by_date(value) {
function load_timeview() {
$("#loader").show();
var container = null;
var backup_name = $("#backup-name").val().replace(/^\s+|\s+$/gm,'');
$.each(backups, function(i, backup_set) {
if(backup_set.name == backup_name) {
container = backup_set.container;
}
});
function puts(error, stdout, stderr) {
if(error) {
$("#msg").html(error);
......
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