From b749348c11a1630f97b4b97249568c262e09a172 Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Mon, 17 Feb 2025 13:23:21 +0100 Subject: [PATCH] fix: link to troubleshooting --- .../WorkspaceNotifications/Notifications.tsx | 5 ++- .../WorkspaceNotifications.tsx | 44 ++++++++++++++++--- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/site/src/pages/WorkspacePage/WorkspaceNotifications/Notifications.tsx b/site/src/pages/WorkspacePage/WorkspaceNotifications/Notifications.tsx index d7220e7028aca..24fae9d4b073a 100644 --- a/site/src/pages/WorkspacePage/WorkspaceNotifications/Notifications.tsx +++ b/site/src/pages/WorkspacePage/WorkspaceNotifications/Notifications.tsx @@ -100,7 +100,10 @@ export const NotificationActionButton: FC = (props) => { variant="text" css={{ textDecoration: "underline", - padding: 0, + paddingLeft: 0, + paddingRight: 8, + paddingTop: 0, + paddingBottom: 0, height: "auto", minWidth: "auto", "&:hover": { background: "none", textDecoration: "underline" }, diff --git a/site/src/pages/WorkspacePage/WorkspaceNotifications/WorkspaceNotifications.tsx b/site/src/pages/WorkspacePage/WorkspaceNotifications/WorkspaceNotifications.tsx index bcab68a9a592f..cf4631b34d2cb 100644 --- a/site/src/pages/WorkspacePage/WorkspaceNotifications/WorkspaceNotifications.tsx +++ b/site/src/pages/WorkspacePage/WorkspaceNotifications/WorkspaceNotifications.tsx @@ -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 } from "api/typesGenerated"; +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 = ({ 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 = ({ . ), - actions: permissions.updateWorkspace ? ( - - Restart - + actions: hasActions ? ( + <> + {permissions.updateWorkspace && ( + + Restart + + )} + {troubleshootingURL && ( + window.open(troubleshootingURL, "_blank")} + > + Troubleshooting + + )} + ) : undefined, }); } @@ -254,3 +273,18 @@ const styles = { gap: 12, }, } satisfies Record>; + +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; + } + } + } + } + return undefined; +}; 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