-
Notifications
You must be signed in to change notification settings - Fork 954
feat(site): add health warning and a health monitor page #8844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 16 commits
397a47a
91f5842
e150178
5bfb6d4
e1fd090
27a443c
bcd0b99
7bc5be8
09b7f1f
fa60206
1b466a6
7ea8cf9
75c485c
36bb10e
e4c4c75
89b238e
ce34a04
6b9b79c
35880f9
b9da348
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { Alert } from "components/Alert/Alert" | ||
mtojek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import { Link as RouterLink } from "react-router-dom" | ||
import Link from "@mui/material/Link" | ||
import { colors } from "theme/colors" | ||
import { useQuery } from "@tanstack/react-query" | ||
import { getHealth } from "api/api" | ||
import { useDashboard } from "./DashboardProvider" | ||
|
||
export const HealthBanner = () => { | ||
const { data: healthStatus } = useQuery({ | ||
queryKey: ["health"], | ||
queryFn: () => getHealth(), | ||
}) | ||
const dashboard = useDashboard() | ||
const hasHealthIssues = healthStatus && !healthStatus.data.healthy | ||
|
||
if ( | ||
dashboard.experiments.includes("deployment_health_page") && | ||
hasHealthIssues | ||
) { | ||
return ( | ||
<Alert | ||
severity="error" | ||
variant="filled" | ||
sx={{ | ||
border: 0, | ||
borderRadius: 0, | ||
backgroundColor: colors.red[10], | ||
}} | ||
> | ||
We have detected problems with your Coder deployment. Please{" "} | ||
<Link | ||
component={RouterLink} | ||
to="/health" | ||
sx={{ fontWeight: 600, color: "inherit" }} | ||
> | ||
inspect the health status | ||
</Link> | ||
. | ||
</Alert> | ||
) | ||
} | ||
|
||
return null | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Meta, StoryObj } from "@storybook/react" | ||
import { HealthPageView } from "./HealthPage" | ||
import { MockHealth } from "testHelpers/entities" | ||
|
||
const meta: Meta<typeof HealthPageView> = { | ||
title: "pages/HealthPageView", | ||
component: HealthPageView, | ||
args: { | ||
tab: { | ||
value: "derp", | ||
set: () => {}, | ||
}, | ||
healthStatus: MockHealth, | ||
}, | ||
} | ||
|
||
export default meta | ||
type Story = StoryObj<typeof HealthPageView> | ||
|
||
export const HealthPage: Story = {} | ||
|
||
export const UnhealthPage: Story = { | ||
args: { | ||
healthStatus: { | ||
...MockHealth, | ||
healthy: false, | ||
derp: { | ||
...MockHealth.derp, | ||
healthy: false, | ||
}, | ||
}, | ||
}, | ||
} |
Uh oh!
There was an error while loading. Please reload this page.