Skip to content

refactor: show unhealthy status on workspace status indicator #17956

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

Merged
merged 2 commits into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
refactor: support unhealthy on workspace status indicator
  • Loading branch information
BrunoQuaresma committed May 20, 2025
commit adb120ee06b84a50994342a5502b739b4324669c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ export const Running: Story = {
},
};

export const Unhealthy: Story = {
args: {
workspace: {
...createWorkspaceWithStatus("running"),
health: {
healthy: false,
failing_agents: [],
},
},
},
};

export const Stopped: Story = {
args: {
workspace: createWorkspaceWithStatus("stopped"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import {
StatusIndicatorDot,
type StatusIndicatorProps,
} from "components/StatusIndicator/StatusIndicator";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "components/Tooltip/Tooltip";
import type { FC } from "react";
import type React from "react";
import {
Expand Down Expand Up @@ -32,18 +38,41 @@ export const WorkspaceStatusIndicator: FC<WorkspaceStatusIndicatorProps> = ({
workspace,
children,
}) => {
const { text, type } = getDisplayWorkspaceStatus(
let { text, type } = getDisplayWorkspaceStatus(
workspace.latest_build.status,
workspace.latest_build.job,
);

return (
if (!workspace.health.healthy) {
type = "warning";
}

const statusIndicator = (
<StatusIndicator variant={variantByStatusType[type]}>
<StatusIndicatorDot />
<span>
<span className="sr-only">Workspace status:</span> {text}
</span>
<span className="sr-only">Workspace status:</span> {text}
{children}
</StatusIndicator>
);

if (workspace.health.healthy) {
return statusIndicator;
}

return (
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<StatusIndicator variant={variantByStatusType[type]}>
<StatusIndicatorDot />
<span className="sr-only">Workspace status:</span> {text}
{children}
</StatusIndicator>
</TooltipTrigger>
<TooltipContent>
Your workspace is running but some agents are unhealthy.
</TooltipContent>
</Tooltip>
</TooltipProvider>
);
};
9 changes: 1 addition & 8 deletions site/src/pages/WorkspacesPage/WorkspacesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ export const WorkspacesTable: FC<WorkspacesTableProps> = ({
</TableCell>

<WorkspaceStatusCell workspace={workspace} />

<WorkspaceActionsCell
workspace={workspace}
onActionSuccess={onActionSuccess}
Expand Down Expand Up @@ -395,14 +396,6 @@ const WorkspaceStatusCell: FC<WorkspaceStatusCellProps> = ({ workspace }) => {
<TableCell>
<div className="flex flex-col">
<WorkspaceStatusIndicator workspace={workspace}>
{workspace.latest_build.status === "running" &&
!workspace.health.healthy && (
<InfoTooltip
type="warning"
title="Workspace is unhealthy"
message="Your workspace is running but some agents are unhealthy."
/>
)}
{workspace.dormant_at && (
<WorkspaceDormantBadge workspace={workspace} />
)}
Expand Down
Loading