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

Commit9a872f9

Browse files
authored
feat: show workspace health error alert above agents in WorkspacePage (#19400)
closes#19338 <img width="1840" height="1191" alt="image"src="https://github.com/user-attachments/assets/eeefda13-88d1-4a26-ba57-9749abda3f17"/>
1 parentad5e678 commit9a872f9

File tree

5 files changed

+82
-2
lines changed

5 files changed

+82
-2
lines changed

‎site/src/pages/WorkspacePage/Workspace.stories.tsx‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type { ProvisionerJobLog } from "api/typesGenerated";
99
import{action}from"storybook/actions";
1010
importtype{WorkspacePermissions}from"../../modules/workspaces/permissions";
1111
import{Workspace}from"./Workspace";
12+
import{defaultPermissions}from"./WorkspaceNotifications/WorkspaceNotifications.stories";
1213

1314
// Helper function to create timestamps easily - Copied from AppStatuses.stories.tsx
1415
constcreateTimestamp=(
@@ -349,6 +350,23 @@ export const Stopping: Story = {
349350
},
350351
};
351352

353+
exportconstUnhealthy:Story={
354+
args:{
355+
...Running.args,
356+
workspace:Mocks.MockUnhealthyWorkspace,
357+
},
358+
};
359+
360+
exportconstUnhealthyWithoutUpdatePermission:Story={
361+
args:{
362+
...Unhealthy.args,
363+
permissions:{
364+
...defaultPermissions,
365+
updateWorkspace:false,
366+
},
367+
},
368+
};
369+
352370
exportconstFailedWithLogs:Story={
353371
args:{
354372
...Running.args,

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import {
2121
WorkspaceBuildProgress,
2222
}from"./WorkspaceBuildProgress";
2323
import{WorkspaceDeletedBanner}from"./WorkspaceDeletedBanner";
24+
import{NotificationActionButton}from"./WorkspaceNotifications/Notifications";
25+
import{findTroubleshootingURL}from"./WorkspaceNotifications/WorkspaceNotifications";
2426
import{WorkspaceTopbar}from"./WorkspaceTopbar";
2527

2628
interfaceWorkspaceProps{
@@ -97,6 +99,8 @@ export const Workspace: FC<WorkspaceProps> = ({
9799
(workspace.latest_build.matched_provisioners?.available??1)>0;
98100
constshouldShowProvisionerAlert=
99101
workspacePending&&!haveBuildLogs&&!provisionersHealthy&&!isRestarting;
102+
consttroubleshootingURL=findTroubleshootingURL(workspace.latest_build);
103+
consthasActions=permissions.updateWorkspace||troubleshootingURL;
100104

101105
return(
102106
<divclassName="flex flex-col flex-1 min-h-0">
@@ -194,6 +198,41 @@ export const Workspace: FC<WorkspaceProps> = ({
194198
</Alert>
195199
)}
196200

201+
{!workspace.health.healthy&&(
202+
<Alertseverity="warning">
203+
<AlertTitle>Workspace is unhealthy</AlertTitle>
204+
<AlertDetail>
205+
<p>
206+
Your workspace is running but{" "}
207+
{workspace.health.failing_agents.length>1
208+
?`${workspace.health.failing_agents.length} agents are unhealthy`
209+
:"1 agent is unhealthy"}
210+
.
211+
</p>
212+
{hasActions&&(
213+
<divclassName="flex items-center gap-2">
214+
{permissions.updateWorkspace&&(
215+
<NotificationActionButton
216+
onClick={()=>handleRestart()}
217+
>
218+
Restart
219+
</NotificationActionButton>
220+
)}
221+
{troubleshootingURL&&(
222+
<NotificationActionButton
223+
onClick={()=>
224+
window.open(troubleshootingURL,"_blank")
225+
}
226+
>
227+
Troubleshooting
228+
</NotificationActionButton>
229+
)}
230+
</div>
231+
)}
232+
</AlertDetail>
233+
</Alert>
234+
)}
235+
197236
{transitionStats!==undefined&&(
198237
<WorkspaceBuildProgress
199238
workspace={workspace}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type { WorkspacePermissions } from "modules/workspaces/permissions";
1212
import{expect,userEvent,waitFor,within}from"storybook/test";
1313
import{WorkspaceNotifications}from"./WorkspaceNotifications";
1414

15-
constdefaultPermissions:WorkspacePermissions={
15+
exportconstdefaultPermissions:WorkspacePermissions={
1616
readWorkspace:true,
1717
updateWorkspaceVersion:true,
1818
updateWorkspace:true,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ const styles = {
275275
},
276276
}satisfiesRecord<string,Interpolation<Theme>>;
277277

278-
constfindTroubleshootingURL=(
278+
exportconstfindTroubleshootingURL=(
279279
workspaceBuild:WorkspaceBuild,
280280
):string|undefined=>{
281281
for(constresourceofworkspaceBuild.resources){

‎site/src/testHelpers/entities.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,15 @@ export const MockWorkspaceSubAgent: TypesGen.WorkspaceAgent = {
994994
],
995995
};
996996

997+
constMockWorkspaceUnhealthyAgent:TypesGen.WorkspaceAgent={
998+
...MockWorkspaceAgent,
999+
id:"test-workspace-unhealthy-agent",
1000+
name:"a-workspace-unhealthy-agent",
1001+
status:"timeout",
1002+
lifecycle_state:"start_error",
1003+
health:{healthy:false},
1004+
};
1005+
9971006
exportconstMockWorkspaceAppStatus:TypesGen.WorkspaceAppStatus={
9981007
id:"test-app-status",
9991008
created_at:"2022-05-17T17:39:01.382927298Z",
@@ -1445,6 +1454,20 @@ export const MockStoppingWorkspace: TypesGen.Workspace = {
14451454
status:"stopping",
14461455
},
14471456
};
1457+
exportconstMockUnhealthyWorkspace:TypesGen.Workspace={
1458+
...MockWorkspace,
1459+
id:"test-unhealthy-workspace",
1460+
health:{
1461+
healthy:false,
1462+
failing_agents:[MockWorkspaceUnhealthyAgent.id],
1463+
},
1464+
latest_build:{
1465+
...MockWorkspace.latest_build,
1466+
resources:[
1467+
{ ...MockWorkspaceResource,agents:[MockWorkspaceUnhealthyAgent]},
1468+
],
1469+
},
1470+
};
14481471
exportconstMockStartingWorkspace:TypesGen.Workspace={
14491472
...MockWorkspace,
14501473
id:"test-starting-workspace",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp