diff --git a/site/src/pages/HealthPage/HealthLayout.tsx b/site/src/pages/HealthPage/HealthLayout.tsx
index 2c566500d892b..33ca8cbe31a17 100644
--- a/site/src/pages/HealthPage/HealthLayout.tsx
+++ b/site/src/pages/HealthPage/HealthLayout.tsx
@@ -7,6 +7,7 @@ import IconButton from "@mui/material/IconButton";
import Tooltip from "@mui/material/Tooltip";
import { health, refreshHealth } from "api/queries/debug";
import type { HealthSeverity } from "api/typesGenerated";
+import { ErrorAlert } from "components/Alert/ErrorAlert";
import { Loader } from "components/Loader/Loader";
import { type ClassName, useClassName } from "hooks/useClassName";
import kebabCase from "lodash/fp/kebabCase";
@@ -22,7 +23,11 @@ import { HealthIcon } from "./Content";
export const HealthLayout: FC = () => {
const theme = useTheme();
const queryClient = useQueryClient();
- const { data: healthStatus } = useQuery({
+ const {
+ data: healthStatus,
+ isLoading,
+ error,
+ } = useQuery({
...health(),
refetchInterval: 30_000,
});
@@ -42,161 +47,171 @@ export const HealthLayout: FC = () => {
const link = useClassName(classNames.link, []);
const activeLink = useClassName(classNames.activeLink, []);
+ if (isLoading || !healthStatus) {
+ return (
+
+
+
+ );
+ }
+
+ if (error) {
+ return (
+
+
+
+ );
+ }
+
return (
<>
{pageTitle("Health")}
- {healthStatus ? (
-
+
+
-
-
-
-
-
-
- {
- forceRefresh();
- }}
- >
- {isRefreshing ? (
-
- ) : (
-
- )}
-
-
-
-
- {healthStatus.healthy ? "Healthy" : "Unhealthy"}
-
-
- {healthStatus.healthy
- ? Object.keys(visibleSections).some((key) => {
- const section =
- healthStatus[key as keyof typeof visibleSections];
- return (
- section.warnings && section.warnings.length > 0
- );
- })
- ? "All systems operational, but performance might be degraded"
- : "All systems operational"
- : "Some issues have been detected"}
-
-
+
+
+
-
- Last check
-
- {createDayString(healthStatus.time)}
-
+
+ {
+ forceRefresh();
+ }}
+ >
+ {isRefreshing ? (
+
+ ) : (
+
+ )}
+
+
-
-
-
Version
-
- {healthStatus.coder_version}
-
+
+ {healthStatus.healthy ? "Healthy" : "Unhealthy"}
+
+
+ {healthStatus.healthy
+ ? Object.keys(visibleSections).some((key) => {
+ const section =
+ healthStatus[key as keyof typeof visibleSections];
+ return section.warnings && section.warnings.length > 0;
+ })
+ ? "All systems operational, but performance might be degraded"
+ : "All systems operational"
+ : "Some issues have been detected"}
-
-
+
+ Last check
+
+ {createDayString(healthStatus.time)}
+
+
-
-
}>
-
-
+
+ Version
+
+ {healthStatus.coder_version}
+
+
+
+
-
- ) : (
-
- )}
+
+
+ }>
+
+
+
+
+
>
);
};