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.

loading_error: Extract the loading-error UI toggle to a shared module.

Aman Agrawalabcbb7daa06d
diff --git a/templates/zerver/app/index.html b/templates/zerver/app/index.html
index ca58c083b31..4ae020c088b 100644
--- a/templates/zerver/app/index.html
+++ b/templates/zerver/app/index.html
@@ -77,6 +77,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1943053 -->
align-items: center;
visibility: hidden;
}
+ body.app-loading-failed #app-loading-middle-content,
+ body.app-loading-failed #app-loading-bottom-content,
+ body.app-loading-failed .app {
+ display: none;
+ }
+ body.app-loading-failed #app-loading-error {
+ visibility: visible;
+ }
:root.dark-theme #app-loading {
background-color: hsl(0, 0%, 11%);
color: hsl(236, 33%, 90%);
diff --git a/tools/test-js-with-node b/tools/test-js-with-node
index f923d0edd1c..c1aa7eda7fa 100755
--- a/tools/test-js-with-node
+++ b/tools/test-js-with-node
@@ -149,6 +149,7 @@ EXEMPT_FILES = make_set(
"web/src/list_util.ts",
"web/src/list_widget.ts",
"web/src/loading.ts",
+ "web/src/loading_error.ts",
"web/src/local_message.ts",
"web/src/localstorage.ts",
"web/src/message_actions_popover.ts",
diff --git a/web/src/loading_error.ts b/web/src/loading_error.ts
new file mode 100644
index 00000000000..52af58cfc91
--- /dev/null
+++ b/web/src/loading_error.ts
@@ -0,0 +1,3 @@
+export function show_loading_error(): void {
+ document.body.classList.add("app-loading-failed");
+}
diff --git a/web/src/ui_init.js b/web/src/ui_init.js
index c6aa1c5e523..db8067f252f 100644
--- a/web/src/ui_init.js
+++ b/web/src/ui_init.js
@@ -65,6 +65,7 @@ import * as left_sidebar_navigation_area_popovers from "./left_sidebar_navigatio
import * as left_sidebar_tooltips from "./left_sidebar_tooltips.ts";
import * as lightbox from "./lightbox.ts";
import * as linkifiers from "./linkifiers.ts";
+import * as loading_error from "./loading_error.ts";
import * as local_message from "./local_message.ts";
import * as markdown from "./markdown.ts";
import * as markdown_config from "./markdown_config.ts";
@@ -899,10 +900,7 @@ $(() => {
setTimeout(fetch_state_data, retry_delay_secs * 1000);
return;
}
- $("#app-loading-middle-content").hide();
- $("#app-loading-bottom-content").hide();
- $(".app").hide();
- $("#app-loading-error").css({visibility: "visible"});
+ loading_error.show_loading_error();
},
});
}