Skip to content

Commit 1145725

Browse files
committed
Better workspace build state error
1 parent 9a0e553 commit 1145725

File tree

2 files changed

+20
-38
lines changed

2 files changed

+20
-38
lines changed

site/src/components/AlertBanner/alertTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export type Severity = "warning" | "error" | "info"
55

66
export interface AlertBannerProps {
77
severity: Severity
8-
text?: string
8+
text?: JSX.Element
99
error?: ApiError | Error | unknown
1010
actions?: ReactElement[]
1111
dismissible?: boolean
Lines changed: 19 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { makeStyles } from "@mui/styles"
1+
import Box from "@mui/material/Box"
22
import { WorkspaceBuild } from "api/typesGenerated"
3-
import { CodeExample } from "components/CodeExample/CodeExample"
4-
import { Stack } from "components/Stack/Stack"
3+
import { AlertBanner } from "components/AlertBanner/AlertBanner"
54

65
const Language = {
76
stateMessage:
@@ -15,43 +14,26 @@ export interface WorkspaceBuildStateErrorProps {
1514
export const WorkspaceBuildStateError: React.FC<
1615
WorkspaceBuildStateErrorProps
1716
> = ({ build }) => {
18-
const styles = useStyles()
19-
2017
const orphanCommand = `coder rm ${
2118
build.workspace_owner_name + "/" + build.workspace_name
2219
} --orphan`
2320
return (
24-
<Stack className={styles.root}>
25-
<Stack direction="row" alignItems="center" className={styles.messageBox}>
26-
<Stack direction="row" spacing={0}>
27-
<span className={styles.errorMessage}>
28-
{Language.stateMessage} A template admin may run{" "}
29-
<CodeExample inline code={orphanCommand} /> to delete the workspace
30-
skipping resource destruction.
31-
</span>
32-
</Stack>
33-
</Stack>
34-
</Stack>
21+
<AlertBanner
22+
severity="error"
23+
text={
24+
<Box>
25+
{Language.stateMessage} A template admin may run{" "}
26+
<Box
27+
component="code"
28+
display="inline-block"
29+
width="fit-content"
30+
fontWeight={600}
31+
>
32+
`{orphanCommand}`
33+
</Box>{" "}
34+
to delete the workspace skipping resource destruction.
35+
</Box>
36+
}
37+
></AlertBanner>
3538
)
3639
}
37-
38-
const useStyles = makeStyles((theme) => ({
39-
root: {
40-
background: theme.palette.warning.main,
41-
padding: theme.spacing(2),
42-
borderRadius: theme.shape.borderRadius,
43-
gap: 0,
44-
},
45-
flex: {
46-
display: "flex",
47-
},
48-
messageBox: {
49-
justifyContent: "space-between",
50-
},
51-
errorMessage: {
52-
marginRight: theme.spacing(1),
53-
},
54-
iconButton: {
55-
padding: 0,
56-
},
57-
}))

0 commit comments

Comments
 (0)