* 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.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import { createFileRoute } from "@tanstack/react-router";
|
|
import { type } from "arktype";
|
|
import {
|
|
getRepositoryOptions,
|
|
listBackupSchedulesOptions,
|
|
listSnapshotsOptions,
|
|
} from "~/client/api-client/@tanstack/react-query.gen";
|
|
import RepositoryDetailsPage from "~/client/modules/repositories/routes/repository-details";
|
|
|
|
export const Route = createFileRoute("/(dashboard)/repositories/$repositoryId")({
|
|
component: RouteComponent,
|
|
errorComponent: (e) => <div>{e.error.message}</div>,
|
|
loader: async ({ params, context }) => {
|
|
void context.queryClient.prefetchQuery({
|
|
...listSnapshotsOptions({ path: { id: params.repositoryId } }),
|
|
});
|
|
void context.queryClient.prefetchQuery({
|
|
...listBackupSchedulesOptions(),
|
|
});
|
|
|
|
const res = await context.queryClient.ensureQueryData({
|
|
...getRepositoryOptions({ path: { id: params.repositoryId } }),
|
|
});
|
|
|
|
return res;
|
|
},
|
|
validateSearch: type({ tab: "string?" }),
|
|
staticData: {
|
|
breadcrumb: (match) => [
|
|
{ label: "Repositories", href: "/repositories" },
|
|
{ label: match.loaderData?.name || "Repository Details" },
|
|
],
|
|
},
|
|
head: ({ loaderData }) => ({
|
|
meta: [
|
|
{ title: `Zerobyte - ${loaderData?.name}` },
|
|
{
|
|
name: "description",
|
|
content: "View repository configuration, status, and snapshots.",
|
|
},
|
|
],
|
|
}),
|
|
});
|
|
|
|
function RouteComponent() {
|
|
const { repositoryId } = Route.useParams();
|
|
|
|
return <RepositoryDetailsPage repositoryId={repositoryId} />;
|
|
}
|