Skip to content

Commit f9b00ae

Browse files
committed
chore: remove UI changes
1 parent 24493de commit f9b00ae

File tree

2 files changed

+20
-60
lines changed

2 files changed

+20
-60
lines changed

site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.stories.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -126,31 +126,24 @@ export const PresetsButNoneSelected: Story = {
126126
{
127127
ID: "preset-1",
128128
Name: "Preset 1",
129-
Description: "",
130-
Icon: "",
131129
Default: false,
132130
Parameters: [
133131
{
134132
Name: MockTemplateVersionParameter1.name,
135133
Value: "preset 1 override",
136134
},
137135
],
138-
DesiredPrebuildInstances: null,
139136
},
140137
{
141138
ID: "preset-2",
142139
Name: "Preset 2",
143-
Description:
144-
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse imperdiet ultricies massa, eu dapibus ex fermentum ac.",
145-
Icon: "/emojis/1f60e.png",
146140
Default: false,
147141
Parameters: [
148142
{
149143
Name: MockTemplateVersionParameter2.name,
150144
Value: "42",
151145
},
152146
],
153-
DesiredPrebuildInstances: null,
154147
},
155148
],
156149
parameters: [
@@ -257,31 +250,24 @@ export const PresetsWithDefault: Story = {
257250
{
258251
ID: "preset-1",
259252
Name: "Preset 1",
260-
Icon: "",
261-
Description: "",
262253
Default: false,
263254
Parameters: [
264255
{
265256
Name: MockTemplateVersionParameter1.name,
266257
Value: "preset 1 override",
267258
},
268259
],
269-
DesiredPrebuildInstances: null,
270260
},
271261
{
272262
ID: "preset-2",
273263
Name: "Preset 2",
274-
Icon: "/emojis/1f60e.png",
275-
Description:
276-
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse imperdiet ultricies massa, eu dapibus ex fermentum ac.",
277264
Default: true,
278265
Parameters: [
279266
{
280267
Name: MockTemplateVersionParameter2.name,
281268
Value: "150189",
282269
},
283270
],
284-
DesiredPrebuildInstances: null,
285271
},
286272
],
287273
parameters: [

site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx

Lines changed: 20 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import { Alert } from "components/Alert/Alert";
66
import { ErrorAlert } from "components/Alert/ErrorAlert";
77
import { Avatar } from "components/Avatar/Avatar";
88
import { Button } from "components/Button/Button";
9+
import { SelectFilter } from "components/Filter/SelectFilter";
910
import {
1011
FormFields,
1112
FormFooter,
1213
FormSection,
1314
HorizontalForm,
1415
} from "components/Form/Form";
1516
import { Margins } from "components/Margins/Margins";
16-
import { MultiSelectCombobox } from "components/MultiSelectCombobox/MultiSelectCombobox";
1717
import {
1818
PageHeader,
1919
PageHeaderSubtitle,
@@ -159,12 +159,10 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
159159
// Build options and keep default label/value in sync
160160
useEffect(() => {
161161
const options = [
162-
{ label: "None", value: "", icon: undefined, description: undefined },
163-
...presets.map((preset) => ({
164-
label: preset.Default ? `${preset.Name} (Default)` : preset.Name,
165-
value: preset.ID,
166-
icon: preset.Icon,
167-
description: preset.Description,
162+
{ label: "None", value: "" },
163+
...presets.map((p) => ({
164+
label: p.Default ? `${p.Name} (Default)` : p.Name,
165+
value: p.ID,
168166
})),
169167
];
170168
setPresetOptions(options);
@@ -382,49 +380,25 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
382380
</Stack>
383381
<Stack direction="column" spacing={2}>
384382
<Stack direction="row" spacing={2}>
385-
<MultiSelectCombobox
386-
inputProps={{ id: "preset-select" }}
383+
<SelectFilter
384+
label="Preset"
387385
options={presetOptions}
388-
defaultOptions={presetOptions}
389-
value={
390-
presetOptions[selectedPresetIndex]
391-
? [presetOptions[selectedPresetIndex]]
392-
: []
393-
}
394-
onChange={(option) => {
395-
// Handle single selection replacement
396-
if (option.length > 0) {
397-
// Take the most recently selected option
398-
const selectedOption = option[option.length - 1];
399-
const index = presetOptions.findIndex(
400-
(preset) => preset.value === selectedOption.value,
401-
);
402-
if (index !== -1) {
403-
setSelectedPresetIndex(index);
404-
form.setFieldValue(
405-
"template_version_preset_id",
406-
selectedOption.value === ""
407-
? undefined
408-
: selectedOption.value,
409-
);
410-
}
411-
} else {
412-
// None preset selected
413-
setSelectedPresetIndex(0);
414-
form.setFieldValue(
415-
"template_version_preset_id",
416-
undefined,
417-
);
386+
onSelect={(option) => {
387+
const index = presetOptions.findIndex(
388+
(preset) => preset.value === option?.value,
389+
);
390+
if (index === -1) {
391+
return;
418392
}
393+
setSelectedPresetIndex(index);
394+
form.setFieldValue(
395+
"template_version_preset_id",
396+
// Empty string is equivalent to using None
397+
option?.value === "" ? undefined : option?.value,
398+
);
419399
}}
420-
hidePlaceholderWhenSelected
421400
placeholder="Select a preset"
422-
emptyIndicator={
423-
<p className="text-center text-md text-content-primary">
424-
No presets found
425-
</p>
426-
}
427-
disabled={false}
401+
selectedOption={presetOptions[selectedPresetIndex]}
428402
/>
429403
</Stack>
430404
{/* Only show the preset parameter visibility toggle if preset parameters are actually being modified, otherwise it has no effect. */}

0 commit comments

Comments
 (0)