Skip to content

Commit e1a8997

Browse files
committed
Color the value source for a deployment value
1 parent 07588ec commit e1a8997

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

site/src/components/DeploySettingsLayout/Option.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,27 @@ export const OptionValue: FC<{ children?: unknown }> = ({ children }) => {
5858
return <span className={styles.optionValue}>{JSON.stringify(children)}</span>;
5959
};
6060

61-
export const OptionConfig = (props: BoxProps) => {
61+
// OptionalConfig takes a source bool to indicate if the Option is the source of the configured value.
62+
export const OptionConfig = ({
63+
source,
64+
...boxProps
65+
}: { source?: boolean } & BoxProps) => {
6266
return (
6367
<Box
64-
{...props}
68+
{...boxProps}
6569
sx={{
6670
fontSize: 13,
6771
fontFamily: MONOSPACE_FONT_FAMILY,
6872
fontWeight: 600,
69-
backgroundColor: (theme) => theme.palette.background.paperLight,
73+
backgroundColor: (theme) =>
74+
source ? "green" : theme.palette.background.paperLight,
7075
display: "inline-flex",
7176
alignItems: "center",
7277
borderRadius: 0.25,
7378
padding: (theme) => theme.spacing(0, 1),
74-
border: (theme) => `1px solid ${theme.palette.divider}`,
75-
...props.sx,
79+
border: (theme) =>
80+
`1px solid ${source ? "lightgreen" : theme.palette.divider}`,
81+
...boxProps.sx,
7682
}}
7783
/>
7884
);

site/src/components/DeploySettingsLayout/OptionsTable.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,25 @@ const OptionsTable: FC<{
5858
}}
5959
>
6060
{option.flag && (
61-
<OptionConfig>
61+
<OptionConfig source={option.value_source === "flag"}>
6262
<OptionConfigFlag>CLI</OptionConfigFlag>
6363
--{option.flag}
6464
</OptionConfig>
6565
)}
6666
{option.flag_shorthand && (
67-
<OptionConfig>
67+
<OptionConfig source={option.value_source === "flag"}>
6868
<OptionConfigFlag>CLI</OptionConfigFlag>-
6969
{option.flag_shorthand}
7070
</OptionConfig>
7171
)}
7272
{option.env && (
73-
<OptionConfig>
73+
<OptionConfig source={option.value_source === "env"}>
7474
<OptionConfigFlag>ENV</OptionConfigFlag>
7575
{option.env}
7676
</OptionConfig>
7777
)}
7878
{option.yaml && (
79-
<OptionConfig>
79+
<OptionConfig source={option.value_source === "yaml"}>
8080
<OptionConfigFlag>YAML</OptionConfigFlag>
8181
{option.yaml}
8282
</OptionConfig>

0 commit comments

Comments
 (0)