Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
settings: Add confirmation dialog to delete data exports.
Ganesh Pawarbc317c0d0c6d
diff --git a/static/js/settings_exports.js b/static/js/settings_exports.jsindex f1739ee384f..612a9f997be 100644--- a/static/js/settings_exports.js+++ b/static/js/settings_exports.js@@ -1,8 +1,11 @@import $ from "jquery";+import render_confirm_delete_data_export from "../templates/confirm_dialog/confirm_delete_data_export.hbs";import render_admin_export_list from "../templates/settings/admin_export_list.hbs";import * as channel from "./channel";+import * as confirm_dialog from "./confirm_dialog";+import * as dialog_widget from "./dialog_widget";import {$t_html} from "./i18n";import * as ListWidget from "./list_widget";import * as loading from "./loading";@@ -129,13 +132,14 @@ export function set_up() {e.preventDefault();e.stopPropagation();const $btn = $(this);-- channel.del({- url: "/json/export/realm/" + encodeURIComponent($btn.attr("data-export-id")),- error(xhr) {- ui_report.generic_row_button_error(xhr, $btn);- },- // No success function, since UI updates are done via server_events+ const url = "/json/export/realm/" + encodeURIComponent($btn.attr("data-export-id"));+ const html_body = render_confirm_delete_data_export();++ confirm_dialog.launch({+ html_heading: $t_html({defaultMessage: "Delete data export?"}),+ html_body,+ on_click: () => dialog_widget.submit_api_request(channel.del, url),+ loading_spinner: true,});});}diff --git a/static/templates/confirm_dialog/confirm_delete_data_export.hbs b/static/templates/confirm_dialog/confirm_delete_data_export.hbsnew file mode 100644index 00000000000..890b3b29168--- /dev/null+++ b/static/templates/confirm_dialog/confirm_delete_data_export.hbs@@ -0,0 +1,2 @@+<p>{{t "This action cannot be undone."}}</p>+