File tree Expand file tree Collapse file tree 3 files changed +29
-6
lines changed
Expand file tree Collapse file tree 3 files changed +29
-6
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export function FileField<
2525 required = false ,
2626 accept,
2727 description,
28+ disabled,
2829} : {
2930 id : string
3031 name : TName
@@ -34,6 +35,7 @@ export function FileField<
3435 required ?: boolean
3536 accept ?: string
3637 description ?: string | React . ReactNode
38+ disabled ?: boolean
3739} ) {
3840 return (
3941 < Controller
@@ -55,7 +57,14 @@ export function FileField<
5557 < TextInputHint id = { `${ id } -help-text` } > { description } </ TextInputHint >
5658 ) }
5759 </ div >
58- < FileInput id = { id } className = "mt-2" accept = { accept } { ...rest } error = { ! ! error } />
60+ < FileInput
61+ id = { id }
62+ className = "mt-2"
63+ accept = { accept }
64+ disabled = { disabled }
65+ { ...rest }
66+ error = { ! ! error }
67+ />
5968 < ErrorMessage error = { error } label = { label } />
6069 </ div >
6170 ) }
Original file line number Diff line number Diff line change @@ -48,7 +48,13 @@ const CloudInitMessage = () => (
4848 />
4949)
5050
51- export function SshKeysField ( { control } : { control : Control < InstanceCreateInput > } ) {
51+ export function SshKeysField ( {
52+ control,
53+ isSubmitting,
54+ } : {
55+ control : Control < InstanceCreateInput >
56+ isSubmitting : boolean
57+ } ) {
5258 const keys = usePrefetchedApiQuery ( 'currentUserSshKeyList' , { } ) . data ?. items || [ ]
5359 const [ showAddSshKey , setShowAddSshKey ] = useState ( false )
5460
@@ -85,6 +91,7 @@ export function SshKeysField({ control }: { control: Control<InstanceCreateInput
8591 control = { control }
8692 value = { key . id }
8793 key = { key . id }
94+ disabled = { isSubmitting }
8895 >
8996 { key . name }
9097 </ CheckboxField >
@@ -101,12 +108,18 @@ export function SshKeysField({ control }: { control: Control<InstanceCreateInput
101108 onChange = { ( ) =>
102109 onChange ( value . length < keys . length ? keys . map ( ( key ) => key . id ) : [ ] )
103110 }
111+ disabled = { isSubmitting }
104112 >
105113 < span className = "select-none" > Select all</ span >
106114 </ Checkbox >
107115
108116 < div className = "space-x-3" >
109- < Button variant = "ghost" size = "sm" onClick = { ( ) => setShowAddSshKey ( true ) } >
117+ < Button
118+ variant = "ghost"
119+ size = "sm"
120+ onClick = { ( ) => setShowAddSshKey ( true ) }
121+ disabled = { isSubmitting }
122+ >
110123 Add SSH Key
111124 </ Button >
112125 </ div >
Original file line number Diff line number Diff line change @@ -276,13 +276,13 @@ export function CreateInstanceForm() {
276276 </ Tabs . Content >
277277
278278 < Tabs . Content value = "highCPU" >
279- < RadioFieldDyn name = "presetId" label = "" control = { control } >
279+ < RadioFieldDyn name = "presetId" label = "" control = { control } disabled = { isSubmitting } >
280280 { renderLargeRadioCards ( 'highCPU' ) }
281281 </ RadioFieldDyn >
282282 </ Tabs . Content >
283283
284284 < Tabs . Content value = "highMemory" >
285- < RadioFieldDyn name = "presetId" label = "" control = { control } >
285+ < RadioFieldDyn name = "presetId" label = "" control = { control } disabled = { isSubmitting } >
286286 { renderLargeRadioCards ( 'highMemory' ) }
287287 </ RadioFieldDyn >
288288 </ Tabs . Content >
@@ -419,7 +419,7 @@ export function CreateInstanceForm() {
419419 < FormDivider />
420420 < Form . Heading id = "authentication" > Authentication</ Form . Heading >
421421
422- < SshKeysField control = { control } />
422+ < SshKeysField control = { control } isSubmitting = { isSubmitting } />
423423
424424 < FormDivider />
425425 < Form . Heading id = "advanced" > Advanced</ Form . Heading >
@@ -478,6 +478,7 @@ const AdvancedAccordion = ({
478478 name = "userData"
479479 label = "User Data"
480480 control = { control }
481+ disabled = { isSubmitting }
481482 />
482483 </ AccordionItem >
483484 </ Accordion . Root >
You can’t perform that action at this time.
0 commit comments