* refactor: move to tanstack start * refactor: auth flow & volumes * refactor: repo & snapshot details * refactor: backups, create repo, volumes * refactor: create volume & restore snapshot * refactor: notifications * refactor: settings * refactor: breadcrumbs * fix: ts issues * refactor: prod deployment * fix: import css production * refactor: nitro build * refactor: winston -> consola * fix: memory leak is sse events cleanup * fix: cli usage * chore: remove rr routes file * refactor: pr feedbacks * refactor: patch api client to have a global client per call * refactor: pr feedbacks * fix(dockerfile): add explicit port * fix(e2e): healthcheck under /api
49 lines
1.6 KiB
TypeScript
49 lines
1.6 KiB
TypeScript
import { createFileRoute } from "@tanstack/react-router";
|
|
import { getRepositoryOptions, getSnapshotDetailsOptions } from "~/client/api-client/@tanstack/react-query.gen";
|
|
import { RestoreSnapshotPage } from "~/client/modules/repositories/routes/restore-snapshot";
|
|
|
|
export const Route = createFileRoute("/(dashboard)/repositories/$repoId/$snapId/restore")({
|
|
component: RouteComponent,
|
|
errorComponent: (e) => <div>{e.error.message}</div>,
|
|
loader: async ({ params, context }) => {
|
|
const [snapshot, repository] = await Promise.all([
|
|
context.queryClient.ensureQueryData({
|
|
...getSnapshotDetailsOptions({ path: { id: params.repoId, snapshotId: params.snapId } }),
|
|
}),
|
|
context.queryClient.ensureQueryData({ ...getRepositoryOptions({ path: { id: params.repoId } }) }),
|
|
]);
|
|
|
|
return { snapshot, repository };
|
|
},
|
|
staticData: {
|
|
breadcrumb: (match) => [
|
|
{ label: "Repositories", href: "/repositories" },
|
|
{ label: match.loaderData?.repository?.name || "Repository", href: `/repositories/${match.params.repoId}` },
|
|
{ label: match.params.snapId, href: `/repositories/${match.params.repoId}/${match.params.snapId}` },
|
|
{ label: "Restore" },
|
|
],
|
|
},
|
|
head: ({ params }) => ({
|
|
meta: [
|
|
{ title: `Zerobyte - Restore Snapshot ${params.snapId}` },
|
|
{
|
|
name: "description",
|
|
content: "Restore files from a backup snapshot.",
|
|
},
|
|
],
|
|
}),
|
|
});
|
|
|
|
function RouteComponent() {
|
|
const { repoId, snapId } = Route.useParams();
|
|
const { snapshot, repository } = Route.useLoaderData();
|
|
|
|
return (
|
|
<RestoreSnapshotPage
|
|
returnPath={`/repositories/${repoId}/${snapId}`}
|
|
snapshot={snapshot}
|
|
repository={repository}
|
|
snapshotId={snapId}
|
|
/>
|
|
);
|
|
}
|