mirror of https://github.com/jetkvm/kvm.git
Fix ref lint warning
This commit is contained in:
parent
a40c27269a
commit
5613555b39
|
|
@ -352,6 +352,7 @@ function UrlView({
|
||||||
}) {
|
}) {
|
||||||
const [usbMode, setUsbMode] = useState<RemoteVirtualMediaState["mode"]>("CDROM");
|
const [usbMode, setUsbMode] = useState<RemoteVirtualMediaState["mode"]>("CDROM");
|
||||||
const [url, setUrl] = useState<string>("");
|
const [url, setUrl] = useState<string>("");
|
||||||
|
const [isUrlValid, setIsUrlValid] = useState(false);
|
||||||
|
|
||||||
const popularImages = [
|
const popularImages = [
|
||||||
{
|
{
|
||||||
|
|
@ -399,6 +400,12 @@ function UrlView({
|
||||||
|
|
||||||
const urlRef = useRef<HTMLInputElement>(null);
|
const urlRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (urlRef.current) {
|
||||||
|
setIsUrlValid(urlRef.current.validity.valid);
|
||||||
|
}
|
||||||
|
}, [url]);
|
||||||
|
|
||||||
function handleUrlChange(url: string) {
|
function handleUrlChange(url: string) {
|
||||||
setUrl(url);
|
setUrl(url);
|
||||||
if (url.endsWith(".iso")) {
|
if (url.endsWith(".iso")) {
|
||||||
|
|
@ -437,7 +444,7 @@ function UrlView({
|
||||||
animationDelay: "0.1s",
|
animationDelay: "0.1s",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Fieldset disabled={!urlRef.current?.validity.valid || url.length === 0}>
|
<Fieldset disabled={!isUrlValid || url.length === 0}>
|
||||||
<UsbModeSelector usbMode={usbMode} setUsbMode={setUsbMode} />
|
<UsbModeSelector usbMode={usbMode} setUsbMode={setUsbMode} />
|
||||||
</Fieldset>
|
</Fieldset>
|
||||||
<div className="flex space-x-2">
|
<div className="flex space-x-2">
|
||||||
|
|
@ -449,7 +456,7 @@ function UrlView({
|
||||||
text={m.mount_button_mount_url()}
|
text={m.mount_button_mount_url()}
|
||||||
onClick={() => onMount(url, usbMode)}
|
onClick={() => onMount(url, usbMode)}
|
||||||
disabled={
|
disabled={
|
||||||
mountInProgress || !urlRef.current?.validity.valid || url.length === 0
|
mountInProgress || !isUrlValid || url.length === 0
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue