feature: the VPN, the router, the name server and WebDAV are components switched on the System tab and installed on demand, Caddy from the Ubuntu archive is a dependency and serves every HTTP and HTTPS port, HTTPS is chosen at install, its certificate is of the Servers Issuing CA or self-signed by default, of ACME or of another CA, the issuing CAs are in one tab, a locked account is unlocked again, the name of a CA is fixed once the CA exists, and a run of setup is no longer cut short by a change.
Release / release (push) Failing after 8s
Release / release (push) Failing after 8s
This commit is contained in:
1 parent
a649331aa2
commit
a7bfabcb89
97 files changed
+4498
-1834
No files matched your search
+96
-74
@@ -5,11 +5,15 @@ import { Alert, Box, Button, Table, TableBody, TableCell, TableHead, TablePagina
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import BackupDialog from './BackupDialog.tsx'
|
||||
import { BackupChip, TARGET_LABELS, backupRows, when } from './BackupSummary.tsx'
|
||||
import { Pairs, Section, bytes } from './ServerPanel.tsx'
|
||||
import { Board, BoardButtons, useBoard, type BoardPanel } from './PanelBoard.tsx'
|
||||
import { Pairs, bytes } from './ServerPanel.tsx'
|
||||
import SearchField, { matches } from './SearchField.tsx'
|
||||
import Toolbar from './Toolbar.tsx'
|
||||
import { ApiError, BACKUP_KEEPS, BACKUP_SCHEDULES, BACKUP_SETTINGS_SHAPE, BACKUP_SHAPE, STARTED_SHAPE, request, type Backup } from './api.ts'
|
||||
|
||||
/** The localStorage key of the tab's layout. */
|
||||
const LAYOUT_KEY = 'linux-manager-ui.backup-layout'
|
||||
|
||||
/** The note shown after a change, which the server applies when linux-manager-setup has run again. */
|
||||
const APPLIED = 'The server applies the change in the background.'
|
||||
|
||||
@@ -19,7 +23,8 @@ const WATCH_SECONDS = 3
|
||||
/**
|
||||
* The server's backups: the settings, the last run and the local archives, searched by name and time and shown a page at
|
||||
* a time; edit the settings and start a backup now.
|
||||
* While a backup runs, or after Run now until it has ended, the tab reads every WATCH_SECONDS.
|
||||
* While a backup runs, or after Run now until it has ended, the tab reads every WATCH_SECONDS. The panels are on a
|
||||
* PanelBoard whose layout is kept in the browser.
|
||||
*/
|
||||
export default function BackupPanel() {
|
||||
const [backup, setBackup] = useState<Backup | null>(null)
|
||||
@@ -28,6 +33,7 @@ export default function BackupPanel() {
|
||||
const [note, setNote] = useState<string | null>(null)
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [editing, setEditing] = useState(false)
|
||||
const board = useBoard(LAYOUT_KEY)
|
||||
const [watching, setWatching] = useState(false)
|
||||
const [search, setSearch] = useState('')
|
||||
const [page, setPage] = useState(0)
|
||||
@@ -87,6 +93,92 @@ export default function BackupPanel() {
|
||||
const local = settings?.target === 'local'
|
||||
const keeps = settings ? BACKUP_KEEPS.slice(BACKUP_SCHEDULES.indexOf(settings.schedule as (typeof BACKUP_SCHEDULES)[number])) : []
|
||||
|
||||
const panels: BoardPanel[] = backup && settings ? [
|
||||
{
|
||||
id: 'settings',
|
||||
title: 'Settings',
|
||||
content: (
|
||||
<Pairs
|
||||
rows={[
|
||||
['Scheduled backups', settings.enabled ? 'on' : 'off'],
|
||||
['Schedule', settings.schedule],
|
||||
['Target', TARGET_LABELS[settings.target] ?? settings.target],
|
||||
['Metrics database', settings.metrics ? 'included' : 'not included'],
|
||||
...(local
|
||||
? [
|
||||
['Folder', settings.path],
|
||||
['Kept', keeps.map((keep) => `${settings[keep]} ${keep.slice(5)}`).join(', ')],
|
||||
['Cloud copy', settings.rclone_remote ? `${settings.rclone_mode} to ${settings.rclone_remote}` : 'none'],
|
||||
] satisfies [string, string][]
|
||||
: [
|
||||
['Repository', settings.pbs_repository || '-'],
|
||||
['Token secret', settings.pbs_password_set ? 'set' : 'missing'],
|
||||
['Fingerprint', settings.pbs_fingerprint || '-'],
|
||||
['Namespace', settings.pbs_namespace || '-'],
|
||||
['Encryption key file', settings.pbs_keyfile || 'none'],
|
||||
] satisfies [string, string][]),
|
||||
]}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: 'last-run',
|
||||
title: 'Last run',
|
||||
content: (
|
||||
<>
|
||||
<Box sx={{ mb: 1 }}><BackupChip state={backup.state} /></Box>
|
||||
<Pairs rows={backupRows(backup)} />
|
||||
</>
|
||||
),
|
||||
},
|
||||
...(local ? [{
|
||||
id: 'archives',
|
||||
title: 'Local archives',
|
||||
wide: true,
|
||||
content: (
|
||||
<>
|
||||
<Box sx={{ mb: 1 }}>
|
||||
<SearchField value={search} onChange={(value) => { setSearch(value); setPage(0) }} />
|
||||
</Box>
|
||||
<Box sx={{ overflowX: 'auto' }}>
|
||||
<Table size="small">
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell>Archive</TableCell>
|
||||
<TableCell>Time</TableCell>
|
||||
<TableCell align="right">Size</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{archives.length === 0 && (
|
||||
<TableRow>
|
||||
<TableCell colSpan={3} sx={{ color: 'text.secondary' }}>None.</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
{archives.slice(shownPage * rows, (shownPage + 1) * rows).map((archive) => (
|
||||
<TableRow key={archive.name} hover>
|
||||
<TableCell sx={{ fontFamily: 'monospace' }}>{archive.name}</TableCell>
|
||||
<TableCell>{when(archive.time)}</TableCell>
|
||||
<TableCell align="right">{bytes(archive.size)}</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</Box>
|
||||
<TablePagination
|
||||
component="div"
|
||||
count={archives.length}
|
||||
page={shownPage}
|
||||
rowsPerPage={rows}
|
||||
rowsPerPageOptions={[10, 25, 50, 100]}
|
||||
onPageChange={(_event, next) => setPage(next)}
|
||||
onRowsPerPageChange={(event) => { setRows(Number(event.target.value)); setPage(0) }}
|
||||
/>
|
||||
</>
|
||||
),
|
||||
}] : []),
|
||||
] : []
|
||||
|
||||
return (
|
||||
<Box component="section">
|
||||
<Toolbar description="Backups of the server's configuration, keys, users and metrics.">
|
||||
@@ -96,6 +188,7 @@ export default function BackupPanel() {
|
||||
<Button variant="outlined" startIcon={<PlayArrow />} disabled={busy || backup === null || running || watching} onClick={() => void runNow()}>
|
||||
Run now
|
||||
</Button>
|
||||
<BoardButtons board={board} />
|
||||
<Button variant="outlined" startIcon={<Refresh />} disabled={busy} onClick={() => void refresh()}>
|
||||
Refresh
|
||||
</Button>
|
||||
@@ -114,78 +207,7 @@ export default function BackupPanel() {
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
{backup && settings && (
|
||||
<Box sx={{ display: 'grid', gap: 2, gridTemplateColumns: { xs: '1fr', md: '1fr 1fr' } }}>
|
||||
<Section title="Settings">
|
||||
<Pairs
|
||||
rows={[
|
||||
['Scheduled backups', settings.enabled ? 'on' : 'off'],
|
||||
['Schedule', settings.schedule],
|
||||
['Target', TARGET_LABELS[settings.target] ?? settings.target],
|
||||
['Metrics database', settings.metrics ? 'included' : 'not included'],
|
||||
...(local
|
||||
? [
|
||||
['Folder', settings.path],
|
||||
['Kept', keeps.map((keep) => `${settings[keep]} ${keep.slice(5)}`).join(', ')],
|
||||
['Cloud copy', settings.rclone_remote ? `${settings.rclone_mode} to ${settings.rclone_remote}` : 'none'],
|
||||
] satisfies [string, string][]
|
||||
: [
|
||||
['Repository', settings.pbs_repository || '-'],
|
||||
['Token secret', settings.pbs_password_set ? 'set' : 'missing'],
|
||||
['Fingerprint', settings.pbs_fingerprint || '-'],
|
||||
['Namespace', settings.pbs_namespace || '-'],
|
||||
['Encryption key file', settings.pbs_keyfile || 'none'],
|
||||
] satisfies [string, string][]),
|
||||
]}
|
||||
/>
|
||||
</Section>
|
||||
<Section title="Last run">
|
||||
<Box sx={{ mb: 1 }}><BackupChip state={backup.state} /></Box>
|
||||
<Pairs rows={backupRows(backup)} />
|
||||
</Section>
|
||||
{local && (
|
||||
<Section title="Local archives" wide>
|
||||
<Box sx={{ mb: 1 }}>
|
||||
<SearchField value={search} onChange={(value) => { setSearch(value); setPage(0) }} />
|
||||
</Box>
|
||||
<Box sx={{ overflowX: 'auto' }}>
|
||||
<Table size="small">
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell>Archive</TableCell>
|
||||
<TableCell>Time</TableCell>
|
||||
<TableCell align="right">Size</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{archives.length === 0 && (
|
||||
<TableRow>
|
||||
<TableCell colSpan={3} sx={{ color: 'text.secondary' }}>None.</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
{archives.slice(shownPage * rows, (shownPage + 1) * rows).map((archive) => (
|
||||
<TableRow key={archive.name} hover>
|
||||
<TableCell sx={{ fontFamily: 'monospace' }}>{archive.name}</TableCell>
|
||||
<TableCell>{when(archive.time)}</TableCell>
|
||||
<TableCell align="right">{bytes(archive.size)}</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</Box>
|
||||
<TablePagination
|
||||
component="div"
|
||||
count={archives.length}
|
||||
page={shownPage}
|
||||
rowsPerPage={rows}
|
||||
rowsPerPageOptions={[10, 25, 50, 100]}
|
||||
onPageChange={(_event, next) => setPage(next)}
|
||||
onRowsPerPageChange={(event) => { setRows(Number(event.target.value)); setPage(0) }}
|
||||
/>
|
||||
</Section>
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
{backup && settings && <Board board={board} panels={panels} />}
|
||||
|
||||
{editing && backup && (
|
||||
<BackupDialog
|
||||
|
||||
Reference in new issue
Block a user