Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit42f6b71

Browse files
authored
fix: add link to troubleshooting (#16592)
Fixes:#14933
1 parente39f39e commit42f6b71

File tree

2 files changed

+43
-6
lines changed

2 files changed

+43
-6
lines changed

‎site/src/pages/WorkspacePage/WorkspaceNotifications/Notifications.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ export const NotificationActionButton: FC<ButtonProps> = (props) => {
100100
variant="text"
101101
css={{
102102
textDecoration:"underline",
103-
padding:0,
103+
paddingLeft:0,
104+
paddingRight:8,
105+
paddingTop:0,
106+
paddingBottom:0,
104107
height:"auto",
105108
minWidth:"auto",
106109
"&:hover":{background:"none",textDecoration:"underline"},

‎site/src/pages/WorkspacePage/WorkspaceNotifications/WorkspaceNotifications.tsx

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import type { Interpolation, Theme } from "@emotion/react";
22
importInfoOutlinedfrom"@mui/icons-material/InfoOutlined";
33
importWarningRoundedfrom"@mui/icons-material/WarningRounded";
44
import{workspaceResolveAutostart}from"api/queries/workspaceQuota";
5-
importtype{Template,TemplateVersion,Workspace}from"api/typesGenerated";
5+
importtype{
6+
Template,
7+
TemplateVersion,
8+
Workspace,
9+
WorkspaceBuild,
10+
}from"api/typesGenerated";
611
import{MemoizedInlineMarkdown}from"components/Markdown/Markdown";
712
importformatDistanceToNowfrom"date-fns/formatDistanceToNow";
813
importdayjsfrom"dayjs";
@@ -82,6 +87,9 @@ export const WorkspaceNotifications: FC<WorkspaceNotificationsProps> = ({
8287
workspace.latest_build.status==="running"&&
8388
!workspace.health.healthy
8489
){
90+
consttroubleshootingURL=findTroubleshootingURL(workspace.latest_build);
91+
consthasActions=permissions.updateWorkspace||troubleshootingURL;
92+
8593
notifications.push({
8694
title:"Workspace is unhealthy",
8795
severity:"warning",
@@ -94,10 +102,21 @@ export const WorkspaceNotifications: FC<WorkspaceNotificationsProps> = ({
94102
.
95103
</>
96104
),
97-
actions:permissions.updateWorkspace ?(
98-
<NotificationActionButtononClick={onRestartWorkspace}>
99-
Restart
100-
</NotificationActionButton>
105+
actions:hasActions ?(
106+
<>
107+
{permissions.updateWorkspace&&(
108+
<NotificationActionButtononClick={onRestartWorkspace}>
109+
Restart
110+
</NotificationActionButton>
111+
)}
112+
{troubleshootingURL&&(
113+
<NotificationActionButton
114+
onClick={()=>window.open(troubleshootingURL,"_blank")}
115+
>
116+
Troubleshooting
117+
</NotificationActionButton>
118+
)}
119+
</>
101120
) :undefined,
102121
});
103122
}
@@ -254,3 +273,18 @@ const styles = {
254273
gap:12,
255274
},
256275
}satisfiesRecord<string,Interpolation<Theme>>;
276+
277+
constfindTroubleshootingURL=(
278+
workspaceBuild:WorkspaceBuild,
279+
):string|undefined=>{
280+
for(constresourceofworkspaceBuild.resources){
281+
if(resource.agents){
282+
for(constagentofresource.agents){
283+
if(agent.troubleshooting_url){
284+
returnagent.troubleshooting_url;
285+
}
286+
}
287+
}
288+
}
289+
returnundefined;
290+
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp