Skip to content

Commit bff73ad

Browse files
feat(site): add warning for unhealthy workspace (#8422)
1 parent 86f8989 commit bff73ad

File tree

4 files changed

+85
-1
lines changed

4 files changed

+85
-1
lines changed

site/src/components/Workspace/Workspace.stories.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,20 @@ export const CancellationError: Story = {
234234
},
235235
}
236236

237+
export const Unhealthy: Story = {
238+
args: {
239+
...Running.args,
240+
workspace: {
241+
...Mocks.MockWorkspace,
242+
latest_build: { ...Mocks.MockWorkspace.latest_build, status: "running" },
243+
health: {
244+
healthy: false,
245+
failing_agents: [],
246+
},
247+
},
248+
},
249+
}
250+
237251
function makeFailedBuildLogs(): ProvisionerJobLog[] {
238252
return [
239253
{

site/src/components/Workspace/Workspace.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,19 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
225225
>
226226
{buildError}
227227
{cancellationError}
228+
{workspace.latest_build.status === "running" &&
229+
!workspace.health.healthy && (
230+
<Alert severity="warning">
231+
<AlertTitle>Workspace is unhealthy</AlertTitle>
232+
<AlertDetail>
233+
Your workspace is running but{" "}
234+
{workspace.health.failing_agents.length > 1
235+
? `${workspace.health.failing_agents.length} agents are unhealthy`
236+
: `1 agent is unhealthy`}
237+
.
238+
</AlertDetail>
239+
</Alert>
240+
)}
228241

229242
<ChooseOne>
230243
<Cond condition={workspace.latest_build.status === "deleted"}>

site/src/components/WorkspacesTable/WorkspacesRow.tsx

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ import { OutdatedHelpTooltip } from "components/Tooltips/OutdatedHelpTooltip"
1313
import { Avatar } from "components/Avatar/Avatar"
1414
import { Stack } from "components/Stack/Stack"
1515
import { useClickableTableRow } from "hooks/useClickableTableRow"
16+
import {
17+
HelpTooltip,
18+
HelpTooltipText,
19+
HelpTooltipTitle,
20+
} from "components/Tooltips/HelpTooltip"
21+
import InfoIcon from "@mui/icons-material/InfoOutlined"
22+
import { colors } from "theme/colors"
23+
import Box from "@mui/material/Box"
1624

1725
export const WorkspacesRow: FC<{
1826
workspace: Workspace
@@ -62,7 +70,11 @@ export const WorkspacesRow: FC<{
6270
</TableCell>
6371

6472
<TableCell>
65-
<WorkspaceStatusBadge workspace={workspace} />
73+
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
74+
<WorkspaceStatusBadge workspace={workspace} />
75+
{workspace.latest_build.status === "running" &&
76+
!workspace.health.healthy && <UnhealthyTooltip />}
77+
</Box>
6678
</TableCell>
6779

6880
<TableCell>
@@ -74,6 +86,25 @@ export const WorkspacesRow: FC<{
7486
)
7587
}
7688

89+
export const UnhealthyTooltip = () => {
90+
const styles = useStyles()
91+
92+
return (
93+
<HelpTooltip
94+
size="small"
95+
icon={InfoIcon}
96+
iconClassName={styles.unhealthyIcon}
97+
buttonClassName={styles.unhealthyButton}
98+
>
99+
<HelpTooltipTitle>Workspace is unhealthy</HelpTooltipTitle>
100+
<HelpTooltipText>
101+
Your workspace is running but some agents had failed during
102+
initialization.
103+
</HelpTooltipText>
104+
</HelpTooltip>
105+
)
106+
}
107+
77108
const useStyles = makeStyles((theme) => ({
78109
arrowRight: {
79110
color: theme.palette.text.secondary,
@@ -85,4 +116,16 @@ const useStyles = makeStyles((theme) => ({
85116
display: "flex",
86117
paddingLeft: theme.spacing(2),
87118
},
119+
120+
unhealthyIcon: {
121+
color: colors.yellow[5],
122+
},
123+
124+
unhealthyButton: {
125+
opacity: 1,
126+
127+
"&:hover": {
128+
opacity: 1,
129+
},
130+
},
88131
}))

site/src/pages/WorkspacesPage/WorkspacesPageView.stories.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,20 @@ export const NoSearchResults: Story = {
145145
},
146146
}
147147

148+
export const UnhealthyWorkspace: Story = {
149+
args: {
150+
workspaces: [
151+
{
152+
...createWorkspace("running"),
153+
health: {
154+
healthy: false,
155+
failing_agents: [],
156+
},
157+
},
158+
],
159+
},
160+
}
161+
148162
export const Error: Story = {
149163
args: {
150164
error: mockApiError({ message: "Something went wrong" }),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy