+
Backup management with scheduling and monitoring diff --git a/app/client/components/create-volume-dialog.tsx b/app/client/components/create-volume-dialog.tsx deleted file mode 100644 index 6ad92ca..0000000 --- a/app/client/components/create-volume-dialog.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { useMutation } from "@tanstack/react-query"; -import { Plus } from "lucide-react"; -import { useId } from "react"; -import { toast } from "sonner"; -import { parseError } from "~/client/lib/errors"; -import { CreateVolumeForm } from "./create-volume-form"; -import { Button } from "./ui/button"; -import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "./ui/dialog"; -import { ScrollArea } from "./ui/scroll-area"; -import { createVolumeMutation } from "../api-client/@tanstack/react-query.gen"; - -type Props = { - open: boolean; - setOpen: (open: boolean) => void; -}; - -export const CreateVolumeDialog = ({ open, setOpen }: Props) => { - const formId = useId(); - - const create = useMutation({ - ...createVolumeMutation(), - onSuccess: () => { - toast.success("Volume created successfully"); - setOpen(false); - }, - onError: (error) => { - toast.error("Failed to create volume", { - description: parseError(error)?.message, - }); - }, - }); - - return ( - - ); -}; diff --git a/app/client/modules/volumes/routes/create-volume.tsx b/app/client/modules/volumes/routes/create-volume.tsx new file mode 100644 index 0000000..9930807 --- /dev/null +++ b/app/client/modules/volumes/routes/create-volume.tsx @@ -0,0 +1,83 @@ +import { useMutation } from "@tanstack/react-query"; +import { HardDrive } from "lucide-react"; +import { useId } from "react"; +import { useNavigate } from "react-router"; +import { toast } from "sonner"; +import { createVolumeMutation } from "~/client/api-client/@tanstack/react-query.gen"; +import { CreateVolumeForm, type FormValues } from "~/client/components/create-volume-form"; +import { Button } from "~/client/components/ui/button"; +import { Card, CardContent, CardHeader, CardTitle } from "~/client/components/ui/card"; +import { parseError } from "~/client/lib/errors"; +import type { Route } from "./+types/create-volume"; +import { Alert, AlertDescription } from "~/client/components/ui/alert"; + +export const handle = { + breadcrumb: () => [{ label: "Volumes", href: "/volumes" }, { label: "Create" }], +}; + +export function meta(_: Route.MetaArgs) { + return [ + { title: "Create Volume" }, + { + name: "description", + content: "Create a new storage volume with automatic mounting and health checks.", + }, + ]; +} + +export default function CreateVolume() { + const navigate = useNavigate(); + const formId = useId(); + + const createVolume = useMutation({ + ...createVolumeMutation(), + onSuccess: (data) => { + toast.success("Volume created successfully"); + navigate(`/volumes/${data.name}`); + }, + }); + + const handleSubmit = (values: FormValues) => { + createVolume.mutate({ + body: { + config: values, + name: values.name, + }, + }); + }; + + return ( +