- Notifications
You must be signed in to change notification settings - Fork914
fix: add link to troubleshooting#16592
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
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 |
---|---|---|
@@ -2,7 +2,12 @@ import type { Interpolation, Theme } from "@emotion/react"; | ||
import InfoOutlined from "@mui/icons-material/InfoOutlined"; | ||
import WarningRounded from "@mui/icons-material/WarningRounded"; | ||
import { workspaceResolveAutostart } from "api/queries/workspaceQuota"; | ||
import type { | ||
Template, | ||
TemplateVersion, | ||
Workspace, | ||
WorkspaceBuild, | ||
} from "api/typesGenerated"; | ||
import { MemoizedInlineMarkdown } from "components/Markdown/Markdown"; | ||
import formatDistanceToNow from "date-fns/formatDistanceToNow"; | ||
import dayjs from "dayjs"; | ||
@@ -82,6 +87,9 @@ export const WorkspaceNotifications: FC<WorkspaceNotificationsProps> = ({ | ||
workspace.latest_build.status === "running" && | ||
!workspace.health.healthy | ||
) { | ||
const troubleshootingURL = findTroubleshootingURL(workspace.latest_build); | ||
const hasActions = permissions.updateWorkspace || troubleshootingURL; | ||
notifications.push({ | ||
title: "Workspace is unhealthy", | ||
severity: "warning", | ||
@@ -94,10 +102,21 @@ export const WorkspaceNotifications: FC<WorkspaceNotificationsProps> = ({ | ||
. | ||
</> | ||
), | ||
actions: hasActions ? ( | ||
<> | ||
{permissions.updateWorkspace && ( | ||
<NotificationActionButton onClick={onRestartWorkspace}> | ||
Restart | ||
</NotificationActionButton> | ||
)} | ||
{troubleshootingURL && ( | ||
<NotificationActionButton | ||
onClick={() => window.open(troubleshootingURL, "_blank")} | ||
> | ||
Troubleshooting | ||
</NotificationActionButton> | ||
)} | ||
</> | ||
) : undefined, | ||
}); | ||
} | ||
@@ -254,3 +273,18 @@ const styles = { | ||
gap: 12, | ||
}, | ||
} satisfies Record<string, Interpolation<Theme>>; | ||
const findTroubleshootingURL = ( | ||
workspaceBuild: WorkspaceBuild, | ||
): string | undefined => { | ||
for (const resource of workspaceBuild.resources) { | ||
if (resource.agents) { | ||
for (const agent of resource.agents) { | ||
if (agent.troubleshooting_url) { | ||
return agent.troubleshooting_url; | ||
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. non-blocking: I can imagine a situation where a multi-agent workspace has a different troubleshooting URL for each agent. We might need some design changes to show multiple troubleshooting URLs though. 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. I thought about this case! I concluded that having different Troubleshooting guides for various agents is an edge case. | ||
} | ||
} | ||
} | ||
} | ||
return undefined; | ||
}; |
Uh oh!
There was an error while loading.Please reload this page.