feature: the CA certificates and CRLs are always published over HTTP and HTTPS on the status and Manager ports, the Shell page is an entry of the page menu, and the web interface passes its lint.
Release / release (push) Successful in 26s
Release / release (push) Successful in 26s
This commit is contained in:
1 parent
4b5318c676
commit
0cec95c19b
72 files changed
+910
-861
No files matched your search
+36
-29
@@ -9,9 +9,11 @@ import Settings from '@mui/icons-material/Settings'
|
||||
import { Alert, Box, Button, Checkbox, Chip, FormControlLabel, IconButton, Link, Stack, Table, TableBody, TableCell, TableHead, TableRow, Tooltip } from '@mui/material'
|
||||
import { useCallback, useEffect, useState, type ReactNode } from 'react'
|
||||
import ConfirmDialog, { type ConfirmDialogProps } from './ConfirmDialog.tsx'
|
||||
import { Board, BoardButtons, useBoard, type BoardPanel } from './PanelBoard.tsx'
|
||||
import { Board, BoardButtons, type BoardPanel } from './PanelBoard.tsx'
|
||||
import { useBoard } from './useBoard.ts'
|
||||
import { Copyable, Pairs } from './ServerPanel.tsx'
|
||||
import SearchField, { matches } from './SearchField.tsx'
|
||||
import SearchField from './SearchField.tsx'
|
||||
import { matches } from './search.ts'
|
||||
import SiteDialog, { type SiteSettings } from './SiteDialog.tsx'
|
||||
import SitesSettingsDialog from './SitesSettingsDialog.tsx'
|
||||
import Toolbar from './Toolbar.tsx'
|
||||
@@ -44,7 +46,7 @@ export default function SitesPanel(props: { onOpenFiles: (name: string) => void
|
||||
const [groups, setGroups] = useState<string[]>([])
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [unavailable, setUnavailable] = useState(false)
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [busy, setBusy] = useState(true)
|
||||
const [adding, setAdding] = useState(false)
|
||||
const [editing, setEditing] = useState<Site | null>(null)
|
||||
const [settings, setSettings] = useState(false)
|
||||
@@ -52,35 +54,40 @@ export default function SitesPanel(props: { onOpenFiles: (name: string) => void
|
||||
const [search, setSearch] = useState('')
|
||||
const board = useBoard(LAYOUT_KEY)
|
||||
|
||||
const refresh = useCallback(async () => {
|
||||
setBusy(true)
|
||||
try {
|
||||
const [found, groupList, details] = await Promise.all([
|
||||
request<Sites>('GET', '/sites', SITES_SHAPE),
|
||||
request<{ groups: Group[] }>('GET', '/groups', GROUPS_SHAPE),
|
||||
request<RouterDetails>('GET', '/config', DETAILS_SHAPE),
|
||||
])
|
||||
setSites(found)
|
||||
setGroups(groupList.groups.map((group) => group.name))
|
||||
const wan = details.configuration.wan ?? {}
|
||||
const pki = details.configuration.pki ?? {}
|
||||
setFqdn(typeof wan.local_fqdn === 'string' ? wan.local_fqdn : '')
|
||||
setCas(typeof pki.issuing_cas === 'object' && pki.issuing_cas !== null ? Object.keys(pki.issuing_cas) : [])
|
||||
setError(null)
|
||||
setUnavailable(false)
|
||||
} catch (caught) {
|
||||
const failure = caught as ApiError
|
||||
setSites(null)
|
||||
setUnavailable(failure.status === 404)
|
||||
setError(failure.message)
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
/** Reads the sites with the groups and the server's details; the state changes only once the server answers. */
|
||||
const read = useCallback(async () => {
|
||||
await Promise.all([
|
||||
request<Sites>('GET', '/sites', SITES_SHAPE),
|
||||
request<{ groups: Group[] }>('GET', '/groups', GROUPS_SHAPE),
|
||||
request<RouterDetails>('GET', '/config', DETAILS_SHAPE),
|
||||
])
|
||||
.then(([found, groupList, details]) => {
|
||||
setSites(found)
|
||||
setGroups(groupList.groups.map((group) => group.name))
|
||||
const wan = details.configuration.wan ?? {}
|
||||
const pki = details.configuration.pki ?? {}
|
||||
setFqdn(typeof wan.local_fqdn === 'string' ? wan.local_fqdn : '')
|
||||
setCas(typeof pki.issuing_cas === 'object' && pki.issuing_cas !== null ? Object.keys(pki.issuing_cas) : [])
|
||||
setError(null)
|
||||
setUnavailable(false)
|
||||
}, (caught) => {
|
||||
const failure = caught as ApiError
|
||||
setSites(null)
|
||||
setUnavailable(failure.status === 404)
|
||||
setError(failure.message)
|
||||
})
|
||||
.finally(() => setBusy(false))
|
||||
}, [])
|
||||
|
||||
/** Reads the sites again, busy until the server answers. */
|
||||
const refresh = useCallback(() => {
|
||||
setBusy(true)
|
||||
return read()
|
||||
}, [read])
|
||||
|
||||
useEffect(() => {
|
||||
void refresh()
|
||||
}, [refresh])
|
||||
void read()
|
||||
}, [read])
|
||||
|
||||
/** Runs a change of a site, then reads the list again; a failure is shown above the list. */
|
||||
async function change(work: () => Promise<unknown>) {
|
||||
|
||||
Reference in new issue
Block a user