Skip to content

Commit 691c028

Browse files
committed
Move unhealthy to notifications array
1 parent 8f6040d commit 691c028

File tree

1 file changed

+22
-27
lines changed

1 file changed

+22
-27
lines changed

site/src/pages/WorkspacePage/WorkspaceNotifications.tsx

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,28 @@ export const WorkspaceNotifications: FC<WorkspaceNotificationsProps> = (
6565
}
6666
}
6767

68+
// Unhealthy
69+
if (
70+
workspace.latest_build.status === "running" &&
71+
!workspace.health.healthy
72+
) {
73+
notifications.push({
74+
title: "Workspace is unhealthy",
75+
severity: "warning",
76+
detail: `Your workspace is running but ${
77+
workspace.health.failing_agents.length > 1
78+
? `${workspace.health.failing_agents.length} agents are unhealthy`
79+
: `1 agent is unhealthy`
80+
}.`,
81+
actions: [
82+
{
83+
label: "Restart",
84+
onClick: onRestartWorkspace,
85+
},
86+
],
87+
});
88+
}
89+
6890
// Pending in Queue
6991
const [showAlertPendingInQueue, setShowAlertPendingInQueue] = useState(false);
7092
// 2023-11-15 - MES - This effect will be called every single render because
@@ -104,33 +126,6 @@ export const WorkspaceNotifications: FC<WorkspaceNotificationsProps> = (
104126

105127
return (
106128
<>
107-
{workspace.latest_build.status === "running" &&
108-
!workspace.health.healthy && (
109-
<Alert
110-
severity="warning"
111-
actions={
112-
permissions.updateWorkspace && (
113-
<Button
114-
variant="text"
115-
size="small"
116-
onClick={onRestartWorkspace}
117-
>
118-
Restart
119-
</Button>
120-
)
121-
}
122-
>
123-
<AlertTitle>Workspace is unhealthy</AlertTitle>
124-
<AlertDetail>
125-
Your workspace is running but{" "}
126-
{workspace.health.failing_agents.length > 1
127-
? `${workspace.health.failing_agents.length} agents are unhealthy`
128-
: `1 agent is unhealthy`}
129-
.
130-
</AlertDetail>
131-
</Alert>
132-
)}
133-
134129
<DormantWorkspaceBanner workspace={workspace} />
135130

136131
{showAlertPendingInQueue && (

0 commit comments

Comments
 (0)