mirror of https://github.com/jetkvm/kvm.git
				
				
				
			fix for initial values being empty
This commit is contained in:
		
							parent
							
								
									af92498816
								
							
						
					
					
						commit
						065f1bd21b
					
				|  | @ -78,15 +78,13 @@ function UpdateUsbConfigModal({ | ||||||
|   onCancel: () => void; |   onCancel: () => void; | ||||||
|   error: string | null; |   error: string | null; | ||||||
| }) { | }) { | ||||||
|   const [usbConfig, setUsbConfig] = useState({ |   const [usbConfigState, setUsbConfigState] = useState<UsbConfigState>({ | ||||||
|     vendor_id: '', |     vendor_id: '', | ||||||
|     product_id: '', |     product_id: '', | ||||||
|     serial_number: '', |     serial_number: '', | ||||||
|     manufacturer: '', |     manufacturer: '', | ||||||
|     product: '', |     product: '' | ||||||
|   }) |   }); | ||||||
| 
 |  | ||||||
|   const [usbConfigState, setUsbConfigState] = useState<UsbConfigState>(); |  | ||||||
|   const [send] = useJsonRpc(); |   const [send] = useJsonRpc(); | ||||||
| 
 | 
 | ||||||
|   const syncUsbConfig = useCallback(() => { |   const syncUsbConfig = useCallback(() => { | ||||||
|  | @ -105,23 +103,23 @@ function UpdateUsbConfigModal({ | ||||||
|   }, [syncUsbConfig]); |   }, [syncUsbConfig]); | ||||||
| 
 | 
 | ||||||
|   const handleUsbVendorIdChange = (value: string) => { |   const handleUsbVendorIdChange = (value: string) => { | ||||||
|     setUsbConfig({... usbConfig, vendor_id: value}) |     setUsbConfigState({... usbConfigState, vendor_id: value}) | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   const handleUsbProductIdChange = (value: string) => { |   const handleUsbProductIdChange = (value: string) => { | ||||||
|     setUsbConfig({... usbConfig, product_id: value}) |     setUsbConfigState({... usbConfigState, product_id: value}) | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   const handleUsbSerialChange = (value: string) => { |   const handleUsbSerialChange = (value: string) => { | ||||||
|     setUsbConfig({... usbConfig, serial_number: value}) |     setUsbConfigState({... usbConfigState, serial_number: value}) | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   const handleUsbManufacturer = (value: string) => { |   const handleUsbManufacturer = (value: string) => { | ||||||
|     setUsbConfig({... usbConfig, manufacturer: value}) |     setUsbConfigState({... usbConfigState, manufacturer: value}) | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   const handleUsbProduct = (value: string) => { |   const handleUsbProduct = (value: string) => { | ||||||
|     setUsbConfig({... usbConfig, product: value}) |     setUsbConfigState({... usbConfigState, product: value}) | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   return ( |   return ( | ||||||
|  | @ -180,7 +178,7 @@ function UpdateUsbConfigModal({ | ||||||
|             size="SM" |             size="SM" | ||||||
|             theme="primary" |             theme="primary" | ||||||
|             text="Update USB Config" |             text="Update USB Config" | ||||||
|             onClick={() => onSetUsbConfig(usbConfig)} |             onClick={() => onSetUsbConfig(usbConfigState)} | ||||||
|           /> |           /> | ||||||
|           <Button size="SM" theme="light" text="Not Now" onClick={onCancel} /> |           <Button size="SM" theme="light" text="Not Now" onClick={onCancel} /> | ||||||
|         </div> |         </div> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue