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
refactor(proxmox): extract pure model from ProxmoxBackupsTable
rcourtmandbeb49b46011
diff --git a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsxindex 2686b60e21..1732ad3335 100644--- a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx+++ b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx@@ -86,6 +86,34 @@ import {type RecoverableArtifact,type WorkloadCoverageRow,} from './proxmoxBackupRecoveryModel';+import {+ ARCHIVE_SORT_DEFAULT_DIRECTION,+ COVERAGE_SORT_DEFAULT_DIRECTION,+ PBS_SORT_DEFAULT_DIRECTION,+ RECOVERABLE_SORT_DEFAULT_DIRECTION,+ SNAPSHOT_SORT_DEFAULT_DIRECTION,+ TASK_SORT_DEFAULT_DIRECTION,+ classifyTaskStatus,+ cmpBool,+ cmpNumber,+ cmpString,+ formatDuration,+ formatDurationFromSeconds,+ guestLabel,+ pbsRepositoryLabel,+ pbsWorkloadLabel,+ type ArchiveSortKey,+ type BackupTabId,+ type CoverageFilterValue,+ type CoverageSortKey,+ type PBSSortKey,+ type RecoverableFilterValue,+ type RecoverableSortKey,+ type SnapshotFilterValue,+ type SnapshotSortKey,+ type SourceDetailTabId,+ type TaskSortKey,+} from './proxmoxBackupsTableModel';import { ProxmoxBackupsCoverageStrip } from './ProxmoxBackupsCoverageStrip';// Proxmox backups are intentionally organized around operator questions, not@@ -96,9 +124,6 @@ import { ProxmoxBackupsCoverageStrip } from './ProxmoxBackupsCoverageStrip';// implementation-specific tables equal-weight primary destinations.// - Job history shows whether backup jobs are actually running successfully.-type BackupTabId = 'coverage' | 'recoverable' | 'sources' | 'tasks';-type SourceDetailTabId = 'pbs' | 'snapshots' | 'archives';-interface BackupTabSpec {id: BackupTabId;label: string;@@ -181,66 +206,6 @@ function sourceDetailSpecFor(id: SourceDetailTabId): SourceDetailTabSpec {// Replication colours the per-row status word to match its dot (emerald// text for Healthy, red for Failed, etc.). Mirror that here so the// Recent tasks STATUS column reads the same way — dot + same-tone word.-function classifyTaskStatus(status: string): {- variant: StatusIndicatorVariant;- label: string;- toneClass: string;-} {- const normalized = (status ?? '').toLowerCase();- if (normalized === 'ok' || normalized === 'success' || normalized === 'completed') {- return {- variant: 'success',- label: 'OK',- toneClass: 'text-emerald-600 dark:text-emerald-300',- };- }- if (normalized === 'running') {- return {- variant: 'warning',- label: 'Running',- toneClass: 'text-amber-600 dark:text-amber-300',- };- }- if (normalized === 'failed' || normalized === 'error') {- return { variant: 'danger', label: 'Failed', toneClass: 'text-red-600 dark:text-red-300' };- }- if (!normalized) return { variant: 'muted', label: '—', toneClass: 'text-muted' };- return { variant: 'muted', label: status, toneClass: 'text-muted' };-}--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 pbsWorkloadLabel(backup: PBSBackup): string {- const t = (backup.backupType ?? '').toLowerCase();- if (t === 'ct') return `CT ${backup.vmid}`;- if (t === 'vm') return `VM ${backup.vmid}`;- if (t === 'host') return backup.vmid ? `Host ${backup.vmid}` : 'Host';- const kind = backup.backupType?.trim().toUpperCase() || 'Backup';- return backup.vmid ? `${kind} ${backup.vmid}` : kind;-}--function pbsRepositoryLabel(backup: PBSBackup): string {- const namespace = backup.namespace?.trim() || '(root)';- return `${backup.datastore || '—'} / ${namespace}`;-}--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) {@@ -288,8 +253,6 @@ const TASK_STATUS_FILTERS: FilterOption<'all' | 'ok' | 'failed' | 'running'>[] ={ value: 'running', label: 'Running', tone: 'info', leading: statusDot('bg-blue-500') },];-type CoverageFilterValue = 'all' | 'attention' | 'current' | 'uncovered';-const COVERAGE_FILTERS: FilterOption<CoverageFilterValue>[] = [{ value: 'all', label: 'All' },{ value: 'attention', label: 'Attention', tone: 'warning', leading: statusDot('bg-amber-500') },@@ -297,8 +260,6 @@ const COVERAGE_FILTERS: FilterOption<CoverageFilterValue>[] = [{ value: 'uncovered', label: 'Uncovered', tone: 'danger', leading: statusDot('bg-red-500') },];-type RecoverableFilterValue = 'all' | 'pbs' | 'archive' | 'snapshot' | 'verified' | 'unverified';-const RECOVERABLE_FILTERS: FilterOption<RecoverableFilterValue>[] = [{ value: 'all', label: 'All' },{ value: 'pbs', label: 'PBS', tone: 'info', leading: statusDot('bg-cyan-500') },@@ -308,8 +269,6 @@ const RECOVERABLE_FILTERS: FilterOption<RecoverableFilterValue>[] = [{ value: 'unverified', label: 'Unverified', tone: 'warning', leading: statusDot('bg-amber-500') },];-type SnapshotFilterValue = 'all' | 'recent' | 'stale' | 'with-ram';-const SNAPSHOT_FILTERS: FilterOption<SnapshotFilterValue>[] = [{ value: 'all', label: 'All' },{@@ -332,16 +291,6 @@ const SNAPSHOT_FILTERS: FilterOption<SnapshotFilterValue>[] = [},];-function formatDurationFromSeconds(seconds: number): string {- if (!Number.isFinite(seconds) || seconds <= 0) return '—';- const rounded = Math.round(seconds);- if (rounded < 60) return `${rounded}s`;- if (rounded < 3600) return `${Math.floor(rounded / 60)}m ${rounded % 60}s`;- const h = Math.floor(rounded / 3600);- const m = Math.floor((rounded % 3600) / 60);- return `${h}h ${m}m`;-}-// Canonical row metric bar — same shape as Storage's usage bar, Ceph's// pool usage bar, and Workloads' MetricBar: a full-cell-width// ProgressBar with the value text overlaid on top of the fill. The@@ -514,116 +463,6 @@ function SortableHead<K extends string>(props: {// to the end regardless of direction — flipping a "—" row to the top of a// desc sort is never what the user wants (e.g. a running task with no// finished duration should not headline a "slowest tasks" view).-function cmpString(- a: string | undefined,- b: string | undefined,- direction: 'asc' | 'desc',-): number {- const av = (a ?? '').toLowerCase();- const bv = (b ?? '').toLowerCase();- if (!av && !bv) return 0;- if (!av) return 1;- if (!bv) return -1;- const cmp = av === bv ? 0 : av < bv ? -1 : 1;- return direction === 'asc' ? cmp : -cmp;-}--function cmpNumber(- a: number | undefined,- b: number | undefined,- direction: 'asc' | 'desc',-): number {- const av = typeof a === 'number' && Number.isFinite(a) ? a : undefined;- const bv = typeof b === 'number' && Number.isFinite(b) ? b : undefined;- if (av === undefined && bv === undefined) return 0;- if (av === undefined) return 1;- if (bv === undefined) return -1;- const cmp = av - bv;- return direction === 'asc' ? cmp : -cmp;-}--function cmpBool(a: boolean, b: boolean, direction: 'asc' | 'desc'): number {- const cmp = (a ? 1 : 0) - (b ? 1 : 0);- return direction === 'asc' ? cmp : -cmp;-}--// Per-tab sort key types and their default directions. Numeric / timestamp-// columns default to `desc` (biggest / newest first) since that's the-// sysadmin-default question on a backup page. String columns default to-// `asc` (A→Z). Boolean columns default to `desc` so "true" sorts first.--type CoverageSortKey = 'posture' | 'workload' | 'latest' | 'pbs' | 'archive' | 'snapshot' | 'task';-const COVERAGE_SORT_DEFAULT_DIRECTION: Record<CoverageSortKey, 'asc' | 'desc'> = {- posture: 'asc',- workload: 'asc',- latest: 'desc',- pbs: 'desc',- archive: 'desc',- snapshot: 'desc',- task: 'desc',-};--type RecoverableSortKey = 'workload' | 'source' | 'location' | 'created' | 'size' | 'state';-const RECOVERABLE_SORT_DEFAULT_DIRECTION: Record<RecoverableSortKey, 'asc' | 'desc'> = {- workload: 'asc',- source: 'asc',- location: 'asc',- created: 'desc',- size: 'desc',- state: 'asc',-};--type PBSSortKey = 'workload' | 'repository' | 'created' | 'size' | 'protected' | 'verified';-const PBS_SORT_DEFAULT_DIRECTION: Record<PBSSortKey, 'asc' | 'desc'> = {- workload: 'asc',- repository: 'asc',- created: 'desc',- size: 'desc',- protected: 'desc',- verified: 'desc',-};--type SnapshotSortKey = 'guest' | 'node' | 'latest' | 'count' | 'size';-const SNAPSHOT_SORT_DEFAULT_DIRECTION: Record<SnapshotSortKey, 'asc' | 'desc'> = {- guest: 'asc',- node: 'asc',- latest: 'desc',- count: 'desc',- size: 'desc',-};--type ArchiveSortKey =- | 'volume'- | 'guest'- | 'storage'- | 'node'- | 'format'- | 'created'- | 'size'- | 'protected'- | 'verified';-const ARCHIVE_SORT_DEFAULT_DIRECTION: Record<ArchiveSortKey, 'asc' | 'desc'> = {- volume: 'asc',- guest: 'asc',- storage: 'asc',- node: 'asc',- format: 'asc',- created: 'desc',- size: 'desc',- protected: 'desc',- verified: 'desc',-};--type TaskSortKey = 'status' | 'guest' | 'node' | 'started' | 'duration' | 'size';-const TASK_SORT_DEFAULT_DIRECTION: Record<TaskSortKey, 'asc' | 'desc'> = {- status: 'asc',- guest: 'asc',- node: 'asc',- started: 'desc',- duration: 'desc',- size: 'desc',-};-export const ProxmoxBackupsTable: Component<{emptyIcon: JSX.Element;hasPBS?: boolean;diff --git a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupsTableModel.test.ts b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupsTableModel.test.tsnew file mode 100644index 0000000000..b29b1ffa44--- /dev/null+++ b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupsTableModel.test.ts@@ -0,0 +1,113 @@+import { describe, expect, it } from 'vitest';++import type { PBSBackup } from '@/types/api';++import {+ ARCHIVE_SORT_DEFAULT_DIRECTION,+ COVERAGE_SORT_DEFAULT_DIRECTION,+ PBS_SORT_DEFAULT_DIRECTION,+ RECOVERABLE_SORT_DEFAULT_DIRECTION,+ SNAPSHOT_SORT_DEFAULT_DIRECTION,+ TASK_SORT_DEFAULT_DIRECTION,+ classifyTaskStatus,+ cmpBool,+ cmpNumber,+ cmpString,+ formatDuration,+ formatDurationFromSeconds,+ guestLabel,+ pbsRepositoryLabel,+ pbsWorkloadLabel,+} from '../proxmoxBackupsTableModel';++const pbs = (overrides: Partial<PBSBackup>): PBSBackup => overrides as PBSBackup;++describe('proxmoxBackupsTableModel', () => {+ describe('classifyTaskStatus', () => {+ it('maps known statuses to variants and labels', () => {+ expect(classifyTaskStatus('ok')).toMatchObject({ variant: 'success', label: 'OK' });+ expect(classifyTaskStatus('SUCCESS')).toMatchObject({ variant: 'success', label: 'OK' });+ expect(classifyTaskStatus('running')).toMatchObject({ variant: 'warning', label: 'Running' });+ expect(classifyTaskStatus('error')).toMatchObject({ variant: 'danger', label: 'Failed' });+ });++ it('falls back to muted for empty or unknown statuses', () => {+ expect(classifyTaskStatus('')).toMatchObject({ variant: 'muted', label: '—' });+ expect(classifyTaskStatus('paused')).toMatchObject({ variant: 'muted', label: 'paused' });+ });+ });++ describe('label helpers', () => {+ it('formats guest labels by type', () => {+ expect(guestLabel('ct', 101)).toBe('CT 101');+ expect(guestLabel('vm', 202)).toBe('VM 202');+ expect(guestLabel(undefined, 303)).toBe('Guest 303');+ });++ it('formats PBS workload labels including host backups', () => {+ expect(pbsWorkloadLabel(pbs({ backupType: 'ct', vmid: '101' }))).toBe('CT 101');+ expect(pbsWorkloadLabel(pbs({ backupType: 'vm', vmid: '202' }))).toBe('VM 202');+ expect(pbsWorkloadLabel(pbs({ backupType: 'host', vmid: '' }))).toBe('Host');+ expect(pbsWorkloadLabel(pbs({ backupType: 'host', vmid: '9' }))).toBe('Host 9');+ });++ it('formats PBS repository labels with a root namespace fallback', () => {+ expect(pbsRepositoryLabel(pbs({ datastore: 'main', namespace: 'team' }))).toBe('main / team');+ expect(pbsRepositoryLabel(pbs({ datastore: 'main' }))).toBe('main / (root)');+ });+ });++ describe('duration formatting', () => {+ it('formats start/end pairs and rejects invalid ranges', () => {+ expect(formatDuration('2026-01-01T00:00:00Z', '2026-01-01T00:00:45Z')).toBe('45s');+ expect(formatDuration('2026-01-01T00:00:00Z', '2026-01-01T00:02:05Z')).toBe('2m 5s');+ expect(formatDuration('2026-01-01T00:00:00Z', '2026-01-01T01:30:00Z')).toBe('1h 30m');+ expect(formatDuration(undefined, '2026-01-01T00:00:45Z')).toBe('—');+ expect(formatDuration('2026-01-01T00:01:00Z', '2026-01-01T00:00:00Z')).toBe('—');+ });++ it('formats raw seconds', () => {+ expect(formatDurationFromSeconds(0)).toBe('—');+ expect(formatDurationFromSeconds(45)).toBe('45s');+ expect(formatDurationFromSeconds(125)).toBe('2m 5s');+ expect(formatDurationFromSeconds(5400)).toBe('1h 30m');+ });+ });++ describe('comparators', () => {+ it('sorts strings case-insensitively and pushes blanks last', () => {+ expect(cmpString('alpha', 'beta', 'asc')).toBeLessThan(0);+ expect(cmpString('alpha', 'beta', 'desc')).toBeGreaterThan(0);+ expect(cmpString('Zeta', 'alpha', 'asc')).toBeGreaterThan(0);+ expect(cmpString('', 'alpha', 'asc')).toBe(1);+ expect(cmpString('alpha', '', 'asc')).toBe(-1);+ });++ it('sorts numbers and pushes missing values last regardless of direction', () => {+ expect(cmpNumber(1, 2, 'asc')).toBeLessThan(0);+ expect(cmpNumber(1, 2, 'desc')).toBeGreaterThan(0);+ expect(cmpNumber(undefined, 5, 'asc')).toBe(1);+ expect(cmpNumber(undefined, 5, 'desc')).toBe(1);+ expect(cmpNumber(Number.NaN, 5, 'asc')).toBe(1);+ });++ it('sorts booleans with true first when descending', () => {+ // Negative means the first arg sorts ahead. desc => true ahead of false.+ expect(cmpBool(true, false, 'desc')).toBeLessThan(0);+ expect(cmpBool(true, false, 'asc')).toBeGreaterThan(0);+ expect(cmpBool(true, true, 'asc')).toBe(0);+ });+ });++ describe('default sort directions', () => {+ it('defaults numeric/timestamp columns to desc and string columns to asc', () => {+ expect(COVERAGE_SORT_DEFAULT_DIRECTION.workload).toBe('asc');+ expect(COVERAGE_SORT_DEFAULT_DIRECTION.latest).toBe('desc');+ expect(RECOVERABLE_SORT_DEFAULT_DIRECTION.size).toBe('desc');+ expect(PBS_SORT_DEFAULT_DIRECTION.verified).toBe('desc');+ expect(SNAPSHOT_SORT_DEFAULT_DIRECTION.guest).toBe('asc');+ expect(ARCHIVE_SORT_DEFAULT_DIRECTION.created).toBe('desc');+ expect(TASK_SORT_DEFAULT_DIRECTION.started).toBe('desc');+ });+ });+});diff --git a/frontend-modern/src/features/proxmox/proxmoxBackupsTableModel.ts b/frontend-modern/src/features/proxmox/proxmoxBackupsTableModel.tsnew file mode 100644index 0000000000..952cce8f7b--- /dev/null+++ b/frontend-modern/src/features/proxmox/proxmoxBackupsTableModel.ts@@ -0,0 +1,208 @@+import type { PBSBackup } from '@/types/api';+import type { StatusIndicatorVariant } from '@/utils/status';++// Pure model logic for ProxmoxBackupsTable: tab identifiers, per-tab sort-key+// types and their default directions, sort comparators, and workload/label/+// duration formatting. Kept JSX-free so it can be unit-tested in isolation and+// shared by the table's sub-view components. The reactive memos, filter+// toolbars, and rendering stay in ProxmoxBackupsTable.tsx.++export type BackupTabId = 'coverage' | 'recoverable' | 'sources' | 'tasks';+export type SourceDetailTabId = 'pbs' | 'snapshots' | 'archives';++export type CoverageFilterValue = 'all' | 'attention' | 'current' | 'uncovered';+export type RecoverableFilterValue =+ | 'all'+ | 'pbs'+ | 'archive'+ | 'snapshot'+ | 'verified'+ | 'unverified';+export type SnapshotFilterValue = 'all' | 'recent' | 'stale' | 'with-ram';++export function classifyTaskStatus(status: string): {+ variant: StatusIndicatorVariant;+ label: string;+ toneClass: string;+} {+ const normalized = (status ?? '').toLowerCase();+ if (normalized === 'ok' || normalized === 'success' || normalized === 'completed') {+ return {+ variant: 'success',+ label: 'OK',+ toneClass: 'text-emerald-600 dark:text-emerald-300',+ };+ }+ if (normalized === 'running') {+ return {+ variant: 'warning',+ label: 'Running',+ toneClass: 'text-amber-600 dark:text-amber-300',+ };+ }+ if (normalized === 'failed' || normalized === 'error') {+ return { variant: 'danger', label: 'Failed', toneClass: 'text-red-600 dark:text-red-300' };+ }+ if (!normalized) return { variant: 'muted', label: '—', toneClass: 'text-muted' };+ return { variant: 'muted', label: status, toneClass: 'text-muted' };+}++export 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}`;+}++export function pbsWorkloadLabel(backup: PBSBackup): string {+ const t = (backup.backupType ?? '').toLowerCase();+ if (t === 'ct') return `CT ${backup.vmid}`;+ if (t === 'vm') return `VM ${backup.vmid}`;+ if (t === 'host') return backup.vmid ? `Host ${backup.vmid}` : 'Host';+ const kind = backup.backupType?.trim().toUpperCase() || 'Backup';+ return backup.vmid ? `${kind} ${backup.vmid}` : kind;+}++export function pbsRepositoryLabel(backup: PBSBackup): string {+ const namespace = backup.namespace?.trim() || '(root)';+ return `${backup.datastore || '—'} / ${namespace}`;+}++export 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`;+}++export function formatDurationFromSeconds(seconds: number): string {+ if (!Number.isFinite(seconds) || seconds <= 0) return '—';+ const rounded = Math.round(seconds);+ if (rounded < 60) return `${rounded}s`;+ if (rounded < 3600) return `${Math.floor(rounded / 60)}m ${rounded % 60}s`;+ const h = Math.floor(rounded / 3600);+ const m = Math.floor((rounded % 3600) / 60);+ return `${h}h ${m}m`;+}++export function cmpString(+ a: string | undefined,+ b: string | undefined,+ direction: 'asc' | 'desc',+): number {+ const av = (a ?? '').toLowerCase();+ const bv = (b ?? '').toLowerCase();+ if (!av && !bv) return 0;+ if (!av) return 1;+ if (!bv) return -1;+ const cmp = av === bv ? 0 : av < bv ? -1 : 1;+ return direction === 'asc' ? cmp : -cmp;+}++export function cmpNumber(+ a: number | undefined,+ b: number | undefined,+ direction: 'asc' | 'desc',+): number {+ const av = typeof a === 'number' && Number.isFinite(a) ? a : undefined;+ const bv = typeof b === 'number' && Number.isFinite(b) ? b : undefined;+ if (av === undefined && bv === undefined) return 0;+ if (av === undefined) return 1;+ if (bv === undefined) return -1;+ const cmp = av - bv;+ return direction === 'asc' ? cmp : -cmp;+}++export function cmpBool(a: boolean, b: boolean, direction: 'asc' | 'desc'): number {+ const cmp = (a ? 1 : 0) - (b ? 1 : 0);+ return direction === 'asc' ? cmp : -cmp;+}++// Per-tab sort key types and their default directions. Numeric / timestamp+// columns default to `desc` (biggest / newest first) since that's the+// sysadmin-default question on a backup page. String columns default to+// `asc` (A→Z). Boolean columns default to `desc` so "true" sorts first.++export type CoverageSortKey =+ | 'posture'+ | 'workload'+ | 'latest'+ | 'pbs'+ | 'archive'+ | 'snapshot'+ | 'task';+export const COVERAGE_SORT_DEFAULT_DIRECTION: Record<CoverageSortKey, 'asc' | 'desc'> = {+ posture: 'asc',+ workload: 'asc',+ latest: 'desc',+ pbs: 'desc',+ archive: 'desc',+ snapshot: 'desc',+ task: 'desc',+};++export type RecoverableSortKey = 'workload' | 'source' | 'location' | 'created' | 'size' | 'state';+export const RECOVERABLE_SORT_DEFAULT_DIRECTION: Record<RecoverableSortKey, 'asc' | 'desc'> = {+ workload: 'asc',+ source: 'asc',+ location: 'asc',+ created: 'desc',+ size: 'desc',+ state: 'asc',+};++export type PBSSortKey = 'workload' | 'repository' | 'created' | 'size' | 'protected' | 'verified';+export const PBS_SORT_DEFAULT_DIRECTION: Record<PBSSortKey, 'asc' | 'desc'> = {+ workload: 'asc',+ repository: 'asc',+ created: 'desc',+ size: 'desc',+ protected: 'desc',+ verified: 'desc',+};++export type SnapshotSortKey = 'guest' | 'node' | 'latest' | 'count' | 'size';+export const SNAPSHOT_SORT_DEFAULT_DIRECTION: Record<SnapshotSortKey, 'asc' | 'desc'> = {+ guest: 'asc',+ node: 'asc',+ latest: 'desc',+ count: 'desc',+ size: 'desc',+};++export type ArchiveSortKey =+ | 'volume'+ | 'guest'+ | 'storage'+ | 'node'+ | 'format'+ | 'created'+ | 'size'+ | 'protected'+ | 'verified';+export const ARCHIVE_SORT_DEFAULT_DIRECTION: Record<ArchiveSortKey, 'asc' | 'desc'> = {+ volume: 'asc',+ guest: 'asc',+ storage: 'asc',+ node: 'asc',+ format: 'asc',+ created: 'desc',+ size: 'desc',+ protected: 'desc',+ verified: 'desc',+};++export type TaskSortKey = 'status' | 'guest' | 'node' | 'started' | 'duration' | 'size';+export const TASK_SORT_DEFAULT_DIRECTION: Record<TaskSortKey, 'asc' | 'desc'> = {+ status: 'asc',+ guest: 'asc',+ node: 'asc',+ started: 'desc',+ duration: 'desc',+ size: 'desc',+};