Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions site/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,7 @@ export interface DeploymentOption {
readonly value: unknown;
readonly hidden: boolean;
readonly group?: DeploymentGroup;
readonly env?: string;
}

export type DeploymentConfig = {
Expand Down
40 changes: 40 additions & 0 deletions site/src/components/DeploySettingsLayout/Option.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { makeStyles } from "@mui/styles";
import { PropsWithChildren, FC } from "react";
import { MONOSPACE_FONT_FAMILY } from "theme/constants";
import { DisabledBadge, EnabledBadge } from "./Badges";
import Box, { BoxProps } from "@mui/material/Box";

export const OptionName: FC<PropsWithChildren> = ({ children }) => {
const styles = useStyles();
Expand Down Expand Up @@ -57,6 +58,45 @@ export const OptionValue: FC<{ children?: unknown }> = ({ children }) => {
return <span className={styles.optionValue}>{JSON.stringify(children)}</span>;
};

export const OptionConfig = (props: BoxProps) => {
return (
<Box
{...props}
sx={{
fontSize: 13,
fontFamily: MONOSPACE_FONT_FAMILY,
fontWeight: 600,
backgroundColor: (theme) => theme.palette.background.paperLight,
display: "inline-flex",
alignItems: "center",
borderRadius: 0.25,
padding: (theme) => theme.spacing(0, 1),
border: (theme) => `1px solid ${theme.palette.divider}`,
...props.sx,
}}
/>
);
};

export const OptionConfigFlag = (props: BoxProps) => {
return (
<Box
{...props}
sx={{
fontSize: 10,
fontWeight: 600,
margin: (theme) => theme.spacing(0, 0.75, 0, -0.5),
display: "block",
backgroundColor: (theme) => theme.palette.divider,
lineHeight: 1,
padding: (theme) => theme.spacing(0.25, 0.5),
borderRadius: 0.25,
...props.sx,
}}
/>
);
};

const useStyles = makeStyles((theme) => ({
optionName: {
display: "block",
Expand Down
26 changes: 26 additions & 0 deletions site/src/components/DeploySettingsLayout/OptionsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ import TableContainer from "@mui/material/TableContainer";
import TableHead from "@mui/material/TableHead";
import TableRow from "@mui/material/TableRow";
import {
OptionConfig,
OptionConfigFlag,
OptionDescription,
OptionName,
OptionValue,
} from "components/DeploySettingsLayout/Option";
import { FC } from "react";
import { optionValue } from "./optionValue";
import { DeploymentOption } from "api/api";
import Box from "@mui/material/Box";

const OptionsTable: FC<{
options: DeploymentOption[];
Expand Down Expand Up @@ -46,6 +49,29 @@ const OptionsTable: FC<{
<TableCell>
<OptionName>{option.name}</OptionName>
<OptionDescription>{option.description}</OptionDescription>
<Box
sx={{
marginTop: 3,
display: "flex",
flexWrap: "wrap",
gap: 1,
}}
>
<OptionConfig>
<OptionConfigFlag>CLI</OptionConfigFlag>
--{option.flag}
</OptionConfig>
{option.flag_shorthand && (
<OptionConfig>
<OptionConfigFlag>CLI</OptionConfigFlag>
--{option.flag_shorthand}
</OptionConfig>
)}
<OptionConfig>
<OptionConfigFlag>ENV</OptionConfigFlag>
{option.env}
</OptionConfig>
</Box>
</TableCell>

<TableCell>
Expand Down