- Notifications
You must be signed in to change notification settings - Fork1k
feat: show workspace health error alert above agents in WorkspacePage#19400
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
e3f1b21
9b89bb1
2d5b791
b6cfffc
988c3d3
eb0711f
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -9,6 +9,7 @@ import type { ProvisionerJobLog } from "api/typesGenerated"; | ||
import { action } from "storybook/actions"; | ||
import type { WorkspacePermissions } from "../../modules/workspaces/permissions"; | ||
import { Workspace } from "./Workspace"; | ||
import { defaultPermissions } from "./WorkspaceNotifications/WorkspaceNotifications.stories"; | ||
// Helper function to create timestamps easily - Copied from AppStatuses.stories.tsx | ||
const createTimestamp = ( | ||
@@ -349,6 +350,23 @@ export const Stopping: Story = { | ||
}, | ||
}; | ||
export const Unhealthy: Story = { | ||
aqandrew marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
args: { | ||
...Running.args, | ||
workspace: Mocks.MockUnhealthyWorkspace, | ||
}, | ||
}; | ||
export const UnhealthyWithoutUpdatePermission: Story = { | ||
args: { | ||
...Unhealthy.args, | ||
permissions: { | ||
...defaultPermissions, | ||
updateWorkspace: false, | ||
}, | ||
}, | ||
}; | ||
export const FailedWithLogs: Story = { | ||
args: { | ||
...Running.args, | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -21,6 +21,8 @@ import { | ||
WorkspaceBuildProgress, | ||
} from "./WorkspaceBuildProgress"; | ||
import { WorkspaceDeletedBanner } from "./WorkspaceDeletedBanner"; | ||
import { NotificationActionButton } from "./WorkspaceNotifications/Notifications"; | ||
import { findTroubleshootingURL } from "./WorkspaceNotifications/WorkspaceNotifications"; | ||
import { WorkspaceTopbar } from "./WorkspaceTopbar"; | ||
interface WorkspaceProps { | ||
@@ -95,6 +97,8 @@ export const Workspace: FC<WorkspaceProps> = ({ | ||
(workspace.latest_build.matched_provisioners?.available ?? 1) > 0; | ||
const shouldShowProvisionerAlert = | ||
workspacePending && !haveBuildLogs && !provisionersHealthy && !isRestarting; | ||
const troubleshootingURL = findTroubleshootingURL(workspace.latest_build); | ||
const hasActions = permissions.updateWorkspace || troubleshootingURL; | ||
return ( | ||
<div className="flex flex-col flex-1 min-h-0"> | ||
@@ -192,6 +196,41 @@ export const Workspace: FC<WorkspaceProps> = ({ | ||
</Alert> | ||
)} | ||
{!workspace.health.healthy && ( | ||
<Alert severity="warning"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more.
Does it make sense to keep these colors? Or should we do something like give There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. the existing popup has the same problem. it should definitely get fixed eventually but our colors are a bit of a mess right now. probably out of scope for this issue. | ||
<AlertTitle>Workspace is unhealthy</AlertTitle> | ||
<AlertDetail> | ||
<p> | ||
Your workspace is running but{" "} | ||
{workspace.health.failing_agents.length > 1 | ||
? `${workspace.health.failing_agents.length} agents are unhealthy` | ||
: "1 agent is unhealthy"} | ||
. | ||
</p> | ||
{hasActions && ( | ||
<div className="flex items-center gap-2"> | ||
{permissions.updateWorkspace && ( | ||
<NotificationActionButton | ||
onClick={() => handleRestart()} | ||
> | ||
Restart | ||
</NotificationActionButton> | ||
)} | ||
{troubleshootingURL && ( | ||
<NotificationActionButton | ||
onClick={() => | ||
window.open(troubleshootingURL, "_blank") | ||
} | ||
> | ||
Troubleshooting | ||
</NotificationActionButton> | ||
)} | ||
</div> | ||
)} | ||
</AlertDetail> | ||
</Alert> | ||
)} | ||
{transitionStats !== undefined && ( | ||
<WorkspaceBuildProgress | ||
workspace={workspace} | ||
Uh oh!
There was an error while loading.Please reload this page.