@@ -196,6 +196,15 @@ export default function Page() {
196196}
197197
198198const startingJson = "{\n\n}" ;
199+ const machinePresets = [
200+ "micro" ,
201+ "small-1x" ,
202+ "small-2x" ,
203+ "medium-1x" ,
204+ "medium-2x" ,
205+ "large-1x" ,
206+ "large-2x" ,
207+ ] ;
199208
200209function StandardTaskForm ( {
201210 task,
@@ -247,6 +256,9 @@ function StandardTaskForm({
247256 selectedCodeSample ?. concurrencyKey
248257 ) ;
249258 const [ queueValue , setQueueValue ] = useState < string | undefined > ( selectedCodeSample ?. queue ) ;
259+ const [ machineValue , setMachineValue ] = useState < string | undefined > (
260+ selectedCodeSample ?. machinePreset
261+ ) ;
250262 const [ maxAttemptsValue , setMaxAttemptsValue ] = useState < number | undefined > (
251263 selectedCodeSample ?. maxAttempts
252264 ) ;
@@ -315,6 +327,7 @@ function StandardTaskForm({
315327 triggerSource,
316328 tags,
317329 version,
330+ machine,
318331 } ,
319332 ] = useForm ( {
320333 id : "test-task" ,
@@ -401,6 +414,7 @@ function StandardTaskForm({
401414 setMaxDurationValue ( run . maxDurationInSeconds ) ;
402415 setTagsValue ( run . runTags ?? [ ] ) ;
403416 setQueueValue ( run . queue ) ;
417+ setMachineValue ( run . machinePreset ) ;
404418 } }
405419 className = "flex w-full items-center gap-2 rounded-sm px-2 py-2 outline-none transition-colors focus-custom hover:bg-charcoal-900 "
406420 >
@@ -576,27 +590,6 @@ function StandardTaskForm({
576590 />
577591 < FormError id = { maxDurationSeconds . errorId } > { maxDurationSeconds . error } </ FormError >
578592 </ InputGroup >
579- < InputGroup >
580- < Label htmlFor = { version . id } > Version</ Label >
581- < Select
582- { ...conform . select ( version ) }
583- defaultValue = "latest"
584- variant = "tertiary/small"
585- placeholder = "Select version"
586- dropdownIcon
587- disabled = { disableVersionSelection }
588- >
589- { versions . map ( ( version , i ) => (
590- < SelectItem key = { version } value = { i === 0 ? "latest" : version } >
591- { version } { i === 0 && "(latest)" }
592- </ SelectItem >
593- ) ) }
594- </ Select >
595- { disableVersionSelection && (
596- < Hint > Only the latest version is available in the development environment.</ Hint >
597- ) }
598- < FormError id = { version . errorId } > { version . error } </ FormError >
599- </ InputGroup >
600593 < InputGroup >
601594 < Label htmlFor = { idempotencyKey . id } > Idempotency key</ Label >
602595 < Input { ...conform . input ( idempotencyKey , { type : "text" } ) } variant = "small" />
@@ -631,6 +624,51 @@ function StandardTaskForm({
631624 </ Hint >
632625 < FormError id = { concurrencyKey . errorId } > { concurrencyKey . error } </ FormError >
633626 </ InputGroup >
627+ < InputGroup >
628+ < Label htmlFor = { machine . id } > Machine</ Label >
629+ < Select
630+ { ...conform . select ( machine ) }
631+ variant = "tertiary/small"
632+ placeholder = "Select machine type"
633+ dropdownIcon
634+ items = { machinePresets }
635+ defaultValue = { undefined }
636+ value = { machineValue }
637+ setValue = { ( e ) => {
638+ if ( Array . isArray ( e ) ) return ;
639+ setMachineValue ( e ) ;
640+ } }
641+ >
642+ { machinePresets . map ( ( machine ) => (
643+ < SelectItem key = { machine } value = { machine } >
644+ { machine }
645+ </ SelectItem >
646+ ) ) }
647+ </ Select >
648+ < Hint > This lets you override the machine preset specified in the task.</ Hint >
649+ < FormError id = { machine . errorId } > { machine . error } </ FormError >
650+ </ InputGroup >
651+ < InputGroup >
652+ < Label htmlFor = { version . id } > Version</ Label >
653+ < Select
654+ { ...conform . select ( version ) }
655+ defaultValue = "latest"
656+ variant = "tertiary/small"
657+ placeholder = "Select version"
658+ dropdownIcon
659+ disabled = { disableVersionSelection }
660+ >
661+ { versions . map ( ( version , i ) => (
662+ < SelectItem key = { version } value = { i === 0 ? "latest" : version } >
663+ { version } { i === 0 && "(latest)" }
664+ </ SelectItem >
665+ ) ) }
666+ </ Select >
667+ { disableVersionSelection && (
668+ < Hint > Only the latest version is available in the development environment.</ Hint >
669+ ) }
670+ < FormError id = { version . errorId } > { version . error } </ FormError >
671+ </ InputGroup >
634672 < FormError > { form . error } </ FormError >
635673 </ Fieldset >
636674 </ div >
0 commit comments