import React from "react"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { api } from "@/utils/api"; import { DatabaseBackup, Play } from "lucide-react"; import Link from "next/link"; import { AddBackup } from "../../database/backups/add-backup"; import { DeleteBackup } from "../../database/backups/delete-backup"; import { UpdateBackup } from "../../database/backups/update-backup"; import { toast } from "sonner"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip"; interface Props { postgresId: string; } export const ShowBackupPostgres = ({ postgresId }: Props) => { const { data } = api.destination.all.useQuery(); const { data: postgres, refetch: refetchPostgres } = api.postgres.one.useQuery( { postgresId, }, { enabled: !!postgresId, }, ); const { mutateAsync: manualBackup, isLoading: isManualBackup } = api.backup.manualBackupPostgres.useMutation(); return (
Backups Add backup to your database to save the data to a different providers.
{postgres && postgres?.backups?.length > 0 && ( )}
{data?.length === 0 ? (
To create a backup is required to set at least 1 provider. Please, go to{" "} Settings {" "} to do so.
) : (
{postgres?.backups.length === 0 ? (
No backups configured
) : (
{postgres?.backups.map((backup) => (
Destination {backup.destination.name}
Database {backup.database}
Scheduled {backup.schedule}
Prefix Storage {backup.prefix}
Enabled {backup.enabled ? "Yes" : "No"}
Run Manual Backup
))}
)}
)}
); };