Skip to content

Commit 9216725

Browse files
authored
chore: add alpha badges to workspace cleanup fields (coder#9802)
1 parent 8d8402d commit 9216725

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

site/src/components/DeploySettingsLayout/Badges.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@ export const EnterpriseBadge: FC = () => {
8585
);
8686
};
8787

88+
export const AlphaBadge: FC = () => {
89+
const styles = useStyles();
90+
return (
91+
<span className={combineClasses([styles.badge, styles.alphaBadge])}>
92+
Alpha
93+
</span>
94+
);
95+
};
96+
8897
export const Badges: FC<PropsWithChildren> = ({ children }) => {
8998
const styles = useStyles();
9099
return (
@@ -123,6 +132,11 @@ const useStyles = makeStyles((theme) => ({
123132
border: `1px solid ${theme.palette.info.light}`,
124133
},
125134

135+
alphaBadge: {
136+
border: `1px solid ${theme.palette.error.light}`,
137+
backgroundColor: theme.palette.error.dark,
138+
},
139+
126140
versionBadge: {
127141
border: `1px solid ${theme.palette.success.light}`,
128142
backgroundColor: theme.palette.success.dark,

site/src/components/Form/Form.tsx

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { makeStyles } from "@mui/styles";
2+
import { AlphaBadge } from "components/DeploySettingsLayout/Badges";
23
import {
34
FormFooterProps as BaseFormFooterProps,
45
FormFooter as BaseFormFooter,
@@ -67,8 +68,9 @@ export const FormSection: FC<
6768
sectionInfo?: string;
6869
infoTitle?: string;
6970
};
71+
alpha?: boolean;
7072
}
71-
> = ({ children, title, description, classes = {} }) => {
73+
> = ({ children, title, description, classes = {}, alpha = false }) => {
7274
const formContext = useContext(FormContext);
7375
const styles = useStyles(formContext);
7476

@@ -83,10 +85,12 @@ export const FormSection: FC<
8385
<h2
8486
className={combineClasses([
8587
styles.formSectionInfoTitle,
88+
alpha && styles.formSectionInfoTitleAlpha,
8689
classes.infoTitle,
8790
])}
8891
>
8992
{title}
93+
{alpha && <AlphaBadge />}
9094
</h2>
9195
<div className={styles.formSectionInfoDescription}>{description}</div>
9296
</div>
@@ -171,6 +175,13 @@ const useStyles = makeStyles((theme) => ({
171175
marginBottom: theme.spacing(1),
172176
},
173177

178+
formSectionInfoTitleAlpha: {
179+
display: "flex",
180+
flexDirection: "row",
181+
alignItems: "center",
182+
gap: theme.spacing(1.5),
183+
},
184+
174185
formSectionInfoDescription: {
175186
fontSize: 14,
176187
color: theme.palette.text.secondary,

site/src/pages/TemplateSettingsPage/TemplateSchedulePage/TemplateScheduleForm.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
464464
<FormSection
465465
title="Failure Cleanup"
466466
description="When enabled, Coder will attempt to stop workspaces that are in a failed state after a specified number of days."
467+
alpha
467468
>
468469
<FormFields>
469470
<FormControlLabel
@@ -492,6 +493,7 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
492493
<FormSection
493494
title="Dormancy Threshold"
494495
description="When enabled, Coder will mark workspaces as dormant after a period of time with no connections. Dormant workspaces can be auto-deleted (see below) or manually reviewed by the workspace owner or admins."
496+
alpha
495497
>
496498
<FormFields>
497499
<FormControlLabel
@@ -524,6 +526,7 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
524526
<FormSection
525527
title="Dormancy Auto-Deletion"
526528
description="When enabled, Coder will permanently delete dormant workspaces after a period of time. Once a workspace is deleted it cannot be recovered."
529+
alpha
527530
>
528531
<FormFields>
529532
<FormControlLabel

0 commit comments

Comments
 (0)