Skip to content

Commit 90e2bab

Browse files
feat(site): Display workspace build error + option to retry in debug mode (coder#6903)
1 parent 901045a commit 90e2bab

File tree

12 files changed

+722
-90
lines changed

12 files changed

+722
-90
lines changed

site/src/api/api.ts

+18-4
Original file line numberDiff line numberDiff line change
@@ -489,15 +489,29 @@ export const postWorkspaceBuild = async (
489489
export const startWorkspace = (
490490
workspaceId: string,
491491
templateVersionID: string,
492+
logLevel?: TypesGen.CreateWorkspaceBuildRequest["log_level"],
492493
) =>
493494
postWorkspaceBuild(workspaceId, {
494495
transition: "start",
495496
template_version_id: templateVersionID,
497+
log_level: logLevel,
498+
})
499+
export const stopWorkspace = (
500+
workspaceId: string,
501+
logLevel?: TypesGen.CreateWorkspaceBuildRequest["log_level"],
502+
) =>
503+
postWorkspaceBuild(workspaceId, {
504+
transition: "stop",
505+
log_level: logLevel,
506+
})
507+
export const deleteWorkspace = (
508+
workspaceId: string,
509+
logLevel?: TypesGen.CreateWorkspaceBuildRequest["log_level"],
510+
) =>
511+
postWorkspaceBuild(workspaceId, {
512+
transition: "delete",
513+
log_level: logLevel,
496514
})
497-
export const stopWorkspace = (workspaceId: string) =>
498-
postWorkspaceBuild(workspaceId, { transition: "stop" })
499-
export const deleteWorkspace = (workspaceId: string) =>
500-
postWorkspaceBuild(workspaceId, { transition: "delete" })
501515

502516
export const cancelWorkspaceBuild = async (
503517
workspaceBuildId: TypesGen.WorkspaceBuild["id"],

site/src/components/AlertBanner/AlertBanner.tsx

+13-4
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,14 @@ export const AlertBanner: FC<React.PropsWithChildren<AlertBannerProps>> = ({
6060
spacing={0}
6161
justifyContent="space-between"
6262
>
63-
<Stack direction="row" alignItems="center" spacing={1}>
63+
<Stack
64+
direction="row"
65+
alignItems="center"
66+
spacing={2}
67+
className={classes.fullWidth}
68+
>
6469
{severityConstants[severity].icon}
65-
<Stack spacing={0}>
70+
<Stack spacing={0} className={classes.fullWidth}>
6671
{children}
6772
{alertMessage}
6873
{detail && (
@@ -94,11 +99,11 @@ const useStyles = makeStyles<Theme, StyleProps>((theme) => ({
9499
borderColor: severityConstants[props.severity].color,
95100
border: `1px solid ${colors.orange[7]}`,
96101
borderRadius: theme.shape.borderRadius,
97-
padding: `${theme.spacing(1)}px ${theme.spacing(2)}px`,
102+
padding: theme.spacing(2),
98103
backgroundColor: `${colors.gray[16]}`,
99104
textAlign: "left",
100105

101-
"& span": {
106+
"& > span": {
102107
paddingTop: `${theme.spacing(0.25)}px`,
103108
},
104109

@@ -108,4 +113,8 @@ const useStyles = makeStyles<Theme, StyleProps>((theme) => ({
108113
marginRight: `${theme.spacing(1)}px`,
109114
},
110115
}),
116+
117+
fullWidth: {
118+
width: "100%",
119+
},
111120
}))

site/src/components/AlertBanner/severityConstants.tsx

+3-7
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,20 @@ export const severityConstants: Record<
1313
color: colors.orange[7],
1414
icon: (
1515
<ReportProblemOutlinedIcon
16-
fontSize="small"
17-
style={{ color: colors.orange[7] }}
16+
style={{ color: colors.orange[7], fontSize: 16 }}
1817
/>
1918
),
2019
},
2120
error: {
2221
color: colors.red[7],
2322
icon: (
2423
<ErrorOutlineOutlinedIcon
25-
fontSize="small"
26-
style={{ color: colors.red[7] }}
24+
style={{ color: colors.red[7], fontSize: 16 }}
2725
/>
2826
),
2927
},
3028
info: {
3129
color: colors.blue[7],
32-
icon: (
33-
<InfoOutlinedIcon fontSize="small" style={{ color: colors.blue[7] }} />
34-
),
30+
icon: <InfoOutlinedIcon style={{ color: colors.blue[7], fontSize: 16 }} />,
3531
},
3632
}

site/src/components/Logs/Logs.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const useStyles = makeStyles<
9393
background: theme.palette.background.default,
9494
},
9595
scrollWrapper: {
96-
width: "fit-content",
96+
minWidth: "fit-content",
9797
},
9898
line: {
9999
wordBreak: "break-all",
@@ -109,7 +109,7 @@ const useStyles = makeStyles<
109109
},
110110

111111
"&.debug": {
112-
backgroundColor: theme.palette.grey[900],
112+
backgroundColor: theme.palette.background.paperLight,
113113
},
114114

115115
"&.warn": {

0 commit comments

Comments
 (0)