chore: add alpha badges to workspace cleanup fields (#9802)

This commit is contained in:
Jon Ayers
2023-09-22 10:41:17 -05:00
committed by GitHub
parent 8d8402da00
commit 9216725698
3 changed files with 29 additions and 1 deletions
@@ -85,6 +85,15 @@ export const EnterpriseBadge: FC = () => {
); );
}; };
export const AlphaBadge: FC = () => {
const styles = useStyles();
return (
<span className={combineClasses([styles.badge, styles.alphaBadge])}>
Alpha
</span>
);
};
export const Badges: FC<PropsWithChildren> = ({ children }) => { export const Badges: FC<PropsWithChildren> = ({ children }) => {
const styles = useStyles(); const styles = useStyles();
return ( return (
@@ -123,6 +132,11 @@ const useStyles = makeStyles((theme) => ({
border: `1px solid ${theme.palette.info.light}`, border: `1px solid ${theme.palette.info.light}`,
}, },
alphaBadge: {
border: `1px solid ${theme.palette.error.light}`,
backgroundColor: theme.palette.error.dark,
},
versionBadge: { versionBadge: {
border: `1px solid ${theme.palette.success.light}`, border: `1px solid ${theme.palette.success.light}`,
backgroundColor: theme.palette.success.dark, backgroundColor: theme.palette.success.dark,
+12 -1
View File
@@ -1,4 +1,5 @@
import { makeStyles } from "@mui/styles"; import { makeStyles } from "@mui/styles";
import { AlphaBadge } from "components/DeploySettingsLayout/Badges";
import { import {
FormFooterProps as BaseFormFooterProps, FormFooterProps as BaseFormFooterProps,
FormFooter as BaseFormFooter, FormFooter as BaseFormFooter,
@@ -67,8 +68,9 @@ export const FormSection: FC<
sectionInfo?: string; sectionInfo?: string;
infoTitle?: string; infoTitle?: string;
}; };
alpha?: boolean;
} }
> = ({ children, title, description, classes = {} }) => { > = ({ children, title, description, classes = {}, alpha = false }) => {
const formContext = useContext(FormContext); const formContext = useContext(FormContext);
const styles = useStyles(formContext); const styles = useStyles(formContext);
@@ -83,10 +85,12 @@ export const FormSection: FC<
<h2 <h2
className={combineClasses([ className={combineClasses([
styles.formSectionInfoTitle, styles.formSectionInfoTitle,
alpha && styles.formSectionInfoTitleAlpha,
classes.infoTitle, classes.infoTitle,
])} ])}
> >
{title} {title}
{alpha && <AlphaBadge />}
</h2> </h2>
<div className={styles.formSectionInfoDescription}>{description}</div> <div className={styles.formSectionInfoDescription}>{description}</div>
</div> </div>
@@ -171,6 +175,13 @@ const useStyles = makeStyles((theme) => ({
marginBottom: theme.spacing(1), marginBottom: theme.spacing(1),
}, },
formSectionInfoTitleAlpha: {
display: "flex",
flexDirection: "row",
alignItems: "center",
gap: theme.spacing(1.5),
},
formSectionInfoDescription: { formSectionInfoDescription: {
fontSize: 14, fontSize: 14,
color: theme.palette.text.secondary, color: theme.palette.text.secondary,
@@ -464,6 +464,7 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
<FormSection <FormSection
title="Failure Cleanup" title="Failure Cleanup"
description="When enabled, Coder will attempt to stop workspaces that are in a failed state after a specified number of days." description="When enabled, Coder will attempt to stop workspaces that are in a failed state after a specified number of days."
alpha
> >
<FormFields> <FormFields>
<FormControlLabel <FormControlLabel
@@ -492,6 +493,7 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
<FormSection <FormSection
title="Dormancy Threshold" title="Dormancy Threshold"
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." 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."
alpha
> >
<FormFields> <FormFields>
<FormControlLabel <FormControlLabel
@@ -524,6 +526,7 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
<FormSection <FormSection
title="Dormancy Auto-Deletion" title="Dormancy Auto-Deletion"
description="When enabled, Coder will permanently delete dormant workspaces after a period of time. Once a workspace is deleted it cannot be recovered." description="When enabled, Coder will permanently delete dormant workspaces after a period of time. Once a workspace is deleted it cannot be recovered."
alpha
> >
<FormFields> <FormFields>
<FormControlLabel <FormControlLabel