From dbfd158388dcbc25bb63b606afde8a460ae3826a Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Fri, 28 Aug 2015 11:43:25 +0000 Subject: [PATCH] dont refresh the backup page when there's an error saving the config --- management/backup.py | 2 +- management/templates/system-backup.html | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/management/backup.py b/management/backup.py index f073cac4..d4f9a2aa 100755 --- a/management/backup.py +++ b/management/backup.py @@ -384,7 +384,7 @@ def backup_set_custom(env, target, target_user, target_pass, min_age): write_backup_config(env, config) - return "Updated backup config" + return "OK" def get_backup_config(env, for_save=False, for_ui=False): backup_root = os.path.join(env["STORAGE_ROOT"], 'backup') diff --git a/management/templates/system-backup.html b/management/templates/system-backup.html index 4e6f5a83..19082be0 100644 --- a/management/templates/system-backup.html +++ b/management/templates/system-backup.html @@ -202,11 +202,12 @@ function set_custom_backup() { min_age: min_age }, function(r) { - // Responses are multiple lines of pre-formatted text. - show_modal_error("Backup configuration", $("
").text(r), function() { show_system_backup(); }); // refresh after modal
+      // use .text() --- it's a text response, not html
+      show_modal_error("Backup configuration", $("

").text(r), function() { if (r == "OK") show_system_backup(); }); // refresh after modal on success }, function(r) { - show_modal_error("Backup configuration (error)", r); + // use .text() --- it's a text response, not html + show_modal_error("Backup configuration", $("

").text(r)); }); return false; }