* 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
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
import { createFileRoute } from "@tanstack/react-router";
|
|
import {
|
|
getRepositoryOptions,
|
|
getSnapshotDetailsOptions,
|
|
listSnapshotFilesOptions,
|
|
} from "~/client/api-client/@tanstack/react-query.gen";
|
|
import { SnapshotDetailsPage } from "~/client/modules/repositories/routes/snapshot-details";
|
|
|
|
export const Route = createFileRoute("/(dashboard)/repositories/$repoId/$snapshotId")({
|
|
component: RouteComponent,
|
|
errorComponent: (e) => <div>{e.error.message}</div>,
|
|
loader: async ({ params, context }) => {
|
|
const res = await context.queryClient.ensureQueryData({
|
|
...getRepositoryOptions({ path: { id: params.repoId } }),
|
|
});
|
|
|
|
void context.queryClient.prefetchQuery({
|
|
...getSnapshotDetailsOptions({
|
|
path: { id: params.repoId, snapshotId: params.snapshotId },
|
|
}),
|
|
});
|
|
void context.queryClient.prefetchQuery({
|
|
...listSnapshotFilesOptions({
|
|
path: { id: params.repoId, snapshotId: params.snapshotId },
|
|
query: { path: "/" },
|
|
}),
|
|
});
|
|
|
|
return res;
|
|
},
|
|
staticData: {
|
|
breadcrumb: (match) => [
|
|
{ label: "Repositories", href: "/repositories" },
|
|
{ label: match.loaderData?.name || "Repository", href: `/repositories/${match.params.repoId}` },
|
|
{ label: match.params.snapshotId },
|
|
],
|
|
},
|
|
head: ({ params }) => ({
|
|
meta: [
|
|
{ title: `Zerobyte - ${params.snapshotId}` },
|
|
{
|
|
name: "description",
|
|
content: "Browse and restore files from a backup snapshot.",
|
|
},
|
|
],
|
|
}),
|
|
});
|
|
|
|
function RouteComponent() {
|
|
const { repoId, snapshotId } = Route.useParams();
|
|
|
|
return <SnapshotDetailsPage repositoryId={repoId} snapshotId={snapshotId} />;
|
|
}
|