import { useQuery } from "@tanstack/react-query"; import { CalendarClock, Database, HardDrive, Plus } from "lucide-react"; import { Link } from "react-router"; import { listBackupSchedulesOptions } from "~/api-client/@tanstack/react-query.gen"; import { Badge } from "~/components/ui/badge"; import { Button } from "~/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "~/components/ui/card"; export default function BackupJobsPage() { const { data: schedules, isLoading } = useQuery({ ...listBackupSchedulesOptions(), refetchInterval: 10000, refetchOnWindowFocus: true, }); if (isLoading) { return (

Loading backup schedules...

); } if (!schedules || schedules.length === 0) { return (

No backup job created

Backup jobs allow you to create automated backup schedules for your volumes. Set up your first backup job to ensure your data is securely backed up.

); } return (
{schedules.map((schedule) => (
Volume #{schedule.volumeId}
{schedule.enabled ? "Active" : "Paused"}
{schedule.repositoryId}
Schedule {schedule.cronExpression}
Last backup {schedule.lastBackupAt ? new Date(schedule.lastBackupAt).toLocaleDateString() : "Never"}
Next backup {schedule.nextBackupAt ? new Date(schedule.nextBackupAt).toLocaleDateString() : "N/A"}
{schedule.lastBackupStatus && (
Status {schedule.lastBackupStatus}
)}
))}
); }