fix(front-end): change server page name, adjust paths, and add fetching vnc connection info

main
Josue 4 years ago
parent b5def9a539
commit 41b074e207
  1. 47
      striker-ui/components/Display/FullSize.tsx
  2. 2
      striker-ui/components/Servers.tsx
  3. 0
      striker-ui/pages/server/index.tsx

@ -60,10 +60,9 @@ interface VncConnectionProps {
const FullSize = ({ setMode, uuid }: PreviewProps): JSX.Element => { const FullSize = ({ setMode, uuid }: PreviewProps): JSX.Element => {
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null); const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
const rfb = useRef<typeof RFB>(undefined); const rfb = useRef<typeof RFB>(undefined);
const vncConnection = useRef<VncConnectionProps>({ const [vncConnection, setVncConnection] = useState<
protocol: '', VncConnectionProps | undefined
forward_port: 0, >(undefined);
});
const [displaySize, setDisplaySize] = useState< const [displaySize, setDisplaySize] = useState<
| { | {
width: string | number; width: string | number;
@ -79,18 +78,18 @@ const FullSize = ({ setMode, uuid }: PreviewProps): JSX.Element => {
height: '80vh', height: '80vh',
}); });
(async () => { if (!vncConnection)
const res = await putJSON( (async () => {
'http://108.168.17.168/cgi-bin/manage_vnc_pipes', const res = await putJSON(
{ `${process.env.NEXT_PUBLIC_API_URL}/manage_vnc_pipes`,
server_uuid: uuid, {
is_open: true, server_uuid: uuid,
}, is_open: true,
); },
// console.log(res); );
vncConnection.current = res.json(); setVncConnection(await res.json());
})(); })();
}, [uuid]); }, [uuid, vncConnection]);
const handleClick = (event: React.MouseEvent<HTMLButtonElement>): void => { const handleClick = (event: React.MouseEvent<HTMLButtonElement>): void => {
setAnchorEl(event.currentTarget); setAnchorEl(event.currentTarget);
@ -117,13 +116,15 @@ const FullSize = ({ setMode, uuid }: PreviewProps): JSX.Element => {
return ( return (
<Panel> <Panel>
<Box display="flex" className={classes.displayBox}> <Box display="flex" className={classes.displayBox}>
<Box> {vncConnection && (
<VncDisplay <Box>
rfb={rfb} <VncDisplay
url={`ws://108.168.17.168:${vncConnection.current.forward_port}`} rfb={rfb}
style={displaySize} url={`wss://spain.cdot.systems:${vncConnection.forward_port}`}
/> style={displaySize}
</Box> />
</Box>
)}
<Box> <Box>
<Box className={classes.closeBox}> <Box className={classes.closeBox}>
<IconButton <IconButton

@ -257,7 +257,7 @@ const Servers = ({ anvil }: { anvil: AnvilListItem[] }): JSX.Element => {
className={classes.button} className={classes.button}
key={server.server_uuid} key={server.server_uuid}
component="a" component="a"
href={`/server/${server.server_uuid}`} href={`/server?uuid=${server.server_uuid}`}
> >
<Box display="flex" flexDirection="row" width="100%"> <Box display="flex" flexDirection="row" width="100%">
{showCheckbox && ( {showCheckbox && (

Loading…
Cancel
Save