mirror of https://github.com/zulip/zulip.git
settings_realm_domains: Convert module to TypeScript.
This commit is contained in:
parent
979ace1cea
commit
4b04716237
|
@ -211,7 +211,7 @@ EXEMPT_FILES = make_set(
|
|||
"web/src/settings_panel_menu.js",
|
||||
"web/src/settings_playgrounds.js",
|
||||
"web/src/settings_profile_fields.js",
|
||||
"web/src/settings_realm_domains.js",
|
||||
"web/src/settings_realm_domains.ts",
|
||||
"web/src/settings_realm_user_settings_defaults.js",
|
||||
"web/src/settings_sections.js",
|
||||
"web/src/settings_streams.js",
|
||||
|
|
|
@ -63,6 +63,7 @@ export const page_params: {
|
|||
realm_create_web_public_stream_policy: number;
|
||||
realm_delete_own_message_policy: number;
|
||||
realm_description: string;
|
||||
realm_domains: {domain: string; allow_subdomains: boolean}[];
|
||||
realm_edit_topic_policy: number;
|
||||
realm_email_changes_disabled: boolean;
|
||||
realm_enable_guest_user_indicator: boolean;
|
||||
|
|
|
@ -9,7 +9,12 @@ import {$t_html} from "./i18n";
|
|||
import {page_params} from "./page_params";
|
||||
import * as ui_report from "./ui_report";
|
||||
|
||||
export function populate_realm_domains_table(realm_domains) {
|
||||
type RealmDomain = {
|
||||
domain: string;
|
||||
allow_subdomains: boolean;
|
||||
};
|
||||
|
||||
export function populate_realm_domains_table(realm_domains: RealmDomain[]): void {
|
||||
// Don't populate the table if the realm domains modal isn't open.
|
||||
if ($("#realm_domains_modal").length === 0) {
|
||||
return;
|
||||
|
@ -27,19 +32,19 @@ export function populate_realm_domains_table(realm_domains) {
|
|||
}
|
||||
}
|
||||
|
||||
function fade_status_element($elem) {
|
||||
function fade_status_element($elem: JQuery): void {
|
||||
setTimeout(() => {
|
||||
$elem.fadeOut(500);
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
export function setup_realm_domains_modal_handlers() {
|
||||
export function setup_realm_domains_modal_handlers(): void {
|
||||
$("#realm_domains_table").on("click", ".delete_realm_domain", function () {
|
||||
const domain = $(this).parents("tr").find(".domain").text();
|
||||
const url = "/json/realm/domains/" + domain;
|
||||
const $realm_domains_info = $(".realm_domains_info");
|
||||
|
||||
channel.del({
|
||||
void channel.del({
|
||||
url,
|
||||
success() {
|
||||
ui_report.success(
|
||||
|
@ -65,7 +70,7 @@ export function setup_realm_domains_modal_handlers() {
|
|||
allow_subdomains: JSON.stringify(allow_subdomains),
|
||||
};
|
||||
|
||||
channel.patch({
|
||||
void channel.patch({
|
||||
url,
|
||||
data,
|
||||
success() {
|
||||
|
@ -111,7 +116,7 @@ export function setup_realm_domains_modal_handlers() {
|
|||
allow_subdomains: JSON.stringify(allow_subdomains),
|
||||
};
|
||||
|
||||
channel.post({
|
||||
void channel.post({
|
||||
url: "/json/realm/domains",
|
||||
data,
|
||||
success() {
|
||||
|
@ -134,7 +139,7 @@ export function setup_realm_domains_modal_handlers() {
|
|||
});
|
||||
}
|
||||
|
||||
export function show_realm_domains_modal() {
|
||||
export function show_realm_domains_modal(): void {
|
||||
const realm_domains_table_body = render_realm_domains_modal();
|
||||
|
||||
dialog_widget.launch({
|
Loading…
Reference in New Issue