feature: the package installs the Router Manager, which is no longer a package of its own.
Release / release (push) Failing after 4s
Release / release (push) Failing after 4s
This commit is contained in:
1 parent
6d90441bee
commit
8efe21bfa6
129 files changed
+17381
-104
No files matched your search
@@ -0,0 +1,58 @@
|
||||
import Refresh from '@mui/icons-material/Refresh'
|
||||
import { Alert, Box, Button, Typography } from '@mui/material'
|
||||
import { Pairs, Section, text } from './RouterPanel.tsx'
|
||||
import Toolbar from './Toolbar.tsx'
|
||||
import { DETAILS_SHAPE, STATUS_SHAPE, request, type RouterDetails, type RouterStatus } from './api.ts'
|
||||
import { useRead } from './useRead.ts'
|
||||
|
||||
/** Reads the router's /status/full and /config. */
|
||||
const readDocker = async () => {
|
||||
const [status, details] = await Promise.all([
|
||||
request<RouterStatus>('GET', '/status/full', STATUS_SHAPE),
|
||||
request<RouterDetails>('GET', '/config', DETAILS_SHAPE),
|
||||
])
|
||||
return { status, details }
|
||||
}
|
||||
|
||||
/**
|
||||
* The state of Docker on the router: whether it is installed, the state of docker.service and of the router's Docker
|
||||
* rules, from /status/full, and the ports exposed on the external interface and the rules of the VPN-ROUTER-DOCKER
|
||||
* chain, from /config.
|
||||
*/
|
||||
export default function DockerPanel() {
|
||||
const { data, error, busy, refresh } = useRead(readDocker)
|
||||
const status = data?.status
|
||||
const details = data?.details
|
||||
const docker = status?.docker
|
||||
return (
|
||||
<Box component="section">
|
||||
<Toolbar description="Docker and its firewall rules.">
|
||||
<Button variant="outlined" startIcon={<Refresh />} disabled={busy} onClick={() => void refresh()}>Refresh</Button>
|
||||
</Toolbar>
|
||||
{error && <Alert severity="error" sx={{ mb: 2, whiteSpace: 'pre-line' }}>{error}</Alert>}
|
||||
{status && details && (
|
||||
<Box sx={{ display: 'grid', gap: 2, gridTemplateColumns: { xs: '1fr', md: '1fr 1fr' } }}>
|
||||
<Section title="Status">
|
||||
<Pairs
|
||||
rows={[
|
||||
['Docker', docker === undefined ? 'unknown' : docker.installed ? 'installed' : 'not installed'],
|
||||
['docker.service', text(docker?.service)],
|
||||
['Docker rules', text(docker?.rules)],
|
||||
['Exposed ports', text(details.docker.exposed_ports)],
|
||||
]}
|
||||
/>
|
||||
</Section>
|
||||
<Section title="Rules of VPN-ROUTER-DOCKER">
|
||||
{details.docker.rules === null
|
||||
? <Typography variant="body2" color="text.secondary">Not available.</Typography>
|
||||
: (
|
||||
<Box component="pre" sx={{ m: 0, overflow: 'auto', fontFamily: 'monospace', fontSize: 12 }}>
|
||||
{details.docker.rules.length === 0 ? '(none)' : details.docker.rules.join('\n')}
|
||||
</Box>
|
||||
)}
|
||||
</Section>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user