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
@@ -1,6 +1,5 @@
|
||||
import { Chip } from '@mui/material'
|
||||
import { bytes } from './ServerPanel.tsx'
|
||||
import type { Backup, BackupState } from './api.ts'
|
||||
import type { BackupState } from './api.ts'
|
||||
|
||||
/** The colour of each result of a backup run. */
|
||||
const RESULT_COLORS: Record<string, 'success' | 'warning' | 'error' | 'info'> = {
|
||||
@@ -11,43 +10,9 @@ const RESULT_COLORS: Record<string, 'success' | 'warning' | 'error' | 'info'> =
|
||||
running: 'info',
|
||||
}
|
||||
|
||||
/** The labels of the backup targets. */
|
||||
export const TARGET_LABELS: Record<string, string> = { local: 'Local folder', pbs: 'Proxmox Backup Server' }
|
||||
|
||||
/** A time of the server in the browser's format, or a dash. */
|
||||
export function when(time: string | null | undefined) {
|
||||
return time ? new Date(time).toLocaleString() : '-'
|
||||
}
|
||||
|
||||
/** The result of the last backup run as a chip, or "never" before the first. */
|
||||
export function BackupChip(props: { state: BackupState | null }) {
|
||||
return props.state
|
||||
? <Chip size="small" label={props.state.result} color={RESULT_COLORS[props.state.result] ?? 'default'} />
|
||||
: <Chip size="small" label="never" variant="outlined" />
|
||||
}
|
||||
|
||||
/** The schedule, the next run (as systemd shows it) and the last run of the server's backups, as rows of Pairs. */
|
||||
export function backupRows(backup: Backup): [string, string][] {
|
||||
const { settings, state } = backup
|
||||
const rows: [string, string][] = [
|
||||
['Backups', settings.enabled ? `${settings.schedule}, to ${TARGET_LABELS[settings.target] ?? settings.target}` : 'off'],
|
||||
['Next run', backup.next ?? '-'],
|
||||
]
|
||||
if (!state) {
|
||||
return [...rows, ['Last run', 'none']]
|
||||
}
|
||||
rows.push(
|
||||
['Last run', `${when(state.started)}${state.finished ? ` to ${new Date(state.finished).toLocaleTimeString()}` : ''}`],
|
||||
['Last result', state.result],
|
||||
)
|
||||
if (state.archive ?? state.snapshot) {
|
||||
rows.push(['Last backup', `${state.archive ?? state.snapshot}${state.size === null ? '' : `, ${bytes(state.size)}`}`])
|
||||
}
|
||||
if (state.cloud) {
|
||||
rows.push(['Cloud copy', `${state.cloud.mode} to ${state.cloud.remote}: ${state.cloud.error ?? state.cloud.result}`])
|
||||
}
|
||||
if (state.error) {
|
||||
rows.push(['Error', state.error])
|
||||
}
|
||||
return rows
|
||||
}
|
||||
Reference in new issue
Block a user