import type { BackupPolicy } from '../soteria-types'; import { formatTimestamp } from '../soteria-ui-helpers'; interface BackupPoliciesPanelProps { policies: BackupPolicy[]; policyError: string; namespaceOptions: string[]; policyNamespace: string; policyPVC: string; policyIntervalHours: number; policyEnabled: boolean; policyDedupe: boolean; policyKeepLast: number; busy: boolean; onPolicyNamespaceChange: (value: string) => void; onPolicyPVCChange: (value: string) => void; onPolicyIntervalHoursChange: (value: number) => void; onPolicyEnabledChange: (value: boolean) => void; onPolicyDedupeChange: (value: boolean) => void; onPolicyKeepLastChange: (value: number) => void; onSavePolicy: () => void | Promise; onDeletePolicy: (policyID: string) => void | Promise; onLoadPolicy: (policy: BackupPolicy) => void; } export function BackupPoliciesPanel({ policies, policyError, namespaceOptions, policyNamespace, policyPVC, policyIntervalHours, policyEnabled, policyDedupe, policyKeepLast, busy, onPolicyNamespaceChange, onPolicyPVCChange, onPolicyIntervalHoursChange, onPolicyEnabledChange, onPolicyDedupeChange, onPolicyKeepLastChange, onSavePolicy, onDeletePolicy, onLoadPolicy }: BackupPoliciesPanelProps) { return (

Backup Policies

Policy backups create new restic snapshots. `Keep last` controls version retention per PVC: 1 means only newest copy remains after each run. With dedupe on, unchanged blocks are reused in the shared repository. With dedupe off, Soteria isolates each PVC to its own repository path.

{policyError &&

{policyError}

} {!policyError && policies.length === 0 &&

No policies yet.

}
{policies.map((policy) => (
{policy.namespace}/{policy.pvc || '*'} {policy.enabled ? 'Enabled' : 'Disabled'}

Every {policy.interval_hours}h | Dedupe: {policy.dedupe === false ? 'off' : 'on'} | Keep last: {policy.keep_last ?? 0} {' '}| Updated {formatTimestamp(policy.updated_at || policy.created_at)}

))}
); }