WIP update
This commit is contained in:
@ -16,7 +16,7 @@ import {
|
||||
TableRow,
|
||||
Typography,
|
||||
} from "@mui/material";
|
||||
import Grid from "@mui/material/Grid2";
|
||||
import Grid from "@mui/material/Grid";
|
||||
import { PieChart } from "@mui/x-charts";
|
||||
import { filesize } from "filesize";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
|
@ -1,17 +1,16 @@
|
||||
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
|
||||
import FullscreenIcon from "@mui/icons-material/Fullscreen";
|
||||
import FullscreenExitIcon from "@mui/icons-material/FullscreenExit";
|
||||
import KeyboardAltIcon from "@mui/icons-material/KeyboardAlt";
|
||||
import { IconButton, Tooltip } from "@mui/material";
|
||||
import React, { useEffect } from "react";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { VncScreen } from "react-vnc";
|
||||
import { VncScreen, VncScreenHandle } from "react-vnc";
|
||||
import { ServerApi } from "../api/ServerApi";
|
||||
import { VMApi, VMInfo } from "../api/VMApi";
|
||||
import { useSnackbar } from "../hooks/providers/SnackbarProvider";
|
||||
import { time } from "../utils/DateUtils";
|
||||
import { AsyncWidget } from "../widgets/AsyncWidget";
|
||||
import RFB from "react-vnc/dist/types/noVNC/core/rfb";
|
||||
import KeyboardAltIcon from "@mui/icons-material/KeyboardAlt";
|
||||
|
||||
interface VNCTokenInfo {
|
||||
url: string;
|
||||
@ -43,9 +42,10 @@ function VNCInner(p: { vm: VMInfo }): React.ReactElement {
|
||||
|
||||
const [token, setToken] = React.useState<VNCTokenInfo | undefined>();
|
||||
const [counter, setCounter] = React.useState(1);
|
||||
const [rfb, setRFB] = React.useState<RFB | undefined>();
|
||||
const [connected, setConnected] = React.useState(false);
|
||||
|
||||
const vncRef = React.createRef<HTMLDivElement>();
|
||||
const vncScreenRef = React.createRef<VncScreenHandle>();
|
||||
|
||||
const connect = async (force: boolean) => {
|
||||
try {
|
||||
@ -71,7 +71,7 @@ function VNCInner(p: { vm: VMInfo }): React.ReactElement {
|
||||
};
|
||||
|
||||
const disconnected = () => {
|
||||
setRFB(undefined);
|
||||
setConnected(false);
|
||||
connect(true);
|
||||
};
|
||||
|
||||
@ -118,9 +118,9 @@ function VNCInner(p: { vm: VMInfo }): React.ReactElement {
|
||||
)}
|
||||
|
||||
{/* Keystrokes */}
|
||||
{rfb && (
|
||||
{connected && (
|
||||
<Tooltip title="Send Ctrl+Alt+Del">
|
||||
<IconButton onClick={() => rfb?.sendCtrlAltDel()}>
|
||||
<IconButton onClick={() => vncScreenRef.current?.sendCtrlAltDel()}>
|
||||
<KeyboardAltIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
@ -137,12 +137,13 @@ function VNCInner(p: { vm: VMInfo }): React.ReactElement {
|
||||
}}
|
||||
>
|
||||
<VncScreen
|
||||
ref={vncScreenRef}
|
||||
url={token.url}
|
||||
onDisconnect={() => {
|
||||
console.info("VNC disconnected " + token?.url);
|
||||
disconnected();
|
||||
}}
|
||||
onConnect={(rfb) => setRFB(rfb)}
|
||||
onConnect={() => setConnected(true)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Visibility, VisibilityOff } from "@mui/icons-material";
|
||||
import VisibilityIcon from '@mui/icons-material/Visibility';
|
||||
import VisibilityOffIcon from '@mui/icons-material/VisibilityOff';
|
||||
import {
|
||||
Alert,
|
||||
CircularProgress,
|
||||
@ -130,7 +131,7 @@ export function LoginRoute(): React.ReactElement {
|
||||
onMouseDown={handleMouseDownPassword}
|
||||
edge="end"
|
||||
>
|
||||
{showPassword ? <VisibilityOff /> : <Visibility />}
|
||||
{showPassword ? <VisibilityOffIcon /> : <VisibilityIcon />}
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</InputAdornment>
|
||||
|
Reference in New Issue
Block a user