|
|
@ -1,5 +1,6 @@ |
|
|
|
import { |
|
|
|
import { |
|
|
|
Close as CloseIcon, |
|
|
|
Close as CloseIcon, |
|
|
|
|
|
|
|
Dashboard as DashboardIcon, |
|
|
|
Keyboard as KeyboardIcon, |
|
|
|
Keyboard as KeyboardIcon, |
|
|
|
} from '@mui/icons-material'; |
|
|
|
} from '@mui/icons-material'; |
|
|
|
import { Box, Menu, styled, Typography } from '@mui/material'; |
|
|
|
import { Box, Menu, styled, Typography } from '@mui/material'; |
|
|
@ -100,17 +101,18 @@ const FullSize: FC<FullSizeProps> = ({ |
|
|
|
}, [serverUUID]); |
|
|
|
}, [serverUUID]); |
|
|
|
|
|
|
|
|
|
|
|
const disconnectServerVnc = useCallback(() => { |
|
|
|
const disconnectServerVnc = useCallback(() => { |
|
|
|
|
|
|
|
if (rfb?.current) { |
|
|
|
|
|
|
|
rfb.current.disconnect(); |
|
|
|
|
|
|
|
rfb.current = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setRfbConnectArgs(undefined); |
|
|
|
setRfbConnectArgs(undefined); |
|
|
|
}, []); |
|
|
|
}, []); |
|
|
|
|
|
|
|
|
|
|
|
const reconnectServerVnc = useCallback(() => { |
|
|
|
const reconnectServerVnc = useCallback(() => { |
|
|
|
if (!rfb?.current) return; |
|
|
|
disconnectServerVnc(); |
|
|
|
|
|
|
|
|
|
|
|
rfb.current.disconnect(); |
|
|
|
|
|
|
|
rfb.current = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connectServerVnc(); |
|
|
|
connectServerVnc(); |
|
|
|
}, [connectServerVnc]); |
|
|
|
}, [connectServerVnc, disconnectServerVnc]); |
|
|
|
|
|
|
|
|
|
|
|
const updateVncReconnectTimer = useCallback((): void => { |
|
|
|
const updateVncReconnectTimer = useCallback((): void => { |
|
|
|
const intervalId = setInterval((): void => { |
|
|
|
const intervalId = setInterval((): void => { |
|
|
@ -188,15 +190,33 @@ const FullSize: FC<FullSizeProps> = ({ |
|
|
|
[disconnectServerVnc, onClickCloseButton], |
|
|
|
[disconnectServerVnc, onClickCloseButton], |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const returnHomeElement = useMemo( |
|
|
|
|
|
|
|
() => ( |
|
|
|
|
|
|
|
<IconButton |
|
|
|
|
|
|
|
onClick={() => { |
|
|
|
|
|
|
|
if (!window) return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
disconnectServerVnc(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window.location.assign('/'); |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<DashboardIcon /> |
|
|
|
|
|
|
|
</IconButton> |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
[disconnectServerVnc], |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const vncToolbarElement = useMemo( |
|
|
|
const vncToolbarElement = useMemo( |
|
|
|
() => |
|
|
|
() => |
|
|
|
showScreen && ( |
|
|
|
showScreen && ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
{keyboardMenuElement} |
|
|
|
{keyboardMenuElement} |
|
|
|
|
|
|
|
{returnHomeElement} |
|
|
|
{vncDisconnectElement} |
|
|
|
{vncDisconnectElement} |
|
|
|
</> |
|
|
|
</> |
|
|
|
), |
|
|
|
), |
|
|
|
[keyboardMenuElement, showScreen, vncDisconnectElement], |
|
|
|
[keyboardMenuElement, returnHomeElement, showScreen, vncDisconnectElement], |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|