|
|
@ -5,7 +5,7 @@ import { makeStyles } from '@material-ui/core/styles'; |
|
|
|
import CloseIcon from '@material-ui/icons/Close'; |
|
|
|
import CloseIcon from '@material-ui/icons/Close'; |
|
|
|
import KeyboardIcon from '@material-ui/icons/Keyboard'; |
|
|
|
import KeyboardIcon from '@material-ui/icons/Keyboard'; |
|
|
|
import IconButton from '@material-ui/core/IconButton'; |
|
|
|
import IconButton from '@material-ui/core/IconButton'; |
|
|
|
import RFB from './noVNC/core/rfb'; |
|
|
|
import RFB from '@novnc/novnc/core/rfb'; |
|
|
|
import { Panel } from '../Panels'; |
|
|
|
import { Panel } from '../Panels'; |
|
|
|
import { BLACK, RED, TEXT } from '../../lib/consts/DEFAULT_THEME'; |
|
|
|
import { BLACK, RED, TEXT } from '../../lib/consts/DEFAULT_THEME'; |
|
|
|
import keyCombinations from './keyCombinations'; |
|
|
|
import keyCombinations from './keyCombinations'; |
|
|
@ -18,6 +18,8 @@ const VncDisplay = dynamic(() => import('./VncDisplay'), { ssr: false }); |
|
|
|
|
|
|
|
|
|
|
|
const useStyles = makeStyles(() => ({ |
|
|
|
const useStyles = makeStyles(() => ({ |
|
|
|
displayBox: { |
|
|
|
displayBox: { |
|
|
|
|
|
|
|
width: '75vw', |
|
|
|
|
|
|
|
height: '75vh', |
|
|
|
paddingTop: '1em', |
|
|
|
paddingTop: '1em', |
|
|
|
paddingBottom: 0, |
|
|
|
paddingBottom: 0, |
|
|
|
paddingLeft: 0, |
|
|
|
paddingLeft: 0, |
|
|
@ -77,16 +79,12 @@ interface VncConnectionProps { |
|
|
|
|
|
|
|
|
|
|
|
const FullSize = ({ setMode, uuid, serverName }: PreviewProps): JSX.Element => { |
|
|
|
const FullSize = ({ setMode, uuid, serverName }: PreviewProps): JSX.Element => { |
|
|
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null); |
|
|
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null); |
|
|
|
const rfb = useRef<RFB>(); |
|
|
|
const rfb = useRef<typeof RFB>(); |
|
|
|
const hostname = useRef<string | undefined>(undefined); |
|
|
|
const hostname = useRef<string | undefined>(undefined); |
|
|
|
const [vncConnection, setVncConnection] = useState< |
|
|
|
const [vncConnection, setVncConnection] = useState< |
|
|
|
VncConnectionProps | undefined |
|
|
|
VncConnectionProps | undefined |
|
|
|
>(undefined); |
|
|
|
>(undefined); |
|
|
|
const [isError, setIsError] = useState<boolean>(false); |
|
|
|
const [isError, setIsError] = useState<boolean>(false); |
|
|
|
const [displaySize] = useState<{ |
|
|
|
|
|
|
|
width: string; |
|
|
|
|
|
|
|
height: string; |
|
|
|
|
|
|
|
}>({ width: '100%', height: '75vh' }); |
|
|
|
|
|
|
|
const classes = useStyles(); |
|
|
|
const classes = useStyles(); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
@ -146,14 +144,11 @@ const FullSize = ({ setMode, uuid, serverName }: PreviewProps): JSX.Element => { |
|
|
|
<Box flexGrow={1}> |
|
|
|
<Box flexGrow={1}> |
|
|
|
<HeaderText text={`Server: ${serverName}`} /> |
|
|
|
<HeaderText text={`Server: ${serverName}`} /> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
|
|
|
|
|
|
|
|
<Box display="flex" className={classes.displayBox}> |
|
|
|
|
|
|
|
{vncConnection ? ( |
|
|
|
{vncConnection ? ( |
|
|
|
<> |
|
|
|
<Box display="flex" className={classes.displayBox}> |
|
|
|
<VncDisplay |
|
|
|
<VncDisplay |
|
|
|
rfb={rfb} |
|
|
|
rfb={rfb} |
|
|
|
url={`${vncConnection.protocol}://${hostname.current}:${vncConnection.forward_port}`} |
|
|
|
url={`${vncConnection.protocol}://${hostname.current}:${vncConnection.forward_port}`} |
|
|
|
style={displaySize} |
|
|
|
|
|
|
|
viewOnly={false} |
|
|
|
viewOnly={false} |
|
|
|
focusOnClick={false} |
|
|
|
focusOnClick={false} |
|
|
|
clipViewport={false} |
|
|
|
clipViewport={false} |
|
|
@ -208,14 +203,12 @@ const FullSize = ({ setMode, uuid, serverName }: PreviewProps): JSX.Element => { |
|
|
|
</Menu> |
|
|
|
</Menu> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
</> |
|
|
|
</Box> |
|
|
|
) : ( |
|
|
|
) : ( |
|
|
|
<Box display="flex" className={classes.spinnerBox}> |
|
|
|
<Box display="flex" className={classes.spinnerBox}> |
|
|
|
{!isError ? ( |
|
|
|
{!isError ? ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
<HeaderText |
|
|
|
<HeaderText text={`Establishing connection with ${serverName}`} /> |
|
|
|
text={`Establishing connection with ${serverName}`} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<HeaderText text="This may take a few minutes" /> |
|
|
|
<HeaderText text="This may take a few minutes" /> |
|
|
|
<Spinner /> |
|
|
|
<Spinner /> |
|
|
|
</> |
|
|
|
</> |
|
|
@ -231,10 +224,7 @@ const FullSize = ({ setMode, uuid, serverName }: PreviewProps): JSX.Element => { |
|
|
|
}} |
|
|
|
}} |
|
|
|
style={{ textTransform: 'none' }} |
|
|
|
style={{ textTransform: 'none' }} |
|
|
|
> |
|
|
|
> |
|
|
|
<Typography |
|
|
|
<Typography className={classes.buttonText} variant="subtitle1"> |
|
|
|
className={classes.buttonText} |
|
|
|
|
|
|
|
variant="subtitle1" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
Reconnect |
|
|
|
Reconnect |
|
|
|
</Typography> |
|
|
|
</Typography> |
|
|
|
</Button> |
|
|
|
</Button> |
|
|
@ -242,7 +232,6 @@ const FullSize = ({ setMode, uuid, serverName }: PreviewProps): JSX.Element => { |
|
|
|
)} |
|
|
|
)} |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
)} |
|
|
|
)} |
|
|
|
</Box> |
|
|
|
|
|
|
|
</Panel> |
|
|
|
</Panel> |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|