feat: add managed database capture and operator restore
PostgreSQL and MySQL backups run through paired outposts, with operator sign-in, off-site copies, and legacy import. Retention stays on each orbit, so the unused retention console is removed. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import type { Snapshot } from "../../api";
|
||||
import { useState } from "react";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { deleteSnapshot, type Snapshot } from "../../api";
|
||||
import { formatBytes, formatWhen } from "../../lib/format";
|
||||
import { Button } from "../ui/Button";
|
||||
import { TelemetryPanel } from "../ui/Telemetry";
|
||||
@@ -6,10 +8,21 @@ import { TelemetryPanel } from "../ui/Telemetry";
|
||||
export function SnapshotSheet({
|
||||
snap,
|
||||
onReconstitute,
|
||||
onDeleted,
|
||||
}: {
|
||||
snap: Snapshot;
|
||||
onReconstitute: () => void;
|
||||
onDeleted: () => void;
|
||||
}) {
|
||||
const [confirmDelete, setConfirmDelete] = useState(false);
|
||||
const qc = useQueryClient();
|
||||
const deletion = useMutation({
|
||||
mutationFn: () => deleteSnapshot(snap.id),
|
||||
onSuccess: () => {
|
||||
void qc.invalidateQueries({ queryKey: ["snapshots"] });
|
||||
onDeleted();
|
||||
},
|
||||
});
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<p className="text-sm text-star-300">
|
||||
@@ -22,8 +35,20 @@ export function SnapshotSheet({
|
||||
<p className="text-star-100">{formatBytes(snap.size_bytes)}</p>
|
||||
</div>
|
||||
<Button variant="warn" className="w-full" onClick={onReconstitute}>
|
||||
Restore this snapshot
|
||||
{snap.capture?.restore_ready ? "Database recovery options" : "Export file on hub"}
|
||||
</Button>
|
||||
<a href={`/api/v1/snapshots/${snap.id}/download`} download
|
||||
className="console-control block w-full text-center">Download snapshot</a>
|
||||
{confirmDelete ? (
|
||||
<div className="space-y-2 rounded-xl border border-orbit-red/40 p-3">
|
||||
<p className="text-sm text-star-300">Remove this recovery point from the hub catalogue?</p>
|
||||
{deletion.isError && <p role="alert" className="text-sm text-orbit-red">Snapshot could not be removed. It may be in use.</p>}
|
||||
<div className="flex gap-2">
|
||||
<Button disabled={deletion.isPending} onClick={() => setConfirmDelete(false)}>Cancel</Button>
|
||||
<Button variant="warn" disabled={deletion.isPending} onClick={() => deletion.mutate()}>Confirm deletion</Button>
|
||||
</div>
|
||||
</div>
|
||||
) : <Button className="w-full" onClick={() => setConfirmDelete(true)}>Delete snapshot</Button>}
|
||||
<TelemetryPanel label="Snapshot ID">{snap.id}</TelemetryPanel>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user