Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

settings: Preparatory work for duplicating bots panel for Personal tab.

Sahil Batraf3980588a810
diff --git a/web/e2e-tests/settings.test.ts b/web/e2e-tests/settings.test.ts
index 24d9bada656..6c1dc1a718c 100644
--- a/web/e2e-tests/settings.test.ts
+++ b/web/e2e-tests/settings.test.ts
@@ -207,11 +207,13 @@ async function test_normal_bot_creation(page: Page): Promise<void> {
}
async function test_botserverrc(page: Page): Promise<void> {
- await page.click("#download-botserverrc-file");
- await page.waitForSelector('#hidden-botserverrc-download[href^="data:application"]');
+ await page.click("#admin-bot-list .download-botserverrc-file");
+ await page.waitForSelector(
+ '#admin-bot-list .hidden-botserverrc-download[href^="data:application"]',
+ );
const botserverrc_decoded_url = await get_decoded_url_in_selector(
page,
- "#hidden-botserverrc-download",
+ "#admin-bot-list .hidden-botserverrc-download",
);
const botserverrc_regex =
/^data:application\/octet-stream;charset=utf-8,\[]\nemail=.+\nkey=.+\nsite=.+\ntoken=.+\n$/;
diff --git a/web/src/admin.ts b/web/src/admin.ts
index 3793a99ba8a..c4ab8bff46d 100644
--- a/web/src/admin.ts
+++ b/web/src/admin.ts
@@ -299,8 +299,8 @@ export function build_page(): void {
settings_users.imported_user_list_dropdown_widget_name,
gif_help_link,
...get_realm_level_notification_settings(),
- all_bots_list_dropdown_widget_name: settings_bots.all_bots_list_dropdown_widget_name,
- your_bots_list_dropdown_widget_name: settings_bots.your_bots_list_dropdown_widget_name,
+ all_bots_list_dropdown_widget_name: settings_bots.org_all_bots_list_dropdown_widget_name,
+ your_bots_list_dropdown_widget_name: settings_bots.org_your_bots_list_dropdown_widget_name,
group_setting_labels: settings_config.all_group_setting_labels.realm,
server_can_summarize_topics: realm.server_can_summarize_topics,
is_plan_self_hosted:
@@ -361,7 +361,7 @@ export function launch(section: string, settings_tab: string | undefined): void
}
if (section === "bots") {
assert(settings_tab !== undefined);
- settings_panel_menu.org_settings.set_bot_settings_tab(settings_tab);
+ settings_panel_menu.org_settings.set_bot_settings_tab(settings_tab, "org");
}
settings_toggle.goto("organization");
}
diff --git a/web/src/hashchange.ts b/web/src/hashchange.ts
index 4f6ba137efe..0b0ad8bf655 100644
--- a/web/src/hashchange.ts
+++ b/web/src/hashchange.ts
@@ -419,7 +419,10 @@ function do_hashchange_overlay(old_hash: string | undefined): void {
if (section === "users") {
settings_panel_menu.org_settings.set_user_settings_tab(get_settings_tab(section));
} else if (section === "bots") {
- settings_panel_menu.org_settings.set_bot_settings_tab(get_settings_tab(section)!);
+ settings_panel_menu.org_settings.set_bot_settings_tab(
+ get_settings_tab(section)!,
+ "org",
+ );
}
}
settings_toggle.goto(base);
diff --git a/web/src/settings_bots.ts b/web/src/settings_bots.ts
index 8dc3dde5064..410d147e4fb 100644
--- a/web/src/settings_bots.ts
+++ b/web/src/settings_bots.ts
@@ -40,8 +40,8 @@ const OUTGOING_WEBHOOK_BOT_TYPE = "3";
const OUTGOING_WEBHOOK_BOT_TYPE_INT = 3;
const EMBEDDED_BOT_TYPE = "4";
-export const all_bots_list_dropdown_widget_name = "all_bots_list_select_bot_status";
-export const your_bots_list_dropdown_widget_name = "your_bots_list_select_bot_status";
+export const org_all_bots_list_dropdown_widget_name = "org_all_bots_list_select_bot_status";
+export const org_your_bots_list_dropdown_widget_name = "org_your_bots_list_select_bot_status";
type BotType = {
type_id: number;
@@ -84,31 +84,25 @@ type BotSettingsSection = {
text_search: string;
status_code: number;
};
- handle_events: () => void;
- create_table: () => void;
list_widget: ListWidgetType<number, BotInfo> | undefined;
};
-const all_bots_section: BotSettingsSection = {
- dropdown_widget_name: all_bots_list_dropdown_widget_name,
+const org_all_bots_section: BotSettingsSection = {
+ dropdown_widget_name: org_all_bots_list_dropdown_widget_name,
filters: {
text_search: "",
// 0 status_code signifies Active status for our filter.
status_code: 0,
},
- handle_events: all_bots_handle_events,
- create_table: create_all_bots_table,
list_widget: undefined,
};
-const your_bots_section: BotSettingsSection = {
- dropdown_widget_name: your_bots_list_dropdown_widget_name,
+const org_your_bots_section: BotSettingsSection = {
+ dropdown_widget_name: org_your_bots_list_dropdown_widget_name,
filters: {
text_search: "",
status_code: 0,
},
- handle_events: your_bots_handle_events,
- create_table: create_your_bots_table,
list_widget: undefined,
};
@@ -471,31 +465,31 @@ export function toggle_bot_config_download_container(): void {
const is_active = people.is_person_active(elem.user_id);
return elem.bot_type === OUTGOING_WEBHOOK_BOT_TYPE_INT && is_active;
});
- $("#botserverrc-text-container").toggle(bots.length > 0);
+ $("#admin-bot-list .config-download-text").toggle(bots.length > 0);
}
export function redraw_all_bots_list(): void {
// In order to properly redraw after a user may have been added,
// we need to update the all_bots_section.list_widget with the new
// set of bot user IDs to display.
- if (!all_bots_section.list_widget) {
+ if (!org_all_bots_section.list_widget) {
return;
}
const bot_user_ids = people.get_bot_ids();
- all_bots_section.list_widget.replace_list_data(bot_user_ids);
+ org_all_bots_section.list_widget.replace_list_data(bot_user_ids);
}
export function redraw_your_bots_list(): void {
// In order to properly redraw after a user may have been added,
// we need to update the your_bots_list_widget with the new set of bot
// user IDs to display.
- if (!your_bots_section.list_widget) {
+ if (!org_your_bots_section.list_widget) {
return;
}
const bot_user_ids_for_current_owner = bot_data.get_all_bots_ids_for_current_user();
- your_bots_section.list_widget.replace_list_data(bot_user_ids_for_current_owner);
+ org_your_bots_section.list_widget.replace_list_data(bot_user_ids_for_current_owner);
}
function add_value_to_filters(
@@ -541,16 +535,13 @@ function status_selected_handler(
event: JQuery.ClickEvent,
dropdown: tippy.Instance,
widget: dropdown_widget.DropdownWidget,
+ section: BotSettingsSection,
): void {
event.preventDefault();
event.stopPropagation();
const status_code = Number($(event.currentTarget).attr("data-unique-id"));
- if (widget.widget_name === all_bots_section.dropdown_widget_name) {
- add_value_to_filters(all_bots_section, "status_code", status_code);
- } else if (widget.widget_name === your_bots_section.dropdown_widget_name) {
- add_value_to_filters(your_bots_section, "status_code", status_code);
- }
+ add_value_to_filters(section, "status_code", status_code);
dropdown.hide();
widget.render();
}
@@ -564,7 +555,9 @@ function create_status_filter_dropdown(
unique_id_type: "number",
get_options: get_bot_status_options,
$events_container,
- item_click_callback: status_selected_handler,
+ item_click_callback(event, dropdown, widget) {
+ status_selected_handler(event, dropdown, widget, section);
+ },
default_id: section.filters.status_code,
hide_search_box: true,
tippy_props: {
@@ -587,30 +580,34 @@ function reset_scrollbar($sel: JQuery): () => void {
};
}
-function create_all_bots_table(): void {
- loading.make_indicator($("#admin_page_all_bots_loading_indicator"), {
+function create_all_bots_table(
+ section: BotSettingsSection,
+ $container: JQuery,
+ widget_name: string,
+): void {
+ loading.make_indicator($container.find("loading-indicator"), {
text: $t({defaultMessage: "Loading…"}),
});
- const $all_bots_table = $("#admin_all_bots_table");
+ const $all_bots_table = $container.find(".bot-table");
$all_bots_table.hide();
const bot_user_ids = people.get_bot_ids();
- all_bots_section.list_widget = ListWidget.create($all_bots_table, bot_user_ids, {
- name: "admin_bot_list",
+ section.list_widget = ListWidget.create($all_bots_table, bot_user_ids, {
+ name: widget_name,
get_item: bot_info,
modifier_html: render_settings_user_list_row,
html_selector: (item) => $(`tr[data-user-id='${CSS.escape(item.user_id.toString())}']`),
filter: {
predicate(item) {
- return predicate_for_bot_filtering(item, all_bots_section);
+ return predicate_for_bot_filtering(item, section);
},
is_active() {
- const $search_input = $("#admin-all-bots-list .search");
- return are_filters_active(all_bots_section.filters, $search_input);
+ const $search_input = $container.find(".search");
+ return are_filters_active(section.filters, $search_input);
},
onupdate: reset_scrollbar($all_bots_table),
},
- $parent_container: $("#admin-all-bots-list").expectOne(),
+ $parent_container: $container.expectOne(),
init_sort: "full_name_alphabetic",
sort_fields: {
email: sort_bot_email,
@@ -618,37 +615,41 @@ function create_all_bots_table(): void {
role: user_sort.sort_role,
...ListWidget.generic_sort_functions("alphabetic", ["full_name", "bot_type"]),
},
- $simplebar_container: $("#admin-all-bots-list .progressive-table-wrapper"),
+ $simplebar_container: $container.find(".progressive-table-wrapper"),
});
- settings_users.set_text_search_value($all_bots_table, all_bots_section.filters.text_search);
+ settings_users.set_text_search_value($all_bots_table, section.filters.text_search);
- loading.destroy_indicator($("#admin_page_all_bots_loading_indicator"));
+ loading.destroy_indicator($container.find("loading-indicator"));
$all_bots_table.show();
}
-function create_your_bots_table(): void {
- loading.make_indicator($("#admin_page_your_bots_loading_indicator"), {
+function create_your_bots_table(
+ section: BotSettingsSection,
+ $container: JQuery,
+ widget_name: string,
+): void {
+ loading.make_indicator($container.find("loading-indicator"), {
text: $t({defaultMessage: "Loading…"}),
});
- const $your_bots_table = $("#admin_your_bots_table");
+ const $your_bots_table = $container.find(".bot-table");
$your_bots_table.hide();
const bot_user_ids = bot_data.get_all_bots_ids_for_current_user();
- your_bots_section.list_widget = ListWidget.create($your_bots_table, bot_user_ids, {
- name: "admin_your_bot_list",
+ section.list_widget = ListWidget.create($your_bots_table, bot_user_ids, {
+ name: widget_name,
get_item: bot_info,
modifier_html: render_settings_user_list_row,
html_selector: (item) => $(`tr[data-user-id='${CSS.escape(item.user_id.toString())}']`),
filter: {
predicate(item) {
- return predicate_for_bot_filtering(item, your_bots_section);
+ return predicate_for_bot_filtering(item, section);
},
is_active() {
- const $search_input = $("#admin-your-bots-list .search");
- return are_filters_active(your_bots_section.filters, $search_input);
+ const $search_input = $container.find(".search");
+ return are_filters_active(section.filters, $search_input);
},
onupdate: reset_scrollbar($your_bots_table),
},
- $parent_container: $("#admin-your-bots-list").expectOne(),
+ $parent_container: $container.expectOne(),
init_sort: "full_name_alphabetic",
sort_fields: {
email: sort_bot_email,
@@ -656,59 +657,40 @@ function create_your_bots_table(): void {
role: user_sort.sort_role,
...ListWidget.generic_sort_functions("alphabetic", ["full_name", "bot_type"]),
},
- $simplebar_container: $("#admin-your-bots-list .progressive-table-wrapper"),
+ $simplebar_container: $container.find(".progressive-table-wrapper"),
});
- settings_users.set_text_search_value($your_bots_table, your_bots_section.filters.text_search);
+ settings_users.set_text_search_value($your_bots_table, section.filters.text_search);
- loading.destroy_indicator($("#admin_page_your_bots_loading_indicator"));
+ loading.destroy_indicator($container.find("loading-indicator"));
$your_bots_table.show();
}
export function update_bot_data(bot_user_id: number): void {
- if (all_bots_section.list_widget) {
- all_bots_section.list_widget.render_item(bot_info(bot_user_id));
+ if (org_all_bots_section.list_widget) {
+ org_all_bots_section.list_widget.render_item(bot_info(bot_user_id));
}
- if (your_bots_section.list_widget) {
- your_bots_section.list_widget.render_item(bot_info(bot_user_id));
+ if (org_your_bots_section.list_widget) {
+ org_your_bots_section.list_widget.render_item(bot_info(bot_user_id));
}
}
-function all_bots_handle_events(): void {
- const $tbody = $("#admin_all_bots_table").expectOne();
-
- handle_filter_change($tbody, all_bots_section);
+function handle_events($tbody: JQuery, section: BotSettingsSection): void {
+ handle_filter_change($tbody, section);
handle_bot_deactivation($tbody);
settings_users.handle_reactivation($tbody);
settings_users.handle_edit_form($tbody);
settings_users.handle_clear_button_for_table_search_input($tbody);
}
-function your_bots_handle_events(): void {
- const $tbody = $("#admin_your_bots_table").expectOne();
-
- handle_filter_change($tbody, your_bots_section);
- handle_bot_deactivation($tbody);
- settings_users.handle_reactivation($tbody);
- settings_users.handle_edit_form($tbody);
- settings_users.handle_clear_button_for_table_search_input($tbody);
-}
-
-export function set_up_bots(): void {
- all_bots_section.handle_events();
- your_bots_section.handle_events();
- all_bots_section.create_table();
- your_bots_section.create_table();
-
- $("#admin-bot-list .add-a-new-bot").on("click", (e) => {
+function set_up_bot_handlers($container: JQuery): void {
+ $container.find(".add-a-new-bot").on("click", (e) => {
e.preventDefault();
e.stopPropagation();
add_a_new_bot();
});
- create_status_filter_dropdown($("#admin-all-bots-list"), all_bots_section);
- create_status_filter_dropdown($("#admin-your-bots-list"), your_bots_section);
- $("#download-botserverrc-file").on("click", (e) => {
+ $container.find(".download-botserverrc-file").on("click", (e) => {
void (async () => {
let content = "";
buttons.show_button_loading_indicator($(e.currentTarget));
@@ -735,16 +717,17 @@ export function set_up_bots(): void {
buttons.hide_button_loading_indicator($(e.currentTarget));
$(e.currentTarget).prop("disabled", false);
- $("#hidden-botserverrc-download").attr(
- "href",
- "data:application/octet-stream;charset=utf-8," + encodeURIComponent(content),
- );
- $("#hidden-botserverrc-download")[0]?.click();
+ $container
+ .find(".hidden-botserverrc-download")
+ .attr(
+ "href",
+ "data:application/octet-stream;charset=utf-8," + encodeURIComponent(content),
+ );
+ $container.find(".hidden-botserverrc-download")[0]?.click();
})();
});
- toggle_bot_config_download_container();
- $("#admin-bot-list").on("click", ".download-bot-zuliprc-button", function (this: HTMLElement) {
+ $container.on("click", ".download-bot-zuliprc-button", function (this: HTMLElement) {
void (async () => {
const $row = $(this).closest(".user_row");
const $zuliprc_link = $row.find(".hidden-zuliprc-download");
@@ -762,24 +745,38 @@ export function set_up_bots(): void {
})();
});
- $("#admin-bot-list").on(
- "click",
- ".generate-integration-url-button",
- function (this: HTMLElement) {
- const $button = $(this);
- const $row = $button.closest(".user_row");
- const bot_id = Number.parseInt($row.attr("data-user-id")!, 10);
- void (async () => {
- const api_key = await bot_helper.fetch_bot_api_key(
- bot_id,
- $row.closest(".bot-settings-section").find(".bot-list-error"),
- $button,
- );
- if (!api_key) {
- return;
- }
- integration_url_modal.show_generate_integration_url_modal(api_key);
- })();
- },
+ $container.on("click", ".generate-integration-url-button", function (this: HTMLElement) {
+ const $button = $(this);
+ const $row = $button.closest(".user_row");
+ const bot_id = Number.parseInt($row.attr("data-user-id")!, 10);
+ void (async () => {
+ const api_key = await bot_helper.fetch_bot_api_key(
+ bot_id,
+ $row.closest(".bot-settings-section").find(".bot-list-error"),
+ $button,
+ );
+ if (!api_key) {
+ return;
+ }
+ integration_url_modal.show_generate_integration_url_modal(api_key);
+ })();
+ });
+}
+
+export function set_up_bots(): void {
+ handle_events($("#admin_all_bots_table"), org_all_bots_section);
+ handle_events($("#admin_your_bots_table"), org_your_bots_section);
+ create_all_bots_table(org_all_bots_section, $("#admin-all-bots-list"), "admin_all_bot_list");
+ create_your_bots_table(
+ org_your_bots_section,
+ $("#admin-your-bots-list"),
+ "admin_your_bot_list",
);
+
+ set_up_bot_handlers($("#admin-bot-list"));
+
+ create_status_filter_dropdown($("#admin-all-bots-list"), org_all_bots_section);
+ create_status_filter_dropdown($("#admin-your-bots-list"), org_your_bots_section);
+
+ toggle_bot_config_download_container();
}
diff --git a/web/src/settings_panel_menu.ts b/web/src/settings_panel_menu.ts
index e8e4c08dd15..d384278b39b 100644
--- a/web/src/settings_panel_menu.ts
+++ b/web/src/settings_panel_menu.ts
@@ -39,7 +39,7 @@ function two_column_mode(): boolean {
return Number.parseInt($("#settings_content").css("--column-count"), 10) === 2;
}
-function set_settings_header(key: string): void {
+function set_settings_header($elem: JQuery, key: string): void {
const selected_tab_key = $("#settings_page .tab-switcher .selected").attr("data-tab-key");
let header_prefix = $t_html({defaultMessage: "Personal settings"});
if (selected_tab_key === "organization") {
@@ -47,9 +47,7 @@ function set_settings_header(key: string): void {
}
$(".settings-header h1 .header-prefix").text(header_prefix);
- const header_text = $(
- `#settings_page .sidebar-list [data-section='${CSS.escape(key)}'] .text`,
- ).text();
+ const header_text = $elem.find(`[data-section='${CSS.escape(key)}'] .text`).text();
if (header_text) {
$(".settings-header h1 .section").text(" / " + header_text);
} else {
@@ -65,20 +63,24 @@ function set_settings_header(key: string): void {
export class SettingsPanelMenu {
$main_elem: JQuery;
hash_prefix: string;
+ base: string;
$curr_li: JQuery;
current_tab: string;
current_user_settings_tab: string | undefined;
- current_bot_settings_tab: string | undefined;
+ current_bot_settings_tab: Record<string, string>;
org_user_settings_toggler: Toggle;
org_bot_settings_toggler: Toggle;
constructor(opts: {$main_elem: JQuery; hash_prefix: string}) {
this.$main_elem = opts.$main_elem;
this.hash_prefix = opts.hash_prefix;
+ this.base = opts.hash_prefix === "settings/" ? "settings" : "organization";
this.$curr_li = this.$main_elem.children("li").eq(0);
this.current_tab = this.$curr_li.attr("data-section")!;
this.current_user_settings_tab = "active";
- this.current_bot_settings_tab = "all-bots";
+ this.current_bot_settings_tab = {
+ org: "all-bots",
+ };
this.org_user_settings_toggler = components.toggle({
html_class: "org-user-settings-switcher",
child_wants_focus: true,
@@ -112,8 +114,23 @@ export class SettingsPanelMenu {
},
});
- this.org_bot_settings_toggler = components.toggle({
- html_class: "org-bot-settings-switcher",
+ this.org_bot_settings_toggler = this.set_up_bot_settings_toggler("org");
+
+ this.$main_elem.on("click", "li[data-section]", (e) => {
+ const section = $(e.currentTarget).attr("data-section")!;
+
+ const settings_tab = this.get_settings_tab(section);
+ this.activate_section_or_default(section, settings_tab);
+ // You generally want to add logic to activate_section,
+ // not to this click handler.
+
+ e.stopPropagation();
+ });
+ }
+
+ set_up_bot_settings_toggler(prefix: string): Toggle {
+ return components.toggle({
+ html_class: `${prefix}-bot-settings-switcher`,
child_wants_focus: true,
values: [
{label: $t({defaultMessage: "All bots"}), key: "all-bots"},
@@ -123,8 +140,8 @@ export class SettingsPanelMenu {
},
],
callback: (_name, key) => {
- browser_history.update(`#organization/bots/${key}`);
- this.set_bot_settings_tab(key);
+ browser_history.update(`#${this.base}/bots/${key}`);
+ this.set_bot_settings_tab(key, prefix);
$(".bot-settings-section").hide();
if (key === "all-bots") {
redraw_all_bots_list();
@@ -134,17 +151,6 @@ export class SettingsPanelMenu {
$(`[data-bot-settings-section="${CSS.escape(key)}"]`).show();
},
});
-
- this.$main_elem.on("click", "li[data-section]", (e) => {
- const section = $(e.currentTarget).attr("data-section")!;
-
- const settings_tab = this.get_settings_tab(section);
- this.activate_section_or_default(section, settings_tab);
- // You generally want to add logic to activate_section,
- // not to this click handler.
-
- e.stopPropagation();
- });
}
show(): void {
@@ -170,15 +176,15 @@ export class SettingsPanelMenu {
}
}
- show_org_bot_settings_toggler(): void {
- if ($("#admin-bot-list").find(".tab-switcher").length === 0) {
- const toggler_html = util.the(this.org_bot_settings_toggler.get());
- $("#admin-bot-list .tab-container").html(toggler_html);
+ show_bot_settings_toggler(toggler: Toggle, $container: JQuery): void {
+ if ($container.find(".tab-switcher").length === 0) {
+ const toggler_html = util.the(toggler.get());
+ $container.find(".tab-container").html(toggler_html);
// We need to re-register these handlers since they are
// destroyed once the settings modal closes.
- this.org_bot_settings_toggler.register_event_handlers();
- this.set_key_handlers(this.org_bot_settings_toggler, $(".org-bot-settings-switcher"));
+ toggler.register_event_handlers();
+ this.set_key_handlers(toggler, $container.find(".tab-switcher"));
}
}
@@ -187,7 +193,7 @@ export class SettingsPanelMenu {
}
li_for_section(section: string): JQuery {
- const $li = $(`#settings_overlay_container li[data-section='${CSS.escape(section)}']`);
+ const $li = this.$main_elem.find(`li[data-section='${CSS.escape(section)}']`);
return $li;
}
@@ -241,8 +247,8 @@ export class SettingsPanelMenu {
this.current_user_settings_tab = tab;
}
- set_bot_settings_tab(tab: string): void {
- this.current_bot_settings_tab = tab;
+ set_bot_settings_tab(tab: string, prefix: string): void {
+ this.current_bot_settings_tab[prefix] = tab;
}
get_settings_tab(section: string): string | undefined {
@@ -251,7 +257,7 @@ export class SettingsPanelMenu {
}
if (section === "bots") {
- return this.current_bot_settings_tab;
+ return this.current_bot_settings_tab["org"];
}
return undefined;
@@ -304,7 +310,7 @@ export class SettingsPanelMenu {
if (section === "bots" && this.org_bot_settings_toggler !== undefined) {
assert(settings_tab !== undefined);
- this.show_org_bot_settings_toggler();
+ this.show_bot_settings_toggler(this.org_bot_settings_toggler, $("#admin-bot-list"));
this.org_bot_settings_toggler.goto(settings_tab);
}
@@ -320,14 +326,14 @@ export class SettingsPanelMenu {
mobile_activate_section();
}
- set_settings_header(section);
+ set_settings_header(this.$main_elem, section);
resize_textareas_in_section(this.get_panel());
}
get_panel(): JQuery {
const section = this.$curr_li.attr("data-section")!;
const sel = `[data-name='${CSS.escape(section)}']`;
- const $panel = $(".settings-section" + sel);
+ const $panel = $(`.${CSS.escape(this.base)}-box`).find(".settings-section" + sel);
return $panel;
}
}
diff --git a/web/templates/settings/admin_tab.hbs b/web/templates/settings/admin_tab.hbs
index 367050892a5..7146ff6a11d 100644
--- a/web/templates/settings/admin_tab.hbs
+++ b/web/templates/settings/admin_tab.hbs
@@ -15,7 +15,7 @@
{{> user_list_admin . }}
-{{> bot_list_admin . }}
+{{> bot_list_admin . prefix="admin" }}
{{> admin_channel_folders .}}
diff --git a/web/templates/settings/bot_list.hbs b/web/templates/settings/bot_list.hbs
index 81fea1ffa1f..fd244636b4e 100644
--- a/web/templates/settings/bot_list.hbs
+++ b/web/templates/settings/bot_list.hbs
@@ -29,8 +29,8 @@
<th class="actions">{{t "Actions" }}</th>
</tr>
</thead>
- <tbody id="admin_{{section_name}}_table" class="admin_bot_table"
+ <tbody id="{{prefix}}_{{section_name}}_table" class="bot-table"
data-empty="{{#if (eq section_name 'all_bots')}}{{t 'There are no active bots in this organization.' }}{{else}}{{t 'You have no active bots'}}{{/if}}" data-search-results-empty="{{#if (eq section_name 'all_bots')}}{{t 'No bots match your current filter.' }}{{else}}{{t 'None of your bots match your current filter.' }}{{/if}}"></tbody>
</table>
</div>
-<div id="admin_page_{{section_name}}_loading_indicator"></div>
+<div id="{{prefix}}_page_{{section_name}}_loading_indicator" class="loading-indicator"></div>
diff --git a/web/templates/settings/bot_list_admin.hbs b/web/templates/settings/bot_list_admin.hbs
index d22b898961f..5c2a53afbc0 100644
--- a/web/templates/settings/bot_list_admin.hbs
+++ b/web/templates/settings/bot_list_admin.hbs
@@ -1,5 +1,5 @@
-<div id="admin-bot-list" class="settings-section" data-name="bots">
- <div class="bot-settings-tip banner-wrapper" id="admin-bot-settings-tip">
+<div id="{{prefix}}-bot-list" class="settings-section" data-name="bots">
+ <div class="bot-settings-tip banner-wrapper" id="{{prefix}}-bot-settings-tip">
</div>
<div class="clear-float"></div>
<div>
@@ -12,24 +12,24 @@
}}
</div>
<div class="tab-container"></div>
- <div id="admin-all-bots-list" class="bot-settings-section user-or-bot-settings-section" data-bot-settings-section="all-bots">
+ <div id="{{prefix}}-all-bots-list" class="bot-settings-section user-or-bot-settings-section" data-bot-settings-section="all-bots">
<div class="bot-list-error banner-wrapper"></div>
{{> bot_list
section_name="all_bots"
section_title=(t "All bots")
dropdown_widget_name=all_bots_list_dropdown_widget_name
+ prefix=prefix
}}
</div>
- <div id="admin-your-bots-list" class="bot-settings-section user-or-bot-settings-section" data-bot-settings-section="your-bots">
+ <div id="{{prefix}}-your-bots-list" class="bot-settings-section user-or-bot-settings-section" data-bot-settings-section="your-bots">
<div class="bot-list-error banner-wrapper"></div>
- <div id="botserverrc-text-container" class="config-download-text">
+ <div class="config-download-text">
<span>{{t 'Download config of all active outgoing webhook bots in Zulip Botserver format.' }}</span>
- <a type="submit" download="botserverrc" id= "hidden-botserverrc-download" hidden></a>
+ <a type="submit" download="botserverrc" class="hidden-botserverrc-download" hidden></a>
{{> ../components/icon_button
- id= "download-botserverrc-file"
icon="download"
intent="brand"
- custom_classes="tippy-zulip-delayed-tooltip"
+ custom_classes="download-botserverrc-file tippy-zulip-delayed-tooltip"
data-tippy-content=(t "Download botserverrc")
}}
</div>
@@ -38,6 +38,7 @@
section_name="your_bots"
section_title=(t "Your bots")
dropdown_widget_name=your_bots_list_dropdown_widget_name
+ prefix=prefix
}}
</div>
</div>