Skip to content

chore: add alpha badges to workspace cleanup fields #9802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions site/src/components/DeploySettingsLayout/Badges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
const styles = useStyles();
return (
Expand Down Expand Up @@ -123,6 +132,11 @@ const useStyles = makeStyles((theme) => ({
border: `1px solid ${theme.palette.info.light}`,
},

alphaBadge: {
border: `1px solid ${theme.palette.error.light}`,
backgroundColor: theme.palette.error.dark,
},

versionBadge: {
border: `1px solid ${theme.palette.success.light}`,
backgroundColor: theme.palette.success.dark,
Expand Down
13 changes: 12 additions & 1 deletion site/src/components/Form/Form.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { makeStyles } from "@mui/styles";
import { AlphaBadge } from "components/DeploySettingsLayout/Badges";
import {
FormFooterProps as BaseFormFooterProps,
FormFooter as BaseFormFooter,
Expand Down Expand Up @@ -67,8 +68,9 @@ export const FormSection: FC<
sectionInfo?: string;
infoTitle?: string;
};
alpha?: boolean;
}
> = ({ children, title, description, classes = {} }) => {
> = ({ children, title, description, classes = {}, alpha = false }) => {
const formContext = useContext(FormContext);
const styles = useStyles(formContext);

Expand All @@ -83,10 +85,12 @@ export const FormSection: FC<
<h2
className={combineClasses([
styles.formSectionInfoTitle,
alpha && styles.formSectionInfoTitleAlpha,
classes.infoTitle,
])}
>
{title}
{alpha && <AlphaBadge />}
</h2>
<div className={styles.formSectionInfoDescription}>{description}</div>
</div>
Expand Down Expand Up @@ -171,6 +175,13 @@ const useStyles = makeStyles((theme) => ({
marginBottom: theme.spacing(1),
},

formSectionInfoTitleAlpha: {
display: "flex",
flexDirection: "row",
alignItems: "center",
gap: theme.spacing(1.5),
},

formSectionInfoDescription: {
fontSize: 14,
color: theme.palette.text.secondary,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
<FormSection
title="Failure Cleanup"
description="When enabled, Coder will attempt to stop workspaces that are in a failed state after a specified number of days."
alpha
>
<FormFields>
<FormControlLabel
Expand Down Expand Up @@ -492,6 +493,7 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
<FormSection
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."
alpha
>
<FormFields>
<FormControlLabel
Expand Down Expand Up @@ -524,6 +526,7 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
<FormSection
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."
alpha
>
<FormFields>
<FormControlLabel
Expand Down