From e64b5a2b88adb542397553bfafd8119ab7bd7e29 Mon Sep 17 00:00:00 2001 From: Wyatt Hoodes Date: Thu, 22 Aug 2019 21:21:16 -1000 Subject: [PATCH] data export: Fix success banner not clearing. There was a bug where the success banner stuck around even after the export completed. We now nicely fade and remove the banner upon a successful population of the export in the table. Fixes: #13045 --- frontend_tests/node_tests/dispatch.js | 1 + static/js/server_events_dispatch.js | 1 + static/js/settings_exports.js | 12 ++++++++++++ 3 files changed, 14 insertions(+) diff --git a/frontend_tests/node_tests/dispatch.js b/frontend_tests/node_tests/dispatch.js index 0e3c14d237..2b689e37c0 100644 --- a/frontend_tests/node_tests/dispatch.js +++ b/frontend_tests/node_tests/dispatch.js @@ -60,6 +60,7 @@ set_global('settings_exports', { populate_exports_table: function (exports) { return exports; }, + clear_success_banner: noop, }); // page_params is highly coupled to dispatching now diff --git a/static/js/server_events_dispatch.js b/static/js/server_events_dispatch.js index 45eecf4760..9859dc14e6 100644 --- a/static/js/server_events_dispatch.js +++ b/static/js/server_events_dispatch.js @@ -512,6 +512,7 @@ exports.dispatch_normal_event = function dispatch_normal_event(event) { break; case 'realm_export': settings_exports.populate_exports_table(event.exports); + settings_exports.clear_success_banner(); break; } diff --git a/static/js/settings_exports.js b/static/js/settings_exports.js index 66fa7b139c..5a778eb0b8 100644 --- a/static/js/settings_exports.js +++ b/static/js/settings_exports.js @@ -12,6 +12,18 @@ exports.reset = function () { meta.loaded = false; }; +exports.clear_success_banner = function () { + var export_status = $('#export_status'); + if (export_status.hasClass('alert-success')) { + // Politely remove our success banner if the export + // finishes before the view is closed. + export_status.fadeTo(200, 0); + setTimeout(function () { + export_status.hide(); + }, 205); + } +}; + exports.populate_exports_table = function (exports) { if (!meta.loaded) { return;