js: Convert static/js/settings_exports.js to ES6 module.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-02-27 16:20:19 -08:00 committed by Tim Abbott
parent 6ffcc0d25b
commit d0ffb37320
7 changed files with 18 additions and 22 deletions

View File

@ -156,7 +156,6 @@
"recent_topics": false,
"search_pill_widget": false,
"settings": false,
"settings_exports": false,
"settings_linkifiers": false,
"settings_invites": false,
"settings_org": false,

View File

@ -63,7 +63,8 @@ const settings_display = {__esModule: true};
rewiremock("../../static/js/settings_display").with(settings_display);
const settings_emoji = {__esModule: true};
rewiremock("../../static/js/settings_emoji").with(settings_emoji);
const settings_exports = set_global("settings_exports", {});
const settings_exports = {__esModule: true};
rewiremock("../../static/js/settings_exports").with(settings_exports);
const settings_invites = set_global("settings_invites", {});
const settings_linkifiers = set_global("settings_linkifiers", {});
const settings_notifications = {__esModule: true};

View File

@ -35,7 +35,6 @@ import "../server_events";
import "../zulip";
import "../templates";
import "../dropdown_list_widget";
import "../settings_exports";
import "../settings_org";
import "../settings_users";
import "../settings_streams";

View File

@ -28,7 +28,6 @@ declare let reactions: any;
declare let recent_topics: any;
declare let search_pill_widget: any;
declare let settings: any;
declare let settings_exports: any;
declare let settings_invites: any;
declare let settings_linkifiers: any;
declare let settings_org: any;

View File

@ -26,6 +26,7 @@ import * as settings_bots from "./settings_bots";
import * as settings_config from "./settings_config";
import * as settings_display from "./settings_display";
import * as settings_emoji from "./settings_emoji";
import * as settings_exports from "./settings_exports";
import * as settings_notifications from "./settings_notifications";
import * as starred_messages from "./starred_messages";
import * as stream_data from "./stream_data";

View File

@ -1,21 +1,19 @@
"use strict";
import render_admin_export_list from "../templates/admin_export_list.hbs";
const render_admin_export_list = require("../templates/admin_export_list.hbs");
const channel = require("./channel");
const ListWidget = require("./list_widget");
const loading = require("./loading");
const people = require("./people");
const timerender = require("./timerender");
const ui_report = require("./ui_report");
import * as channel from "./channel";
import * as ListWidget from "./list_widget";
import * as loading from "./loading";
import * as people from "./people";
import * as timerender from "./timerender";
import * as ui_report from "./ui_report";
const meta = {
loaded: false,
};
exports.reset = function () {
export function reset() {
meta.loaded = false;
};
}
function sort_user(a, b) {
const a_name = people.get_full_name(a.acting_user_id).toLowerCase();
@ -28,7 +26,7 @@ function sort_user(a, b) {
return -1;
}
exports.populate_exports_table = function (exports) {
export function populate_exports_table(exports) {
if (!meta.loaded) {
return;
}
@ -90,9 +88,9 @@ exports.populate_exports_table = function (exports) {
} else {
loading.destroy_indicator(spinner);
}
};
}
exports.set_up = function () {
export function set_up() {
meta.loaded = true;
$("#export-data").on("click", (e) => {
@ -119,7 +117,7 @@ exports.set_up = function () {
channel.get({
url: "/json/export/realm",
success(data) {
exports.populate_exports_table(data.exports);
populate_exports_table(data.exports);
},
});
@ -136,6 +134,4 @@ exports.set_up = function () {
// No success function, since UI updates are done via server_events
});
});
};
window.settings_exports = exports;
}

View File

@ -4,6 +4,7 @@ import * as settings_account from "./settings_account";
import * as settings_bots from "./settings_bots";
import * as settings_display from "./settings_display";
import * as settings_emoji from "./settings_emoji";
import * as settings_exports from "./settings_exports";
import * as settings_muting from "./settings_muting";
import * as settings_notifications from "./settings_notifications";