Skip to content

feat: add the ability to hide preset parameters #17168

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 9 commits into from
Apr 1, 2025
Prev Previous commit
Next Next commit
Move presets to the parameter section
  • Loading branch information
SasSwart committed Mar 31, 2025
commit d6000e43bdd7c50ca3da8676dbc1465b21ffe981
93 changes: 49 additions & 44 deletions site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,50 +276,6 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
</Stack>
)}

{presets.length > 0 && (
<Stack direction="column" spacing={2}>
<Stack direction="row" spacing={2} alignItems="center">
<span css={styles.description}>
Select a preset to get started
</span>
<FeatureStageBadge contentType={"beta"} size="md" />
</Stack>
<Stack direction="column" spacing={2}>
<Stack direction="row" spacing={2}>
<SelectFilter
label="Preset"
options={presetOptions}
onSelect={(option) => {
const index = presetOptions.findIndex(
(preset) => preset.value === option?.value,
);
if (index === -1) {
return;
}
setSelectedPresetIndex(index);
}}
placeholder="Select a preset"
selectedOption={presetOptions[selectedPresetIndex]}
/>
</Stack>
<div
css={{ display: "flex", alignItems: "center", gap: "8px" }}
>
<Switch
id="show-preset-parameters"
checked={showPresetParameters}
onCheckedChange={setShowPresetParameters}
/>
<label
htmlFor="show-preset-parameters"
css={styles.description}
>
Show preset parameters
</label>
</div>
</Stack>
</Stack>
)}
<div>
<TextField
{...getFieldHelpers("name")}
Expand Down Expand Up @@ -393,6 +349,55 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
hence they require additional vertical spacing for better readability and
user experience. */}
<FormFields css={{ gap: 36 }}>
{presets.length > 0 && (
<Stack direction="column" spacing={2}>
<Stack direction="row" spacing={2} alignItems="center">
<span css={styles.description}>
Select a preset to get started
</span>
<FeatureStageBadge contentType={"beta"} size="md" />
</Stack>
<Stack direction="column" spacing={2}>
<Stack direction="row" spacing={2}>
<SelectFilter
label="Preset"
options={presetOptions}
onSelect={(option) => {
const index = presetOptions.findIndex(
(preset) => preset.value === option?.value,
);
if (index === -1) {
return;
}
setSelectedPresetIndex(index);
}}
placeholder="Select a preset"
selectedOption={presetOptions[selectedPresetIndex]}
/>
</Stack>
<div
css={{
display: "flex",
alignItems: "center",
gap: "8px",
}}
>
<Switch
id="show-preset-parameters"
checked={showPresetParameters}
onCheckedChange={setShowPresetParameters}
/>
<label
htmlFor="show-preset-parameters"
css={styles.description}
>
Show preset parameters
</label>
</div>
</Stack>
</Stack>
)}

{parameters.map((parameter, index) => {
const parameterField = `rich_parameter_values.${index}`;
const parameterInputName = `${parameterField}.value`;
Expand Down
Loading