You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
1.8 KiB
77 lines
1.8 KiB
3 years ago
|
import { useRouter } from 'next/router';
|
||
4 years ago
|
import { Box } from '@material-ui/core';
|
||
|
import { makeStyles } from '@material-ui/core/styles';
|
||
|
|
||
3 years ago
|
import PeriodicFetch from '../../lib/fetchers/periodicFetch';
|
||
|
import CPU from '../../components/CPU';
|
||
|
import Memory from '../../components/Memory';
|
||
|
import Resource from '../../components/Resource';
|
||
|
import Display from '../../components/Display';
|
||
|
import Header from '../../components/Header';
|
||
|
import Domain from '../../components/Domain';
|
||
4 years ago
|
|
||
|
const useStyles = makeStyles((theme) => ({
|
||
|
child: {
|
||
|
width: '22%',
|
||
|
height: '100%',
|
||
|
[theme.breakpoints.down('lg')]: {
|
||
|
width: '25%',
|
||
|
},
|
||
|
[theme.breakpoints.down('md')]: {
|
||
|
width: '100%',
|
||
|
},
|
||
|
},
|
||
|
server: {
|
||
|
width: '35%',
|
||
|
[theme.breakpoints.down('lg')]: {
|
||
|
width: '25%',
|
||
|
},
|
||
|
[theme.breakpoints.down('md')]: {
|
||
|
width: '100%',
|
||
|
},
|
||
|
},
|
||
|
container: {
|
||
|
display: 'flex',
|
||
|
flexDirection: 'row',
|
||
|
width: '100%',
|
||
|
justifyContent: 'space-between',
|
||
|
[theme.breakpoints.down('md')]: {
|
||
|
display: 'block',
|
||
|
},
|
||
|
},
|
||
|
}));
|
||
|
|
||
3 years ago
|
const Server = (): JSX.Element => {
|
||
4 years ago
|
const classes = useStyles();
|
||
|
|
||
3 years ago
|
const router = useRouter();
|
||
|
const { uuid } = router.query;
|
||
|
|
||
|
const { data } = PeriodicFetch<AnvilReplicatedStorage>(
|
||
|
`${process.env.NEXT_PUBLIC_API_URL}/anvils/get_replicated_storage?server_uuid=${uuid}`,
|
||
4 years ago
|
);
|
||
|
|
||
|
return (
|
||
|
<>
|
||
|
<Header />
|
||
3 years ago
|
{typeof uuid === 'string' && data && (
|
||
4 years ago
|
<Box className={classes.container}>
|
||
|
<Box className={classes.child}>
|
||
|
<CPU />
|
||
|
<Memory />
|
||
|
</Box>
|
||
|
<Box flexGrow={1} className={classes.server}>
|
||
|
<Display />
|
||
|
<Domain />
|
||
|
</Box>
|
||
|
<Box className={classes.child}>
|
||
3 years ago
|
<Resource resource={data} />
|
||
4 years ago
|
</Box>
|
||
|
</Box>
|
||
|
)}
|
||
|
</>
|
||
|
);
|
||
|
};
|
||
|
|
||
3 years ago
|
export default Server;
|