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,75 @@
|
||||
import ArrowDropDown from '@mui/icons-material/ArrowDropDown'
|
||||
import Hub from '@mui/icons-material/Hub'
|
||||
import MenuIcon from '@mui/icons-material/Menu'
|
||||
import People from '@mui/icons-material/People'
|
||||
import Public from '@mui/icons-material/Public'
|
||||
import ViewInAr from '@mui/icons-material/ViewInAr'
|
||||
import Router from '@mui/icons-material/Router'
|
||||
import VerifiedUser from '@mui/icons-material/VerifiedUser'
|
||||
import VpnKey from '@mui/icons-material/VpnKey'
|
||||
import { Button, ListItemIcon, ListItemText, Menu, MenuItem } from '@mui/material'
|
||||
import { useState, type ReactNode } from 'react'
|
||||
|
||||
/** The path of the signed-in user's own account page. */
|
||||
export const USER_PATH = '/user'
|
||||
|
||||
/** The path of the Remote Access page: IKEv2, OpenVPN and WireGuard. */
|
||||
export const REMOTE_ACCESS_PATH = '/remote-access-manager'
|
||||
|
||||
/** The path of the Certificates page. */
|
||||
export const CA_PATH = '/ca-manager'
|
||||
|
||||
/** The path of the Identities page: the users, the groups and the service accounts. */
|
||||
export const USERS_PATH = '/user-manager'
|
||||
|
||||
/** The path of the Connectivity page: the site-to-site connections and their state. */
|
||||
export const SITE_TO_SITE_PATH = '/site-to-site-manager'
|
||||
|
||||
/** The path of the Docker page: the state of Docker and of its rules. */
|
||||
export const DOCKER_PATH = '/docker-manager'
|
||||
|
||||
/** The path of the Web Sites page: the sites Caddy serves, their files and the name server. */
|
||||
export const SITES_PATH = '/sites-manager'
|
||||
|
||||
/** The path of the shell page: a login shell on the router, opened with the shell button of the header, not the menu. */
|
||||
export const SHELL_PATH = '/shell'
|
||||
|
||||
/** The pages of an administrator in the menu: path, label and icon. */
|
||||
const PAGES: { path: string; label: string; icon: ReactNode }[] = [
|
||||
{ path: '/', label: 'Router', icon: <Router fontSize="small" /> },
|
||||
{ path: USERS_PATH, label: 'Identities', icon: <People fontSize="small" /> },
|
||||
{ path: SITE_TO_SITE_PATH, label: 'Connectivity', icon: <Hub fontSize="small" /> },
|
||||
{ path: REMOTE_ACCESS_PATH, label: 'Remote Access', icon: <VpnKey fontSize="small" /> },
|
||||
{ path: CA_PATH, label: 'Certificates', icon: <VerifiedUser fontSize="small" /> },
|
||||
{ path: SITES_PATH, label: 'Web Sites', icon: <Public fontSize="small" /> },
|
||||
{ path: DOCKER_PATH, label: 'Docker', icon: <ViewInAr fontSize="small" /> },
|
||||
]
|
||||
|
||||
/** A button naming the page shown, or Pages on the account and the shell page, whose menu opens the pages of an administrator. */
|
||||
export default function PageMenu(props: { path: string }) {
|
||||
const [anchor, setAnchor] = useState<HTMLElement | null>(null)
|
||||
const current = PAGES.find((page) => page.path === props.path) ?? { path: props.path, label: 'Pages', icon: <MenuIcon fontSize="small" /> }
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
variant="text"
|
||||
color="inherit"
|
||||
startIcon={current.icon}
|
||||
endIcon={<ArrowDropDown />}
|
||||
aria-haspopup="menu"
|
||||
aria-expanded={anchor !== null}
|
||||
onClick={(event) => setAnchor(event.currentTarget)}
|
||||
>
|
||||
{current.label}
|
||||
</Button>
|
||||
<Menu anchorEl={anchor} open={anchor !== null} onClose={() => setAnchor(null)}>
|
||||
{PAGES.map((page) => (
|
||||
<MenuItem key={page.path} component="a" href={page.path} selected={page.path === current.path}>
|
||||
<ListItemIcon>{page.icon}</ListItemIcon>
|
||||
<ListItemText>{page.label}</ListItemText>
|
||||
</MenuItem>
|
||||
))}
|
||||
</Menu>
|
||||
</>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user