@@ -45,6 +45,7 @@ import * as Yup from "yup";
45
45
import type { CreateWorkspaceMode } from "./CreateWorkspacePage" ;
46
46
import { ExternalAuthButton } from "./ExternalAuthButton" ;
47
47
import type { CreateWorkspacePermissions } from "./permissions" ;
48
+ import { Combobox } from "../../components/Combobox/Combobox" ;
48
49
49
50
export const Language = {
50
51
duplicationWarning :
@@ -153,16 +154,18 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
153
154
) ;
154
155
155
156
const [ presetOptions , setPresetOptions ] = useState ( [
156
- { label : "None" , value : "" } ,
157
+ { displayName : "None" , value : "" , icon : "" , description : "" } ,
157
158
] ) ;
158
159
const [ selectedPresetIndex , setSelectedPresetIndex ] = useState ( 0 ) ;
159
160
// Build options and keep default label/value in sync
160
161
useEffect ( ( ) => {
161
162
const options = [
162
- { label : "None" , value : "" } ,
163
- ...presets . map ( ( p ) => ( {
164
- label : p . Default ? `${ p . Name } (Default)` : p . Name ,
165
- value : p . ID ,
163
+ { displayName : "None" , value : "" , icon : "" , description : "" } ,
164
+ ...presets . map ( ( preset ) => ( {
165
+ displayName : preset . Default ? `${ preset . Name } (Default)` : preset . Name ,
166
+ value : preset . ID ,
167
+ icon : preset . Icon ,
168
+ description : preset . Description ,
166
169
} ) ) ,
167
170
] ;
168
171
setPresetOptions ( options ) ;
@@ -380,25 +383,23 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
380
383
</ Stack >
381
384
< Stack direction = "column" spacing = { 2 } >
382
385
< Stack direction = "row" spacing = { 2 } >
383
- < SelectFilter
384
- label = "Preset"
386
+ < Combobox
387
+ value = { presetOptions [ selectedPresetIndex ] ?. displayName || "" }
385
388
options = { presetOptions }
386
- onSelect = { ( option ) => {
389
+ placeholder = "Select a preset"
390
+ onSelect = { ( value ) => {
387
391
const index = presetOptions . findIndex (
388
- ( preset ) => preset . value === option ?. value ,
392
+ ( preset ) => preset . value === value ,
389
393
) ;
390
394
if ( index === - 1 ) {
391
395
return ;
392
396
}
393
397
setSelectedPresetIndex ( index ) ;
394
398
form . setFieldValue (
395
399
"template_version_preset_id" ,
396
- // Empty string is equivalent to using None
397
- option ?. value === "" ? undefined : option ?. value ,
400
+ presetOptions [ index ] . value === "" ? undefined : presetOptions [ index ] . value ,
398
401
) ;
399
402
} }
400
- placeholder = "Select a preset"
401
- selectedOption = { presetOptions [ selectedPresetIndex ] }
402
403
/>
403
404
</ Stack >
404
405
{ /* Only show the preset parameter visibility toggle if preset parameters are actually being modified, otherwise it has no effect. */ }
0 commit comments