Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
proxmox(replication+backups): bespoke tables backed by new read-only endpoints
rcourtman27f35d9819f6
diff --git a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsxnew file mode 100644index 0000000000..b4544dfb15--- /dev/null+++ b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx@@ -0,0 +1,596 @@+import {+ For,+ Show,+ createMemo,+ createResource,+ createSignal,+ type Component,+ type JSX,+} from 'solid-js';+import ArchiveIcon from 'lucide-solid/icons/archive';+import CameraIcon from 'lucide-solid/icons/camera';+import ActivityIcon from 'lucide-solid/icons/activity';+import { Card } from '@/components/shared/Card';+import { EmptyState } from '@/components/shared/EmptyState';+import { FilterButtonGroup, type FilterOption } from '@/components/shared/FilterButtonGroup';+import { SearchInput } from '@/components/shared/SearchInput';+import { StatusDot } from '@/components/shared/StatusDot';+import type { StatusIndicatorVariant } from '@/utils/status';+import {+ Table,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow,+} from '@/components/shared/Table';+import { apiFetch } from '@/utils/apiClient';+import { formatBytes, formatRelativeTime } from '@/utils/format';+import type {+ BackupTask,+ GuestSnapshot,+ PVEBackupsPayload,+ PVEBackupsResponse,+ StorageBackup,+} from '@/types/api';++// Proxmox VE backups split into three meaningfully different surfaces:+// - Snapshots: qm/pct snapshots taken on the host (no external storage)+// - vzdump files: backup archives written to a PVE storage (often a+// remote PBS or NFS share). Each is a discrete restorable artifact.+// - Recent tasks: the rolling backup-job execution log; this is what+// surfaces "did last night's backup actually run?"+// PBS-resident backups (deduplicated server-side) get their own platform+// page, so this table is explicitly the PVE backup story.++type BackupTabId = 'snapshots' | 'archives' | 'tasks';++interface BackupTabSpec {+ id: BackupTabId;+ label: string;+ icon: () => JSX.Element;+ emptyTitle: string;+ emptyDescription: string;+}++const TABS: BackupTabSpec[] = [+ {+ id: 'snapshots',+ label: 'Snapshots',+ icon: () => <CameraIcon class="h-4 w-4" aria-hidden="true" />,+ emptyTitle: 'No guest snapshots',+ emptyDescription: 'qm/pct snapshots taken on PVE hosts will appear here.',+ },+ {+ id: 'archives',+ label: 'Backup files',+ icon: () => <ArchiveIcon class="h-4 w-4" aria-hidden="true" />,+ emptyTitle: 'No backup archives',+ emptyDescription: 'vzdump archives written to PVE-attached storage will appear here.',+ },+ {+ id: 'tasks',+ label: 'Recent tasks',+ icon: () => <ActivityIcon class="h-4 w-4" aria-hidden="true" />,+ emptyTitle: 'No recent backup tasks',+ emptyDescription: 'Backup-job task results from the past few days will appear here.',+ },+];++function classifyTaskStatus(status: string): {+ variant: StatusIndicatorVariant;+ label: string;+} {+ const normalized = (status ?? '').toLowerCase();+ if (normalized === 'ok' || normalized === 'success' || normalized === 'completed') {+ return { variant: 'success', label: 'OK' };+ }+ if (normalized === 'running') {+ return { variant: 'warning', label: 'Running' };+ }+ if (normalized === 'failed' || normalized === 'error') {+ return { variant: 'danger', label: 'Failed' };+ }+ if (!normalized) return { variant: 'muted', label: '—' };+ return { variant: 'muted', label: status };+}++function guestLabel(type: string | undefined, vmid: number): string {+ const t = (type ?? '').toLowerCase();+ const kind = t === 'ct' ? 'CT' : t === 'vm' ? 'VM' : t.toUpperCase() || 'Guest';+ return `${kind} ${vmid}`;+}++function formatDuration(start: string | undefined, end: string | undefined): string {+ if (!start || !end) return '—';+ const startMs = new Date(start).getTime();+ const endMs = new Date(end).getTime();+ if (!Number.isFinite(startMs) || !Number.isFinite(endMs) || endMs <= startMs) return '—';+ const seconds = Math.round((endMs - startMs) / 1000);+ if (seconds < 60) return `${seconds}s`;+ if (seconds < 3600) return `${Math.floor(seconds / 60)}m ${seconds % 60}s`;+ const h = Math.floor(seconds / 3600);+ const m = Math.floor((seconds % 3600) / 60);+ return `${h}h ${m}m`;+}++async function fetchPVEBackups(): Promise<PVEBackupsPayload> {+ const response = await apiFetch('/api/backups/pve');+ if (!response.ok) {+ throw new Error(`Failed to load PVE backups (${response.status})`);+ }+ const payload = (await response.json()) as PVEBackupsResponse;+ return (+ payload?.data ?? {+ backupTasks: [],+ storageBackups: [],+ guestSnapshots: [],+ }+ );+}++const ARCHIVE_STATUS_FILTERS: FilterOption<'all' | 'protected' | 'verified' | 'unverified'>[] = [+ { value: 'all', label: 'All' },+ { value: 'protected', label: 'Protected' },+ { value: 'verified', label: 'Verified' },+ { value: 'unverified', label: 'Unverified' },+];++const TASK_STATUS_FILTERS: FilterOption<'all' | 'ok' | 'failed' | 'running'>[] = [+ { value: 'all', label: 'All' },+ { value: 'ok', label: 'OK' },+ { value: 'failed', label: 'Failed' },+ { value: 'running', label: 'Running' },+];++export const ProxmoxBackupsTable: Component<{+ emptyIcon: JSX.Element;+}> = (props) => {+ const [backups, { refetch }] = createResource<PVEBackupsPayload>(fetchPVEBackups);+ const [tab, setTab] = createSignal<BackupTabId>('snapshots');+ const [search, setSearch] = createSignal('');+ const [archiveFilter, setArchiveFilter] = createSignal<'all' | 'protected' | 'verified' | 'unverified'>('all');+ const [taskFilter, setTaskFilter] = createSignal<'all' | 'ok' | 'failed' | 'running'>('all');++ const snapshots = createMemo<GuestSnapshot[]>(() => backups()?.guestSnapshots ?? []);+ const archives = createMemo<StorageBackup[]>(() => backups()?.storageBackups ?? []);+ const tasks = createMemo<BackupTask[]>(() => backups()?.backupTasks ?? []);++ const filteredSnapshots = createMemo(() => {+ const term = search().trim().toLowerCase();+ return snapshots().filter((snap) => {+ if (!term) return true;+ return [snap.name, snap.node, snap.instance, snap.description, String(snap.vmid)]+ .filter(Boolean)+ .join(' ')+ .toLowerCase()+ .includes(term);+ });+ });++ const filteredArchives = createMemo(() => {+ const term = search().trim().toLowerCase();+ const filter = archiveFilter();+ return archives().filter((arc) => {+ if (filter === 'protected' && !arc.protected) return false;+ if (filter === 'verified' && !arc.verified) return false;+ if (filter === 'unverified' && arc.verified) return false;+ if (!term) return true;+ return [arc.storage, arc.node, arc.instance, arc.volid, arc.notes, String(arc.vmid)]+ .filter(Boolean)+ .join(' ')+ .toLowerCase()+ .includes(term);+ });+ });++ const filteredTasks = createMemo(() => {+ const term = search().trim().toLowerCase();+ const filter = taskFilter();+ return tasks().filter((task) => {+ const classify = classifyTaskStatus(task.status);+ if (filter === 'ok' && classify.variant !== 'success') return false;+ if (filter === 'failed' && classify.variant !== 'danger') return false;+ if (filter === 'running' && classify.variant !== 'warning') return false;+ if (!term) return true;+ return [task.node, task.instance, task.status, task.error, String(task.vmid)]+ .filter(Boolean)+ .join(' ')+ .toLowerCase()+ .includes(term);+ });+ });++ const totalForTab = createMemo<number>(() => {+ switch (tab()) {+ case 'snapshots':+ return snapshots().length;+ case 'archives':+ return archives().length;+ case 'tasks':+ return tasks().length;+ default:+ return 0;+ }+ });++ const visibleForTab = createMemo<number>(() => {+ switch (tab()) {+ case 'snapshots':+ return filteredSnapshots().length;+ case 'archives':+ return filteredArchives().length;+ case 'tasks':+ return filteredTasks().length;+ default:+ return 0;+ }+ });++ return (+ <Show+ when={!backups.error}+ fallback={+ <Card padding="lg">+ <EmptyState+ icon={props.emptyIcon}+ title="Could not load PVE backups"+ description={(backups.error as Error | undefined)?.message ?? 'Refresh to retry.'}+ actions={+ <button+ type="button"+ onClick={() => void refetch()}+ class="inline-flex min-h-10 items-center rounded-md border border-border px-3 py-2 text-sm font-medium hover:bg-surface-hover"+ >+ Refresh+ </button>+ }+ />+ </Card>+ }+ >+ <Show+ when={backups() !== undefined}+ fallback={+ <Card padding="lg">+ <EmptyState+ icon={props.emptyIcon}+ title="Loading PVE backups"+ description="Reading snapshots, archives and recent backup tasks."+ />+ </Card>+ }+ >+ <div class="space-y-3">+ <div class="flex flex-wrap items-center gap-1 rounded-md border border-border bg-surface p-1">+ <For each={TABS}>+ {(spec) => (+ <button+ type="button"+ onClick={() => setTab(spec.id)}+ class={`inline-flex min-h-9 items-center gap-1.5 rounded-sm px-3 text-xs font-medium transition-colors ${+ tab() === spec.id+ ? 'bg-surface-hover text-base-content'+ : 'text-muted hover:text-base-content'+ }`}+ aria-pressed={tab() === spec.id}+ >+ {spec.icon()}+ <span>{spec.label}</span>+ <span class="text-[10px] text-muted tabular-nums">+ {spec.id === 'snapshots'+ ? snapshots().length+ : spec.id === 'archives'+ ? archives().length+ : tasks().length}+ </span>+ </button>+ )}+ </For>+ </div>++ <div class="flex flex-wrap items-center gap-2">+ <div class="min-w-[200px] flex-1 sm:max-w-xs">+ <SearchInput+ value={search}+ onChange={setSearch}+ placeholder={+ tab() === 'snapshots'+ ? 'Search snapshots, guests, nodes'+ : tab() === 'archives'+ ? 'Search archives, storages, nodes'+ : 'Search tasks, nodes, errors'+ }+ />+ </div>+ <Show when={tab() === 'archives'}>+ <FilterButtonGroup+ options={ARCHIVE_STATUS_FILTERS}+ value={archiveFilter()}+ onChange={setArchiveFilter}+ />+ </Show>+ <Show when={tab() === 'tasks'}>+ <FilterButtonGroup+ options={TASK_STATUS_FILTERS}+ value={taskFilter()}+ onChange={setTaskFilter}+ />+ </Show>+ <span class="ml-auto whitespace-nowrap text-xs font-medium text-muted">+ <Show+ when={visibleForTab() !== totalForTab()}+ fallback={<>{totalForTab()} entries</>}+ >+ {visibleForTab()} of {totalForTab()} entries+ </Show>+ </span>+ </div>++ <Show when={tab() === 'snapshots'}>+ <Show+ when={filteredSnapshots().length > 0}+ fallback={+ <Card padding="lg">+ <EmptyState+ icon={props.emptyIcon}+ title={+ snapshots().length === 0+ ? TABS[0].emptyTitle+ : 'No snapshots match current filters'+ }+ description={+ snapshots().length === 0+ ? TABS[0].emptyDescription+ : 'Adjust the search to see more snapshots.'+ }+ />+ </Card>+ }+ >+ <Card padding="none" tone="card" class="overflow-hidden">+ <Table class="w-full min-w-[900px] border-collapse text-xs">+ <TableHeader class="bg-surface-alt text-muted border-b border-border">+ <TableRow class="text-left text-[10px] uppercase tracking-wide">+ <TableHead class="px-3 py-2 font-medium">Name</TableHead>+ <TableHead class="px-3 py-2 font-medium">Guest</TableHead>+ <TableHead class="px-3 py-2 font-medium">Node</TableHead>+ <TableHead class="px-3 py-2 font-medium">Parent</TableHead>+ <TableHead class="px-3 py-2 font-medium">Captured</TableHead>+ <TableHead class="px-3 py-2 font-medium text-right">Size</TableHead>+ <TableHead class="px-3 py-2 font-medium">RAM</TableHead>+ </TableRow>+ </TableHeader>+ <TableBody class="divide-y divide-border-subtle">+ <For each={filteredSnapshots()}>+ {(snap) => (+ <TableRow class="hover:bg-surface-hover">+ <TableCell class="px-3 py-2 text-base-content">+ <div class="font-semibold">{snap.name || '—'}</div>+ <Show when={!!snap.description?.trim()}>+ <div class="text-[11px] text-muted truncate max-w-[20rem]" title={snap.description}>+ {snap.description}+ </div>+ </Show>+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content">{guestLabel(snap.type, snap.vmid)}</TableCell>+ <TableCell class="px-3 py-2 text-base-content font-mono text-[11px]">+ {snap.node || '—'}+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content font-mono text-[11px]">+ {snap.parent?.trim() || '—'}+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content">+ {formatRelativeTime(snap.time, { compact: true })}+ </TableCell>+ <TableCell class="px-3 py-2 text-right text-base-content tabular-nums">+ <Show when={snap.sizeBytes && snap.sizeBytes > 0} fallback={<span class="text-muted">—</span>}>+ {formatBytes(snap.sizeBytes ?? 0)}+ </Show>+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content">+ <Show+ when={snap.vmstate}+ fallback={<span class="text-muted">—</span>}+ >+ <span class="inline-flex items-center rounded-sm bg-blue-100 px-1.5 py-0.5 text-[10px] font-semibold text-blue-700 dark:bg-blue-900/40 dark:text-blue-200">+ with RAM+ </span>+ </Show>+ </TableCell>+ </TableRow>+ )}+ </For>+ </TableBody>+ </Table>+ </Card>+ </Show>+ </Show>++ <Show when={tab() === 'archives'}>+ <Show+ when={filteredArchives().length > 0}+ fallback={+ <Card padding="lg">+ <EmptyState+ icon={props.emptyIcon}+ title={+ archives().length === 0+ ? TABS[1].emptyTitle+ : 'No archives match current filters'+ }+ description={+ archives().length === 0+ ? TABS[1].emptyDescription+ : 'Adjust the search or status filter to see more archives.'+ }+ />+ </Card>+ }+ >+ <Card padding="none" tone="card" class="overflow-hidden">+ <Table class="w-full min-w-[1050px] border-collapse text-xs">+ <TableHeader class="bg-surface-alt text-muted border-b border-border">+ <TableRow class="text-left text-[10px] uppercase tracking-wide">+ <TableHead class="px-3 py-2 font-medium">Volume</TableHead>+ <TableHead class="px-3 py-2 font-medium">Guest</TableHead>+ <TableHead class="px-3 py-2 font-medium">Storage</TableHead>+ <TableHead class="px-3 py-2 font-medium">Node</TableHead>+ <TableHead class="px-3 py-2 font-medium">Format</TableHead>+ <TableHead class="px-3 py-2 font-medium">Created</TableHead>+ <TableHead class="px-3 py-2 font-medium text-right">Size</TableHead>+ <TableHead class="px-3 py-2 font-medium">Protection</TableHead>+ <TableHead class="px-3 py-2 font-medium">Verified</TableHead>+ </TableRow>+ </TableHeader>+ <TableBody class="divide-y divide-border-subtle">+ <For each={filteredArchives()}>+ {(arc) => (+ <TableRow class="hover:bg-surface-hover">+ <TableCell class="px-3 py-2 text-base-content font-mono text-[11px]">+ <span class="inline-block max-w-[18rem] truncate" title={arc.volid}>+ {arc.volid}+ </span>+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content">+ {guestLabel(arc.type, arc.vmid)}+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content">{arc.storage || '—'}</TableCell>+ <TableCell class="px-3 py-2 text-base-content font-mono text-[11px]">+ {arc.node || '—'}+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content uppercase text-[10px]">+ {arc.format || '—'}+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content">+ {formatRelativeTime(arc.time, { compact: true })}+ </TableCell>+ <TableCell class="px-3 py-2 text-right text-base-content tabular-nums">+ {formatBytes(arc.size)}+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content">+ <Show+ when={arc.protected}+ fallback={<span class="text-muted">—</span>}+ >+ <span class="inline-flex items-center rounded-sm bg-amber-100 px-1.5 py-0.5 text-[10px] font-semibold text-amber-700 dark:bg-amber-900/40 dark:text-amber-200">+ Protected+ </span>+ </Show>+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content">+ <Show+ when={arc.verified}+ fallback={+ <Show when={arc.isPBS} fallback={<span class="text-muted">—</span>}>+ <span class="text-muted">Pending</span>+ </Show>+ }+ >+ <span class="inline-flex items-center gap-1 text-emerald-700 dark:text-emerald-300">+ <StatusDot size="sm" variant="success" ariaHidden />+ <span class="text-[11px] font-medium">Verified</span>+ </span>+ </Show>+ </TableCell>+ </TableRow>+ )}+ </For>+ </TableBody>+ </Table>+ </Card>+ </Show>+ </Show>++ <Show when={tab() === 'tasks'}>+ <Show+ when={filteredTasks().length > 0}+ fallback={+ <Card padding="lg">+ <EmptyState+ icon={props.emptyIcon}+ title={+ tasks().length === 0+ ? TABS[2].emptyTitle+ : 'No tasks match current filters'+ }+ description={+ tasks().length === 0+ ? TABS[2].emptyDescription+ : 'Adjust the search or status filter to see more tasks.'+ }+ />+ </Card>+ }+ >+ <Card padding="none" tone="card" class="overflow-hidden">+ <Table class="w-full min-w-[1000px] border-collapse text-xs">+ <TableHeader class="bg-surface-alt text-muted border-b border-border">+ <TableRow class="text-left text-[10px] uppercase tracking-wide">+ <TableHead class="px-3 py-2 font-medium">Status</TableHead>+ <TableHead class="px-3 py-2 font-medium">Guest</TableHead>+ <TableHead class="px-3 py-2 font-medium">Node</TableHead>+ <TableHead class="px-3 py-2 font-medium">Started</TableHead>+ <TableHead class="px-3 py-2 font-medium">Duration</TableHead>+ <TableHead class="px-3 py-2 font-medium text-right">Size</TableHead>+ <TableHead class="px-3 py-2 font-medium">Error</TableHead>+ </TableRow>+ </TableHeader>+ <TableBody class="divide-y divide-border-subtle">+ <For each={filteredTasks()}>+ {(task) => {+ const classify = classifyTaskStatus(task.status);+ return (+ <TableRow class="hover:bg-surface-hover">+ <TableCell class="px-3 py-2">+ <div class="flex items-center gap-2">+ <StatusDot size="sm" variant={classify.variant} title={classify.label} ariaHidden />+ <span class="text-[11px] font-medium text-base-content">{classify.label}</span>+ </div>+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content">+ {guestLabel(task.type, task.vmid)}+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content font-mono text-[11px]">+ {task.node || '—'}+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content">+ {formatRelativeTime(task.startTime, { compact: true })}+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content">+ {formatDuration(task.startTime, task.endTime)}+ </TableCell>+ <TableCell class="px-3 py-2 text-right text-base-content tabular-nums">+ <Show when={task.size && task.size > 0} fallback={<span class="text-muted">—</span>}>+ {formatBytes(task.size ?? 0)}+ </Show>+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content">+ <Show+ when={!!task.error?.trim()}+ fallback={<span class="text-muted">—</span>}+ >+ <span+ class="inline-block max-w-[18rem] truncate text-red-600 dark:text-red-300"+ title={task.error}+ >+ {task.error}+ </span>+ </Show>+ </TableCell>+ </TableRow>+ );+ }}+ </For>+ </TableBody>+ </Table>+ </Card>+ </Show>+ </Show>+ </div>+ </Show>+ </Show>+ );+};++export default ProxmoxBackupsTable;diff --git a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsxindex 921c18ee26..0d2b61ba09 100644--- a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx+++ b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx@@ -1,13 +1,14 @@import { A, useLocation } from '@solidjs/router';import TriangleAlertIcon from 'lucide-solid/icons/triangle-alert';import { For, Show, createMemo } from 'solid-js';-import RecoverySurface from '@/components/Recovery/Recovery';import StorageSurface from '@/components/Storage/Storage';import { WorkloadsSurface } from '@/components/Workloads/WorkloadsSurface';import { ProxmoxIcon } from '@/components/icons/ProxmoxIcon';import { EmptyState } from '@/components/shared/EmptyState';import { TableCard } from '@/components/shared/TableCard';+import { ProxmoxBackupsTable } from './ProxmoxBackupsTable';import { ProxmoxMailGatewayTable } from './ProxmoxMailGatewayTable';+import { ProxmoxReplicationTable } from './ProxmoxReplicationTable';import { useUnifiedResources } from '@/hooks/useUnifiedResources';import {PROXMOX_TAB_SPECS,@@ -148,10 +149,16 @@ export function ProxmoxPageSurface() {/></Show><Show when={activeTab() === 'replication'}>- <RecoverySurface embedded tableOnly forcedPlatformFilter={PROXMOX_PLATFORM_FILTER} />+ <ProxmoxReplicationTable+ emptyIcon={<ProxmoxIcon class="h-6 w-6 text-slate-400" />}+ emptyTitle="No replication jobs"+ emptyDescription="Replication jobs appear here once PVE is configured to replicate guests between nodes."+ /></Show><Show when={activeTab() === 'backups'}>- <RecoverySurface embedded tableOnly forcedPlatformFilter={PROXMOX_PLATFORM_FILTER} />+ <ProxmoxBackupsTable+ emptyIcon={<ProxmoxIcon class="h-6 w-6 text-slate-400" />}+ /></Show><Show when={activeTab() === 'ceph'}><StorageSurfacediff --git a/frontend-modern/src/features/proxmox/ProxmoxReplicationTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxReplicationTable.tsxnew file mode 100644index 0000000000..dece208db2--- /dev/null+++ b/frontend-modern/src/features/proxmox/ProxmoxReplicationTable.tsx@@ -0,0 +1,318 @@+import {+ For,+ Show,+ createMemo,+ createResource,+ createSignal,+ type Component,+ type JSX,+} from 'solid-js';+import ArrowRightIcon from 'lucide-solid/icons/arrow-right';+import { Card } from '@/components/shared/Card';+import { EmptyState } from '@/components/shared/EmptyState';+import { FilterButtonGroup, type FilterOption } from '@/components/shared/FilterButtonGroup';+import { SearchInput } from '@/components/shared/SearchInput';+import { StatusDot } from '@/components/shared/StatusDot';+import type { StatusIndicatorVariant } from '@/utils/status';+import {+ Table,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow,+} from '@/components/shared/Table';+import { apiFetch } from '@/utils/apiClient';+import { formatRelativeTime } from '@/utils/format';+import type { ReplicationJob, ReplicationJobsResponse } from '@/types/api';++// Replication is a Proxmox-specific concept (zfs send/receive scheduled+// between PVE nodes), so this table is bespoke rather than a filtered+// view of any generic resource list. It hits the dedicated+// /api/replication/jobs surface which projects the monitor's+// ReplicationJobsSnapshot without going through the unified-resource+// pipeline.++type ReplicationStatusFilter = 'all' | 'healthy' | 'failed' | 'pending' | 'disabled';++const STATUS_FILTER_OPTIONS: FilterOption<ReplicationStatusFilter>[] = [+ { value: 'all', label: 'All' },+ { value: 'healthy', label: 'Healthy' },+ { value: 'failed', label: 'Failed' },+ { value: 'pending', label: 'Pending' },+ { value: 'disabled', label: 'Disabled' },+];++interface ReplicationStatusIndicator {+ variant: StatusIndicatorVariant;+ label: string;+ tone: string;+}++function classifyJob(job: ReplicationJob): ReplicationStatusFilter {+ if (!job.enabled) return 'disabled';+ if ((job.failCount ?? 0) > 0) return 'failed';+ const last = (job.lastSyncStatus ?? '').toLowerCase();+ if (last === 'ok' || last === 'success' || last === 'completed') return 'healthy';+ if (last === 'failed' || last === 'error') return 'failed';+ return 'pending';+}++function indicatorFor(classification: ReplicationStatusFilter): ReplicationStatusIndicator {+ switch (classification) {+ case 'healthy':+ return { variant: 'success', label: 'Healthy', tone: 'text-emerald-600 dark:text-emerald-300' };+ case 'failed':+ return { variant: 'danger', label: 'Failed', tone: 'text-red-600 dark:text-red-300' };+ case 'pending':+ return { variant: 'warning', label: 'Pending', tone: 'text-amber-600 dark:text-amber-300' };+ case 'disabled':+ return { variant: 'muted', label: 'Disabled', tone: 'text-muted' };+ default:+ return { variant: 'muted', label: '—', tone: 'text-muted' };+ }+}++function formatGuestLabel(job: ReplicationJob): string {+ const guestId = job.guestId ?? 0;+ const name = (job.guestName ?? '').trim();+ if (guestId && name) return `${guestId} (${name})`;+ if (guestId) return String(guestId);+ if (name) return name;+ if (job.guest?.trim()) return job.guest.trim();+ return '—';+}++function formatSyncTime(job: ReplicationJob): string {+ if (job.lastSyncUnix && job.lastSyncUnix > 0) {+ return formatRelativeTime(job.lastSyncUnix * 1000, { compact: true });+ }+ const raw = job.lastSyncTime as number | string | undefined;+ if (raw) return formatRelativeTime(raw, { compact: true });+ return '—';+}++function formatDuration(seconds: number | undefined, human: string | undefined): string {+ const explicit = (human ?? '').trim();+ if (explicit) return explicit;+ if (!seconds || seconds <= 0) return '—';+ if (seconds < 60) return `${seconds}s`;+ if (seconds < 3600) return `${Math.floor(seconds / 60)}m ${seconds % 60}s`;+ const h = Math.floor(seconds / 3600);+ const m = Math.floor((seconds % 3600) / 60);+ return `${h}h ${m}m`;+}++async function fetchReplicationJobs(): Promise<ReplicationJob[]> {+ const response = await apiFetch('/api/replication/jobs?platform=proxmox-pve');+ if (!response.ok) {+ throw new Error(`Failed to load replication jobs (${response.status})`);+ }+ const payload = (await response.json()) as ReplicationJobsResponse;+ return Array.isArray(payload?.data) ? payload.data : [];+}++export const ProxmoxReplicationTable: Component<{+ emptyIcon: JSX.Element;+ emptyTitle: string;+ emptyDescription: string;+}> = (props) => {+ const [jobs, { refetch }] = createResource<ReplicationJob[]>(fetchReplicationJobs);+ const [search, setSearch] = createSignal('');+ const [status, setStatus] = createSignal<ReplicationStatusFilter>('all');++ const filtered = createMemo(() => {+ const term = search().trim().toLowerCase();+ const want = status();+ return (jobs() ?? []).filter((job) => {+ if (want !== 'all' && classifyJob(job) !== want) return false;+ if (!term) return true;+ const haystack = [+ job.jobId,+ job.guest,+ job.guestName,+ job.guestId?.toString() ?? '',+ job.sourceNode,+ job.targetNode,+ job.instance,+ job.lastSyncStatus,+ ]+ .filter(Boolean)+ .join(' ')+ .toLowerCase();+ return haystack.includes(term);+ });+ });++ const total = createMemo(() => (jobs() ?? []).length);+ const visible = createMemo(() => filtered().length);++ return (+ <Show+ when={!jobs.error}+ fallback={+ <Card padding="lg">+ <EmptyState+ icon={props.emptyIcon}+ title="Could not load replication jobs"+ description={(jobs.error as Error | undefined)?.message ?? 'Refresh to retry.'}+ actions={+ <button+ type="button"+ onClick={() => void refetch()}+ class="inline-flex min-h-10 items-center rounded-md border border-border px-3 py-2 text-sm font-medium hover:bg-surface-hover"+ >+ Refresh+ </button>+ }+ />+ </Card>+ }+ >+ <Show+ when={jobs() !== undefined}+ fallback={+ <Card padding="lg">+ <EmptyState+ icon={props.emptyIcon}+ title="Loading replication jobs"+ description="Reading scheduled replication state from PVE."+ />+ </Card>+ }+ >+ <Show+ when={total() > 0}+ fallback={+ <Card padding="lg">+ <EmptyState+ icon={props.emptyIcon}+ title={props.emptyTitle}+ description={props.emptyDescription}+ />+ </Card>+ }+ >+ <div class="space-y-3">+ <div class="flex flex-wrap items-center gap-2">+ <div class="min-w-[200px] flex-1 sm:max-w-xs">+ <SearchInput+ value={search}+ onChange={setSearch}+ placeholder="Search jobs, guests, nodes"+ />+ </div>+ <FilterButtonGroup+ options={STATUS_FILTER_OPTIONS}+ value={status()}+ onChange={setStatus}+ />+ <span class="ml-auto whitespace-nowrap text-xs font-medium text-muted">+ <Show when={visible() !== total()} fallback={<>{total()} jobs</>}>+ {visible()} of {total()} jobs+ </Show>+ </span>+ </div>++ <Show+ when={filtered().length > 0}+ fallback={+ <Card padding="lg">+ <EmptyState+ icon={props.emptyIcon}+ title="No replication jobs match current filters"+ description="Adjust the search or status filter to see more jobs."+ />+ </Card>+ }+ >+ <Card padding="none" tone="card" class="overflow-hidden">+ <Table class="w-full min-w-[1100px] border-collapse text-xs">+ <TableHeader class="bg-surface-alt text-muted border-b border-border">+ <TableRow class="text-left text-[10px] uppercase tracking-wide">+ <TableHead class="px-3 py-2 font-medium">Status</TableHead>+ <TableHead class="px-3 py-2 font-medium">Job</TableHead>+ <TableHead class="px-3 py-2 font-medium">Guest</TableHead>+ <TableHead class="px-3 py-2 font-medium">Source → Target</TableHead>+ <TableHead class="px-3 py-2 font-medium">Schedule</TableHead>+ <TableHead class="px-3 py-2 font-medium">Last sync</TableHead>+ <TableHead class="px-3 py-2 font-medium">Duration</TableHead>+ <TableHead class="px-3 py-2 font-medium text-right">Fail count</TableHead>+ <TableHead class="px-3 py-2 font-medium">Error</TableHead>+ </TableRow>+ </TableHeader>+ <TableBody class="divide-y divide-border-subtle">+ <For each={filtered()}>+ {(job) => {+ const classification = classifyJob(job);+ const ind = indicatorFor(classification);+ const sourceNode = (job.sourceNode ?? '').trim() || '—';+ const targetNode = (job.targetNode ?? '').trim() || '—';+ return (+ <TableRow class="hover:bg-surface-hover">+ <TableCell class="px-3 py-2">+ <div class="flex items-center gap-2">+ <StatusDot+ size="sm"+ variant={ind.variant}+ title={ind.label}+ ariaHidden+ />+ <span class={`text-[11px] font-medium ${ind.tone}`}>{ind.label}</span>+ </div>+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content font-mono text-[11px]">+ <span title={job.id}>{job.jobId || job.id}</span>+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content">{formatGuestLabel(job)}</TableCell>+ <TableCell class="px-3 py-2 text-base-content">+ <span class="inline-flex items-center gap-1 font-mono text-[11px]">+ <span>{sourceNode}</span>+ <ArrowRightIcon class="h-3 w-3 text-muted" aria-hidden="true" />+ <span>{targetNode}</span>+ </span>+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content font-mono text-[11px]">+ {job.schedule || '—'}+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content">{formatSyncTime(job)}</TableCell>+ <TableCell class="px-3 py-2 text-base-content">+ {formatDuration(job.lastSyncDurationSeconds, job.lastSyncDurationHuman)}+ </TableCell>+ <TableCell class="px-3 py-2 text-right text-base-content tabular-nums">+ <Show+ when={(job.failCount ?? 0) > 0}+ fallback={<span class="text-muted">0</span>}+ >+ <span class="text-red-600 dark:text-red-300 font-semibold">{job.failCount}</span>+ </Show>+ </TableCell>+ <TableCell class="px-3 py-2 text-base-content">+ <Show+ when={!!job.error?.trim()}+ fallback={<span class="text-muted">—</span>}+ >+ <span+ class="inline-block max-w-[18rem] truncate text-red-600 dark:text-red-300"+ title={job.error ?? ''}+ >+ {job.error}+ </span>+ </Show>+ </TableCell>+ </TableRow>+ );+ }}+ </For>+ </TableBody>+ </Table>+ </Card>+ </Show>+ </div>+ </Show>+ </Show>+ </Show>+ );+};++export default ProxmoxReplicationTable;diff --git a/frontend-modern/src/types/api.ts b/frontend-modern/src/types/api.tsindex 7f64c1d515..06983585e2 100644--- a/frontend-modern/src/types/api.ts+++ b/frontend-modern/src/types/api.ts@@ -599,6 +599,72 @@ export interface ReplicationJob {polledAt?: number;}+export interface ReplicationJobsResponse {+ data: ReplicationJob[];+ meta: { total: number };+}++export interface BackupTask {+ id: string;+ node: string;+ instance: string;+ type: string;+ vmid: number;+ status: string;+ startTime: string;+ endTime?: string;+ size?: number;+ error?: string;+}++export interface StorageBackup {+ id: string;+ storage: string;+ node: string;+ instance: string;+ type: string;+ vmid: number;+ time: string;+ ctime: number;+ size: number;+ format: string;+ notes?: string;+ protected: boolean;+ volid: string;+ isPBS: boolean;+ verified: boolean;+ verification?: string;+}++export interface GuestSnapshot {+ id: string;+ name: string;+ node: string;+ instance: string;+ type: string;+ vmid: number;+ time: string;+ description?: string;+ parent?: string;+ vmstate: boolean;+ sizeBytes?: number;+}++export interface PVEBackupsPayload {+ backupTasks: BackupTask[];+ storageBackups: StorageBackup[];+ guestSnapshots: GuestSnapshot[];+}++export interface PVEBackupsResponse {+ data: PVEBackupsPayload;+ meta: {+ totalBackupTasks: number;+ totalStorageBackups: number;+ totalGuestSnapshots: number;+ };+}+export interface Storage {id: string;name: string;diff --git a/internal/api/pve_backups.go b/internal/api/pve_backups.gonew file mode 100644index 0000000000..849b5be99f--- /dev/null+++ b/internal/api/pve_backups.go@@ -0,0 +1,144 @@+package api++import (+ "net/http"+ "strconv"+ "strings"++ "github.com/rs/zerolog/log"++ "github.com/rcourtman/pulse-go-rewrite/internal/config"+ "github.com/rcourtman/pulse-go-rewrite/internal/models"+ "github.com/rcourtman/pulse-go-rewrite/internal/utils"+)++// PVEBackupsResponse is the canonical payload for+// `GET /api/backups/pve`. It exposes the three Proxmox VE backup+// classes — recent vzdump tasks, vzdump files on storage, and+// qm/pct snapshots — that were previously only carried inside the+// internal `State` snapshot and were never reachable through a v6+// API surface. The Proxmox platform-page Backups tab is the first+// consumer; PBS-resident backups remain on their own platform page.+type PVEBackupsResponse struct {+ Data PVEBackupsPayload `json:"data"`+ Meta PVEBackupsMeta `json:"meta"`+}++type PVEBackupsPayload struct {+ BackupTasks []models.BackupTask `json:"backupTasks"`+ StorageBackups []models.StorageBackup `json:"storageBackups"`+ GuestSnapshots []models.GuestSnapshot `json:"guestSnapshots"`+}++type PVEBackupsMeta struct {+ TotalBackupTasks int `json:"totalBackupTasks"`+ TotalStorageBackups int `json:"totalStorageBackups"`+ TotalGuestSnapshots int `json:"totalGuestSnapshots"`+}++func (r *Router) handleListPVEBackups(w http.ResponseWriter, req *http.Request) {+ if req.Method != http.MethodGet {+ writeErrorResponse(w, http.StatusMethodNotAllowed, "method_not_allowed",+ "Only GET method is allowed", nil)+ return+ }++ monitor := r.getTenantMonitor(req.Context())+ if monitor == nil {+ writeErrorResponse(w, http.StatusInternalServerError, "no_monitor",+ "Monitor not available", nil)+ return+ }++ backups := monitor.PVEBackupsSnapshot()+ payload := filterPVEBackups(backups, req)++ response := PVEBackupsResponse{+ Data: payload,+ Meta: PVEBackupsMeta{+ TotalBackupTasks: len(payload.BackupTasks),+ TotalStorageBackups: len(payload.StorageBackups),+ TotalGuestSnapshots: len(payload.GuestSnapshots),+ },+ }++ if err := utils.WriteJSONResponse(w, response); err != nil {+ log.Error().Err(err).Msg("Failed to encode PVE backups response")+ writeErrorResponse(w, http.StatusInternalServerError, "encoding_error",+ "Failed to encode PVE backups", nil)+ }+}++// filterPVEBackups narrows the three backup classes by optional query+// params:+//+// instance=<name> — only entries reported by a given PVE instance+// node=<name> — only entries scheduled on a given node+// vmid=<id> — only entries that match a guest VMID+func filterPVEBackups(backups models.PVEBackups, req *http.Request) PVEBackupsPayload {+ query := req.URL.Query()+ instance := strings.TrimSpace(query.Get("instance"))+ node := strings.TrimSpace(query.Get("node"))+ vmid := strings.TrimSpace(query.Get("vmid"))++ out := PVEBackupsPayload{+ BackupTasks: backups.BackupTasks,+ StorageBackups: backups.StorageBackups,+ GuestSnapshots: backups.GuestSnapshots,+ }++ if instance == "" && node == "" && vmid == "" {+ return out+ }++ tasks := make([]models.BackupTask, 0, len(out.BackupTasks))+ for _, task := range out.BackupTasks {+ if instance != "" && !strings.EqualFold(task.Instance, instance) {+ continue+ }+ if node != "" && !strings.EqualFold(task.Node, node) {+ continue+ }+ if vmid != "" && strconv.Itoa(task.VMID) != vmid {+ continue+ }+ tasks = append(tasks, task)+ }+ out.BackupTasks = tasks++ stored := make([]models.StorageBackup, 0, len(out.StorageBackups))+ for _, sb := range out.StorageBackups {+ if instance != "" && !strings.EqualFold(sb.Instance, instance) {+ continue+ }+ if node != "" && !strings.EqualFold(sb.Node, node) {+ continue+ }+ if vmid != "" && strconv.Itoa(sb.VMID) != vmid {+ continue+ }+ stored = append(stored, sb)+ }+ out.StorageBackups = stored++ snaps := make([]models.GuestSnapshot, 0, len(out.GuestSnapshots))+ for _, snap := range out.GuestSnapshots {+ if instance != "" && !strings.EqualFold(snap.Instance, instance) {+ continue+ }+ if node != "" && !strings.EqualFold(snap.Node, node) {+ continue+ }+ if vmid != "" && strconv.Itoa(snap.VMID) != vmid {+ continue+ }+ snaps = append(snaps, snap)+ }+ out.GuestSnapshots = snaps++ return out+}++func (r *Router) registerPVEBackupsRoutes() {+ r.mux.HandleFunc("/api/backups/pve", RequireAuth(r.config, RequireScope(config.ScopeMonitoringRead, r.handleListPVEBackups)))+}diff --git a/internal/api/replication.go b/internal/api/replication.gonew file mode 100644index 0000000000..8d5cb78092--- /dev/null+++ b/internal/api/replication.go@@ -0,0 +1,114 @@+package api++import (+ "net/http"+ "strconv"+ "strings"++ "github.com/rs/zerolog/log"++ "github.com/rcourtman/pulse-go-rewrite/internal/config"+ "github.com/rcourtman/pulse-go-rewrite/internal/models"+ "github.com/rcourtman/pulse-go-rewrite/internal/utils"+)++// ReplicationJobsResponse is the canonical payload for+// `GET /api/replication/jobs`. Replication jobs are zfs send/receive+// jobs scheduled between Proxmox VE nodes; they are tracked on the+// monitor's `State.ReplicationJobs` slice but were not previously+// exposed through any v6 API surface. The Proxmox platform-page+// Replication tab is the first consumer.+type ReplicationJobsResponse struct {+ Data []models.ReplicationJob `json:"data"`+ Meta ReplicationJobsMeta `json:"meta"`+}++type ReplicationJobsMeta struct {+ Total int `json:"total"`+}++func (r *Router) handleListReplicationJobs(w http.ResponseWriter, req *http.Request) {+ if req.Method != http.MethodGet {+ writeErrorResponse(w, http.StatusMethodNotAllowed, "method_not_allowed",+ "Only GET method is allowed", nil)+ return+ }++ monitor := r.getTenantMonitor(req.Context())+ if monitor == nil {+ writeErrorResponse(w, http.StatusInternalServerError, "no_monitor",+ "Monitor not available", nil)+ return+ }++ jobs := monitor.ReplicationJobsSnapshot()+ filtered := filterReplicationJobs(jobs, req)++ response := ReplicationJobsResponse{+ Data: filtered,+ Meta: ReplicationJobsMeta{Total: len(filtered)},+ }++ if err := utils.WriteJSONResponse(w, response); err != nil {+ log.Error().Err(err).Msg("Failed to encode replication jobs response")+ writeErrorResponse(w, http.StatusInternalServerError, "encoding_error",+ "Failed to encode replication jobs", nil)+ }+}++// filterReplicationJobs narrows the snapshot by optional query params:+//+// platform=proxmox-pve|proxmox|pve — only PVE jobs (the only emitter today)+// instance=<name> — only jobs from a given PVE instance+// guest=<id-or-name> — only jobs scheduled for a guest+//+// Unknown platform tokens return an empty list rather than the whole+// dataset so caller typos don't silently hide a mismatch.+func filterReplicationJobs(jobs []models.ReplicationJob, req *http.Request) []models.ReplicationJob {+ query := req.URL.Query()+ platform := strings.TrimSpace(query.Get("platform"))+ instance := strings.TrimSpace(query.Get("instance"))+ guest := strings.TrimSpace(strings.ToLower(query.Get("guest")))++ if platform == "" && instance == "" && guest == "" {+ out := make([]models.ReplicationJob, len(jobs))+ copy(out, jobs)+ return out+ }++ if platform != "" {+ switch strings.ToLower(platform) {+ case "proxmox", "proxmox-pve", "pve":+ default:+ return []models.ReplicationJob{}+ }+ }++ out := make([]models.ReplicationJob, 0, len(jobs))+ for _, job := range jobs {+ if instance != "" && !strings.EqualFold(strings.TrimSpace(job.Instance), instance) {+ continue+ }+ if guest != "" {+ match := false+ if job.GuestID != 0 && strconv.Itoa(job.GuestID) == guest {+ match = true+ }+ if !match && strings.EqualFold(strings.TrimSpace(job.GuestName), guest) {+ match = true+ }+ if !match && strings.EqualFold(strings.TrimSpace(job.Guest), guest) {+ match = true+ }+ if !match {+ continue+ }+ }+ out = append(out, job)+ }+ return out+}++func (r *Router) registerReplicationRoutes() {+ r.mux.HandleFunc("/api/replication/jobs", RequireAuth(r.config, RequireScope(config.ScopeMonitoringRead, r.handleListReplicationJobs)))+}diff --git a/internal/api/router_routes_monitoring.go b/internal/api/router_routes_monitoring.goindex 6e6cc8a411..c861662f24 100644--- a/internal/api/router_routes_monitoring.go+++ b/internal/api/router_routes_monitoring.go@@ -27,6 +27,8 @@ func (r *Router) registerMonitoringResourceRoutes(r.mux.HandleFunc("/api/recovery/series", RequireAuth(r.config, RequireScope(config.ScopeMonitoringRead, r.recoveryHandlers.HandleListSeries)))r.mux.HandleFunc("/api/recovery/facets", RequireAuth(r.config, RequireScope(config.ScopeMonitoringRead, r.recoveryHandlers.HandleListFacets)))r.mux.HandleFunc("/api/recovery/rollups", RequireAuth(r.config, RequireScope(config.ScopeMonitoringRead, r.recoveryHandlers.HandleListRollups)))+ r.registerReplicationRoutes()+ r.registerPVEBackupsRoutes()// Unified resources APIr.mux.HandleFunc("/api/resources", RequireAuth(r.config, RequireScope(config.ScopeMonitoringRead, r.resourceHandlers.HandleListResources)))