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
This commit is contained in:
Wyatt Hoodes 2019-08-22 21:21:16 -10:00 committed by Tim Abbott
parent 2a020fa6cc
commit e64b5a2b88
3 changed files with 14 additions and 0 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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;