refactor: dedicated edit page for notifications

This commit is contained in:
Nicolas Meienberger 2026-04-02 18:35:43 +02:00 committed by Nico
parent 731ebad1ee
commit e8d1658c0a
10 changed files with 484 additions and 202 deletions

View file

@ -59,6 +59,7 @@ type Props = {
initialValues?: Partial<NotificationFormValues>; initialValues?: Partial<NotificationFormValues>;
formId?: string; formId?: string;
className?: string; className?: string;
readOnly?: boolean;
}; };
const defaultValuesForType = { const defaultValuesForType = {
@ -122,7 +123,14 @@ const defaultValuesForType = {
}, },
}; };
export const CreateNotificationForm = ({ onSubmit, mode = "create", initialValues, formId, className }: Props) => { export const CreateNotificationForm = ({
onSubmit,
mode = "create",
initialValues,
formId,
className,
readOnly = false,
}: Props) => {
const form = useForm<NotificationFormValues>({ const form = useForm<NotificationFormValues>({
resolver: zodResolver(formSchema, undefined, { raw: true }), resolver: zodResolver(formSchema, undefined, { raw: true }),
defaultValues: initialValues || { defaultValues: initialValues || {
@ -145,6 +153,7 @@ export const CreateNotificationForm = ({ onSubmit, mode = "create", initialValue
onSubmit={form.handleSubmit(onSubmit, scrollToFirstError)} onSubmit={form.handleSubmit(onSubmit, scrollToFirstError)}
className={cn("space-y-4", className)} className={cn("space-y-4", className)}
> >
<fieldset disabled={readOnly} className="space-y-4">
<FormField <FormField
control={form.control} control={form.control}
name="name" name="name"
@ -152,7 +161,7 @@ export const CreateNotificationForm = ({ onSubmit, mode = "create", initialValue
<FormItem> <FormItem>
<FormLabel>Name</FormLabel> <FormLabel>Name</FormLabel>
<FormControl> <FormControl>
<Input {...field} placeholder="My notification" max={32} min={2} /> <Input {...field} placeholder="My notification" max={32} min={2} disabled={readOnly} />
</FormControl> </FormControl>
<FormDescription>Unique identifier for this notification destination.</FormDescription> <FormDescription>Unique identifier for this notification destination.</FormDescription>
<FormMessage /> <FormMessage />
@ -177,10 +186,10 @@ export const CreateNotificationForm = ({ onSubmit, mode = "create", initialValue
} }
}} }}
value={field.value ?? ""} value={field.value ?? ""}
disabled={mode === "update"} disabled={mode === "update" || readOnly}
> >
<FormControl> <FormControl>
<SelectTrigger className={mode === "update" ? "bg-gray-50" : ""}> <SelectTrigger className={mode === "update" || readOnly ? "bg-gray-50" : ""}>
<SelectValue placeholder="Select notification type" /> <SelectValue placeholder="Select notification type" />
</SelectTrigger> </SelectTrigger>
</FormControl> </FormControl>
@ -202,15 +211,16 @@ export const CreateNotificationForm = ({ onSubmit, mode = "create", initialValue
)} )}
/> />
{watchedType === "email" && <EmailForm form={form} />} {watchedType === "email" && <EmailForm form={form} readOnly={readOnly} />}
{watchedType === "slack" && <SlackForm form={form} />} {watchedType === "slack" && <SlackForm form={form} />}
{watchedType === "discord" && <DiscordForm form={form} />} {watchedType === "discord" && <DiscordForm form={form} />}
{watchedType === "gotify" && <GotifyForm form={form} />} {watchedType === "gotify" && <GotifyForm form={form} />}
{watchedType === "ntfy" && <NtfyForm form={form} />} {watchedType === "ntfy" && <NtfyForm form={form} readOnly={readOnly} />}
{watchedType === "pushover" && <PushoverForm form={form} />} {watchedType === "pushover" && <PushoverForm form={form} readOnly={readOnly} />}
{watchedType === "telegram" && <TelegramForm form={form} />} {watchedType === "telegram" && <TelegramForm form={form} />}
{watchedType === "generic" && <GenericForm form={form} />} {watchedType === "generic" && <GenericForm form={form} readOnly={readOnly} />}
{watchedType === "custom" && <CustomForm form={form} />} {watchedType === "custom" && <CustomForm form={form} />}
</fieldset>
</form> </form>
</Form> </Form>
); );

View file

@ -7,9 +7,10 @@ import type { NotificationFormValues } from "../create-notification-form";
type Props = { type Props = {
form: UseFormReturn<NotificationFormValues>; form: UseFormReturn<NotificationFormValues>;
readOnly?: boolean;
}; };
export const EmailForm = ({ form }: Props) => { export const EmailForm = ({ form, readOnly = false }: Props) => {
return ( return (
<> <>
<FormField <FormField
@ -128,7 +129,7 @@ export const EmailForm = ({ form }: Props) => {
render={({ field }) => ( render={({ field }) => (
<FormItem className="flex flex-row items-center space-x-3"> <FormItem className="flex flex-row items-center space-x-3">
<FormControl> <FormControl>
<Checkbox checked={field.value} onCheckedChange={field.onChange} /> <Checkbox checked={field.value} disabled={readOnly} onCheckedChange={field.onChange} />
</FormControl> </FormControl>
<div className="space-y-1 leading-none"> <div className="space-y-1 leading-none">
<FormLabel>Use TLS</FormLabel> <FormLabel>Use TLS</FormLabel>

View file

@ -10,6 +10,7 @@ import type { NotificationFormValues } from "../create-notification-form";
type Props = { type Props = {
form: UseFormReturn<NotificationFormValues>; form: UseFormReturn<NotificationFormValues>;
readOnly?: boolean;
}; };
const WebhookPreview = ({ values }: { values: Partial<NotificationFormValues> }) => { const WebhookPreview = ({ values }: { values: Partial<NotificationFormValues> }) => {
@ -48,7 +49,7 @@ ${body}`;
); );
}; };
export const GenericForm = ({ form }: Props) => { export const GenericForm = ({ form, readOnly = false }: Props) => {
const watchedValues = useWatch({ control: form.control }); const watchedValues = useWatch({ control: form.control });
const useJson = useWatch({ control: form.control, name: "useJson" }); const useJson = useWatch({ control: form.control, name: "useJson" });
@ -74,7 +75,7 @@ export const GenericForm = ({ form }: Props) => {
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Method</FormLabel> <FormLabel>Method</FormLabel>
<Select onValueChange={field.onChange} value={field.value ?? ""}> <Select disabled={readOnly} onValueChange={field.onChange} value={field.value ?? ""}>
<FormControl> <FormControl>
<SelectTrigger> <SelectTrigger>
<SelectValue placeholder="Select method" /> <SelectValue placeholder="Select method" />
@ -127,7 +128,11 @@ export const GenericForm = ({ form }: Props) => {
render={({ field }) => ( render={({ field }) => (
<FormItem className="flex flex-row items-center space-x-3"> <FormItem className="flex flex-row items-center space-x-3">
<FormControl> <FormControl>
<Checkbox checked={field.value} onCheckedChange={(checked) => field.onChange(checked)} /> <Checkbox
checked={field.value}
disabled={readOnly}
onCheckedChange={(checked) => field.onChange(checked)}
/>
</FormControl> </FormControl>
<div className="space-y-1 leading-none"> <div className="space-y-1 leading-none">
<FormLabel>Use JSON Template</FormLabel> <FormLabel>Use JSON Template</FormLabel>

View file

@ -7,9 +7,10 @@ import type { NotificationFormValues } from "../create-notification-form";
type Props = { type Props = {
form: UseFormReturn<NotificationFormValues>; form: UseFormReturn<NotificationFormValues>;
readOnly?: boolean;
}; };
export const NtfyForm = ({ form }: Props) => { export const NtfyForm = ({ form, readOnly = false }: Props) => {
return ( return (
<> <>
<FormField <FormField
@ -90,7 +91,7 @@ export const NtfyForm = ({ form }: Props) => {
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Priority</FormLabel> <FormLabel>Priority</FormLabel>
<Select onValueChange={field.onChange} value={String(field.value)}> <Select disabled={readOnly} onValueChange={field.onChange} value={String(field.value)}>
<FormControl> <FormControl>
<SelectTrigger> <SelectTrigger>
<SelectValue placeholder="Select priority" /> <SelectValue placeholder="Select priority" />

View file

@ -7,9 +7,10 @@ import type { NotificationFormValues } from "../create-notification-form";
type Props = { type Props = {
form: UseFormReturn<NotificationFormValues>; form: UseFormReturn<NotificationFormValues>;
readOnly?: boolean;
}; };
export const PushoverForm = ({ form }: Props) => { export const PushoverForm = ({ form, readOnly = false }: Props) => {
return ( return (
<> <>
<FormField <FormField
@ -61,6 +62,7 @@ export const PushoverForm = ({ form }: Props) => {
<FormItem> <FormItem>
<FormLabel>Priority</FormLabel> <FormLabel>Priority</FormLabel>
<Select <Select
disabled={readOnly}
onValueChange={(value) => field.onChange(Number(value))} onValueChange={(value) => field.onChange(Number(value))}
defaultValue={String(field.value)} defaultValue={String(field.value)}
value={String(field.value)} value={String(field.value)}

View file

@ -0,0 +1,90 @@
import { useMutation, useSuspenseQuery } from "@tanstack/react-query";
import { useId } from "react";
import { useNavigate } from "@tanstack/react-router";
import { Bell, Save } from "lucide-react";
import { toast } from "sonner";
import {
getNotificationDestinationOptions,
updateNotificationDestinationMutation,
} from "~/client/api-client/@tanstack/react-query.gen";
import { Alert, AlertDescription } from "~/client/components/ui/alert";
import { Button } from "~/client/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "~/client/components/ui/card";
import { parseError } from "~/client/lib/errors";
import { CreateNotificationForm, type NotificationFormValues } from "../components/create-notification-form";
export function EditNotificationPage({ notificationId }: { notificationId: string }) {
const navigate = useNavigate();
const formId = useId();
const { data } = useSuspenseQuery({
...getNotificationDestinationOptions({ path: { id: notificationId } }),
});
const updateDestination = useMutation({
...updateNotificationDestinationMutation(),
onSuccess: () => {
toast.success("Notification destination updated successfully");
void navigate({ to: `/notifications/${data.id}` });
},
onError: (error) => {
toast.error("Failed to update notification destination", {
description: parseError(error)?.message,
});
},
});
const handleSubmit = (values: NotificationFormValues) => {
updateDestination.mutate({
path: { id: String(data.id) },
body: {
name: values.name,
config: values,
},
});
};
return (
<div className="container mx-auto space-y-6">
<Card>
<CardHeader>
<div className="flex items-center gap-3">
<div className="flex items-center justify-center w-10 h-10 rounded-lg bg-primary/10">
<Bell className="w-5 h-5 text-primary" />
</div>
<CardTitle>Edit Notification Destination</CardTitle>
</div>
</CardHeader>
<CardContent className="space-y-6">
{updateDestination.isError && (
<Alert variant="destructive">
<AlertDescription>
<strong>Failed to update notification destination:</strong>
<br />
{parseError(updateDestination.error)?.message}
</AlertDescription>
</Alert>
)}
<CreateNotificationForm
mode="update"
formId={formId}
onSubmit={handleSubmit}
initialValues={{
...data.config,
name: data.name,
}}
/>
<div className="flex justify-end gap-2 pt-4 border-t">
<Button type="button" variant="secondary" onClick={() => navigate({ to: `/notifications/${data.id}` })}>
Cancel
</Button>
<Button type="submit" form={formId} loading={updateDestination.isPending}>
<Save className="h-4 w-4 mr-2" />
Save Changes
</Button>
</div>
</CardContent>
</Card>
</div>
);
}

View file

@ -1,11 +1,10 @@
import { useMutation, useSuspenseQuery } from "@tanstack/react-query"; import { useMutation, useSuspenseQuery } from "@tanstack/react-query";
import { toast } from "sonner"; import { toast } from "sonner";
import { useState, useId } from "react"; import { useState } from "react";
import { import {
deleteNotificationDestinationMutation, deleteNotificationDestinationMutation,
getNotificationDestinationOptions, getNotificationDestinationOptions,
testNotificationDestinationMutation, testNotificationDestinationMutation,
updateNotificationDestinationMutation,
} from "~/client/api-client/@tanstack/react-query.gen"; } from "~/client/api-client/@tanstack/react-query.gen";
import { Button } from "~/client/components/ui/button"; import { Button } from "~/client/components/ui/button";
import { import {
@ -22,19 +21,159 @@ import {
DropdownMenu, DropdownMenu,
DropdownMenuContent, DropdownMenuContent,
DropdownMenuItem, DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger, DropdownMenuTrigger,
} from "~/client/components/ui/dropdown-menu"; } from "~/client/components/ui/dropdown-menu";
import { Badge } from "~/client/components/ui/badge";
import { Card, CardTitle } from "~/client/components/ui/card";
import { Separator } from "~/client/components/ui/separator";
import { parseError } from "~/client/lib/errors"; import { parseError } from "~/client/lib/errors";
import { formatDateTime } from "~/client/lib/datetime";
import { cn } from "~/client/lib/utils"; import { cn } from "~/client/lib/utils";
import { Card, CardContent, CardHeader, CardTitle } from "~/client/components/ui/card"; import {
import { Bell, ChevronDown, Save, TestTube2, Trash2 } from "lucide-react"; Bell,
import { Alert, AlertDescription } from "~/client/components/ui/alert"; Bot,
import { CreateNotificationForm, type NotificationFormValues } from "../components/create-notification-form"; ChevronDown,
Globe,
Hash,
Key,
Link,
Lock,
Mail,
AtSign,
MessageSquare,
Pencil,
Server,
Settings,
Shield,
Smile,
TestTube2,
Trash2,
Users,
} from "lucide-react";
import { useNavigate } from "@tanstack/react-router"; import { useNavigate } from "@tanstack/react-router";
import type { GetNotificationDestinationResponse } from "~/client/api-client/types.gen";
type NotificationConfig = GetNotificationDestinationResponse["config"];
type Props = {
icon: React.ReactNode;
label: string;
value: string;
mono?: boolean;
};
function ConfigRow({ icon, label, value, mono }: Props) {
return (
<div className="flex items-center gap-3 py-3 first:pt-0 last:pb-0">
<span className="text-muted-foreground shrink-0">{icon}</span>
<span className="text-sm text-muted-foreground w-40 shrink-0">{label}</span>
<span className={cn("text-sm break-all", { "font-mono bg-muted/50 px-2 py-0.5 rounded": mono })}>{value}</span>
</div>
);
}
function NotificationConfigRows({ config }: { config: NotificationConfig }) {
switch (config.type) {
case "slack":
return (
<>
<ConfigRow icon={<Globe className="h-4 w-4" />} label="Webhook URL" value={config.webhookUrl} mono />
<ConfigRow icon={<Hash className="h-4 w-4" />} label="Channel" value={config.channel || "—"} />
<ConfigRow icon={<Bot className="h-4 w-4" />} label="Bot Username" value={config.username || "—"} />
<ConfigRow icon={<Smile className="h-4 w-4" />} label="Icon Emoji" value={config.iconEmoji || "—"} />
</>
);
case "discord":
return (
<>
<ConfigRow icon={<Globe className="h-4 w-4" />} label="Webhook URL" value={config.webhookUrl} mono />
<ConfigRow icon={<Bot className="h-4 w-4" />} label="Username" value={config.username || "—"} />
<ConfigRow icon={<Link className="h-4 w-4" />} label="Avatar URL" value={config.avatarUrl || "—"} mono />
<ConfigRow icon={<MessageSquare className="h-4 w-4" />} label="Thread ID" value={config.threadId || "—"} />
</>
);
case "email":
return (
<>
<ConfigRow icon={<Server className="h-4 w-4" />} label="SMTP Host" value={config.smtpHost} mono />
<ConfigRow icon={<Server className="h-4 w-4" />} label="SMTP Port" value={String(config.smtpPort)} />
<ConfigRow icon={<AtSign className="h-4 w-4" />} label="Username" value={config.username || "—"} />
<ConfigRow icon={<Lock className="h-4 w-4" />} label="Password" value={config.password || "—"} />
<ConfigRow icon={<Mail className="h-4 w-4" />} label="From" value={config.from} />
{config.fromName && (
<ConfigRow icon={<Mail className="h-4 w-4" />} label="From Name" value={config.fromName} />
)}
<ConfigRow icon={<Users className="h-4 w-4" />} label="To" value={config.to.join(", ")} />
<ConfigRow icon={<Shield className="h-4 w-4" />} label="TLS" value={config.useTLS ? "Enabled" : "Disabled"} />
</>
);
case "gotify":
return (
<>
<ConfigRow icon={<Globe className="h-4 w-4" />} label="Server URL" value={config.serverUrl} mono />
<ConfigRow icon={<Key className="h-4 w-4" />} label="Token" value={config.token} mono />
<ConfigRow icon={<Globe className="h-4 w-4" />} label="Path" value={config.path || "—"} mono />
<ConfigRow icon={<Settings className="h-4 w-4" />} label="Priority" value={String(config.priority)} />
</>
);
case "ntfy":
return (
<>
<ConfigRow
icon={<Globe className="h-4 w-4" />}
label="Server URL"
value={config.serverUrl || "Default (ntfy.sh)"}
mono
/>
<ConfigRow icon={<Hash className="h-4 w-4" />} label="Topic" value={config.topic} />
<ConfigRow icon={<Settings className="h-4 w-4" />} label="Priority" value={config.priority} />
<ConfigRow icon={<AtSign className="h-4 w-4" />} label="Username" value={config.username || "—"} />
<ConfigRow icon={<Lock className="h-4 w-4" />} label="Password" value={config.password || "—"} />
<ConfigRow icon={<Key className="h-4 w-4" />} label="Access Token" value={config.accessToken || "—"} />
</>
);
case "pushover":
return (
<>
<ConfigRow icon={<Key className="h-4 w-4" />} label="User Key" value={config.userKey} mono />
<ConfigRow icon={<Key className="h-4 w-4" />} label="API Token" value={config.apiToken} mono />
<ConfigRow icon={<Settings className="h-4 w-4" />} label="Devices" value={config.devices || "—"} />
<ConfigRow icon={<Settings className="h-4 w-4" />} label="Priority" value={String(config.priority)} />
</>
);
case "telegram":
return (
<>
<ConfigRow icon={<Key className="h-4 w-4" />} label="Bot Token" value={config.botToken} mono />
<ConfigRow icon={<Hash className="h-4 w-4" />} label="Chat ID" value={config.chatId} mono />
<ConfigRow icon={<MessageSquare className="h-4 w-4" />} label="Thread ID" value={config.threadId || "—"} />
</>
);
case "generic":
return (
<>
<ConfigRow icon={<Globe className="h-4 w-4" />} label="URL" value={config.url} mono />
<ConfigRow icon={<Settings className="h-4 w-4" />} label="Method" value={config.method} />
<ConfigRow icon={<Settings className="h-4 w-4" />} label="Content Type" value={config.contentType || "—"} />
<ConfigRow
icon={<Settings className="h-4 w-4" />}
label="JSON Mode"
value={config.useJson ? "Enabled" : "Disabled"}
/>
<ConfigRow icon={<Key className="h-4 w-4" />} label="Title Key" value={config.titleKey || "—"} mono />
<ConfigRow icon={<Key className="h-4 w-4" />} label="Message Key" value={config.messageKey || "—"} mono />
{config.headers?.map((h, i) => (
<ConfigRow key={i} icon={<Link className="h-4 w-4" />} label={`Header ${i + 1}`} value={h} mono />
))}
</>
);
case "custom":
return <ConfigRow icon={<Globe className="h-4 w-4" />} label="Shoutrrr URL" value={config.shoutrrrUrl} mono />;
}
}
export function NotificationDetailsPage({ notificationId }: { notificationId: string }) { export function NotificationDetailsPage({ notificationId }: { notificationId: string }) {
const navigate = useNavigate(); const navigate = useNavigate();
const formId = useId();
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false); const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
const { data } = useSuspenseQuery({ const { data } = useSuspenseQuery({
@ -54,18 +193,6 @@ export function NotificationDetailsPage({ notificationId }: { notificationId: st
}, },
}); });
const updateDestination = useMutation({
...updateNotificationDestinationMutation(),
onSuccess: () => {
toast.success("Notification destination updated successfully");
},
onError: (error) => {
toast.error("Failed to update notification destination", {
description: parseError(error)?.message,
});
},
});
const testDestination = useMutation({ const testDestination = useMutation({
...testNotificationDestinationMutation(), ...testNotificationDestinationMutation(),
onSuccess: () => { onSuccess: () => {
@ -83,33 +210,38 @@ export function NotificationDetailsPage({ notificationId }: { notificationId: st
deleteDestination.mutate({ path: { id: String(data.id) } }); deleteDestination.mutate({ path: { id: String(data.id) } });
}; };
const handleSubmit = (values: NotificationFormValues) => {
updateDestination.mutate({
path: { id: String(data.id) },
body: {
name: values.name,
config: values,
},
});
};
const handleTest = () => { const handleTest = () => {
testDestination.mutate({ path: { id: String(data.id) } }); testDestination.mutate({ path: { id: String(data.id) } });
}; };
return ( return (
<> <>
<div className="flex items-center justify-between mb-4"> <div className="flex flex-col gap-6 @container">
<div className="text-sm font-semibold text-muted-foreground flex items-center gap-2"> <Card className="px-6 py-5">
<div className="flex flex-col @wide:flex-row @wide:items-center justify-between gap-4">
<div className="flex items-center gap-4">
<div className="hidden @medium:flex items-center justify-center w-10 h-10 shrink-0 rounded-lg bg-muted/50 border border-border/50">
<Bell className="h-5 w-5 text-muted-foreground" />
</div>
<div>
<div className="flex items-center gap-2">
<h2 className="text-lg font-semibold tracking-tight">{data.name}</h2>
<Separator orientation="vertical" className="h-4 mx-1" />
<Badge variant="outline" className="capitalize gap-1.5">
<span <span
className={cn("inline-flex items-center gap-2 px-2 py-1 rounded-md text-xs bg-gray-500/10 text-gray-500", { className={cn("w-2 h-2 rounded-full shrink-0", {
"bg-success/10 text-success": data.enabled, "bg-success": data.enabled,
"bg-red-500/10 text-red-500": !data.enabled, "bg-red-500": !data.enabled,
})} })}
> />
{data.enabled ? "Enabled" : "Disabled"} {data.enabled ? "Enabled" : "Disabled"}
</span> </Badge>
<span className="text-xs bg-primary/10 rounded-md px-2 py-1 capitalize">{data.type}</span> <Badge variant="secondary" className="capitalize">
{data.type}
</Badge>
</div>
<p className="text-sm text-muted-foreground mt-0.5">Created {formatDateTime(data.createdAt)}</p>
</div>
</div> </div>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Button <Button
@ -129,6 +261,11 @@ export function NotificationDetailsPage({ notificationId }: { notificationId: st
</Button> </Button>
</DropdownMenuTrigger> </DropdownMenuTrigger>
<DropdownMenuContent align="end"> <DropdownMenuContent align="end">
<DropdownMenuItem onClick={() => navigate({ to: `/notifications/${data.id}/edit` })}>
<Pencil />
Edit
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem <DropdownMenuItem
variant="destructive" variant="destructive"
onClick={() => setShowDeleteConfirm(true)} onClick={() => setShowDeleteConfirm(true)}
@ -141,44 +278,19 @@ export function NotificationDetailsPage({ notificationId }: { notificationId: st
</DropdownMenu> </DropdownMenu>
</div> </div>
</div> </div>
<Card>
<CardHeader>
<div className="flex items-center gap-3">
<div className="flex items-center justify-center w-10 h-10 rounded-lg bg-primary/10">
<Bell className="w-5 h-5 text-primary" />
</div>
<CardTitle>{data.name}</CardTitle>
</div>
</CardHeader>
<CardContent className="space-y-6">
{updateDestination.isError && (
<Alert variant="destructive">
<AlertDescription>
<strong>Failed to update notification destination:</strong>
<br />
{parseError(updateDestination.error)?.message}
</AlertDescription>
</Alert>
)}
<CreateNotificationForm
mode="update"
formId={formId}
onSubmit={handleSubmit}
initialValues={{
...data.config,
name: data.name,
}}
/>
<div className="flex justify-end gap-2 pt-4 border-t">
<Button type="submit" form={formId} loading={updateDestination.isPending}>
<Save className="h-4 w-4 mr-2" />
Save Changes
</Button>
</div>
</CardContent>
</Card> </Card>
<Card className="px-6 py-6">
<CardTitle className="flex items-center gap-2 mb-5">
<Settings className="h-4 w-4 text-muted-foreground" />
Configuration
</CardTitle>
<div className="space-y-0 divide-y divide-border/50">
<NotificationConfigRows config={data.config} />
</div>
</Card>
</div>
<AlertDialog open={showDeleteConfirm} onOpenChange={setShowDeleteConfirm}> <AlertDialog open={showDeleteConfirm} onOpenChange={setShowDeleteConfirm}>
<AlertDialogContent> <AlertDialogContent>
<AlertDialogHeader> <AlertDialogHeader>

View file

@ -25,15 +25,16 @@ import { Route as dashboardAdminIndexRouteImport } from './routes/(dashboard)/ad
import { Route as dashboardVolumesCreateRouteImport } from './routes/(dashboard)/volumes/create' import { Route as dashboardVolumesCreateRouteImport } from './routes/(dashboard)/volumes/create'
import { Route as dashboardRepositoriesCreateRouteImport } from './routes/(dashboard)/repositories/create' import { Route as dashboardRepositoriesCreateRouteImport } from './routes/(dashboard)/repositories/create'
import { Route as dashboardNotificationsCreateRouteImport } from './routes/(dashboard)/notifications/create' import { Route as dashboardNotificationsCreateRouteImport } from './routes/(dashboard)/notifications/create'
import { Route as dashboardNotificationsNotificationIdRouteImport } from './routes/(dashboard)/notifications/$notificationId'
import { Route as dashboardBackupsCreateRouteImport } from './routes/(dashboard)/backups/create' import { Route as dashboardBackupsCreateRouteImport } from './routes/(dashboard)/backups/create'
import { Route as authLoginErrorRouteImport } from './routes/(auth)/login.error' import { Route as authLoginErrorRouteImport } from './routes/(auth)/login.error'
import { Route as dashboardVolumesVolumeIdIndexRouteImport } from './routes/(dashboard)/volumes/$volumeId/index' import { Route as dashboardVolumesVolumeIdIndexRouteImport } from './routes/(dashboard)/volumes/$volumeId/index'
import { Route as dashboardRepositoriesRepositoryIdIndexRouteImport } from './routes/(dashboard)/repositories/$repositoryId/index' import { Route as dashboardRepositoriesRepositoryIdIndexRouteImport } from './routes/(dashboard)/repositories/$repositoryId/index'
import { Route as dashboardNotificationsNotificationIdIndexRouteImport } from './routes/(dashboard)/notifications/$notificationId/index'
import { Route as dashboardBackupsBackupIdIndexRouteImport } from './routes/(dashboard)/backups/$backupId/index' import { Route as dashboardBackupsBackupIdIndexRouteImport } from './routes/(dashboard)/backups/$backupId/index'
import { Route as dashboardVolumesVolumeIdEditRouteImport } from './routes/(dashboard)/volumes/$volumeId/edit' import { Route as dashboardVolumesVolumeIdEditRouteImport } from './routes/(dashboard)/volumes/$volumeId/edit'
import { Route as dashboardSettingsSsoNewRouteImport } from './routes/(dashboard)/settings/sso/new' import { Route as dashboardSettingsSsoNewRouteImport } from './routes/(dashboard)/settings/sso/new'
import { Route as dashboardRepositoriesRepositoryIdEditRouteImport } from './routes/(dashboard)/repositories/$repositoryId/edit' import { Route as dashboardRepositoriesRepositoryIdEditRouteImport } from './routes/(dashboard)/repositories/$repositoryId/edit'
import { Route as dashboardNotificationsNotificationIdEditRouteImport } from './routes/(dashboard)/notifications/$notificationId/edit'
import { Route as dashboardBackupsBackupIdEditRouteImport } from './routes/(dashboard)/backups/$backupId/edit' import { Route as dashboardBackupsBackupIdEditRouteImport } from './routes/(dashboard)/backups/$backupId/edit'
import { Route as dashboardRepositoriesRepositoryIdSnapshotIdIndexRouteImport } from './routes/(dashboard)/repositories/$repositoryId/$snapshotId/index' import { Route as dashboardRepositoriesRepositoryIdSnapshotIdIndexRouteImport } from './routes/(dashboard)/repositories/$repositoryId/$snapshotId/index'
import { Route as dashboardRepositoriesRepositoryIdSnapshotIdRestoreRouteImport } from './routes/(dashboard)/repositories/$repositoryId/$snapshotId/restore' import { Route as dashboardRepositoriesRepositoryIdSnapshotIdRestoreRouteImport } from './routes/(dashboard)/repositories/$repositoryId/$snapshotId/restore'
@ -121,12 +122,6 @@ const dashboardNotificationsCreateRoute =
path: '/notifications/create', path: '/notifications/create',
getParentRoute: () => dashboardRouteRoute, getParentRoute: () => dashboardRouteRoute,
} as any) } as any)
const dashboardNotificationsNotificationIdRoute =
dashboardNotificationsNotificationIdRouteImport.update({
id: '/notifications/$notificationId',
path: '/notifications/$notificationId',
getParentRoute: () => dashboardRouteRoute,
} as any)
const dashboardBackupsCreateRoute = dashboardBackupsCreateRouteImport.update({ const dashboardBackupsCreateRoute = dashboardBackupsCreateRouteImport.update({
id: '/backups/create', id: '/backups/create',
path: '/backups/create', path: '/backups/create',
@ -149,6 +144,12 @@ const dashboardRepositoriesRepositoryIdIndexRoute =
path: '/repositories/$repositoryId/', path: '/repositories/$repositoryId/',
getParentRoute: () => dashboardRouteRoute, getParentRoute: () => dashboardRouteRoute,
} as any) } as any)
const dashboardNotificationsNotificationIdIndexRoute =
dashboardNotificationsNotificationIdIndexRouteImport.update({
id: '/notifications/$notificationId/',
path: '/notifications/$notificationId/',
getParentRoute: () => dashboardRouteRoute,
} as any)
const dashboardBackupsBackupIdIndexRoute = const dashboardBackupsBackupIdIndexRoute =
dashboardBackupsBackupIdIndexRouteImport.update({ dashboardBackupsBackupIdIndexRouteImport.update({
id: '/backups/$backupId/', id: '/backups/$backupId/',
@ -172,6 +173,12 @@ const dashboardRepositoriesRepositoryIdEditRoute =
path: '/repositories/$repositoryId/edit', path: '/repositories/$repositoryId/edit',
getParentRoute: () => dashboardRouteRoute, getParentRoute: () => dashboardRouteRoute,
} as any) } as any)
const dashboardNotificationsNotificationIdEditRoute =
dashboardNotificationsNotificationIdEditRouteImport.update({
id: '/notifications/$notificationId/edit',
path: '/notifications/$notificationId/edit',
getParentRoute: () => dashboardRouteRoute,
} as any)
const dashboardBackupsBackupIdEditRoute = const dashboardBackupsBackupIdEditRoute =
dashboardBackupsBackupIdEditRouteImport.update({ dashboardBackupsBackupIdEditRouteImport.update({
id: '/backups/$backupId/edit', id: '/backups/$backupId/edit',
@ -205,7 +212,6 @@ export interface FileRoutesByFullPath {
'/api/$': typeof ApiSplatRoute '/api/$': typeof ApiSplatRoute
'/login/error': typeof authLoginErrorRoute '/login/error': typeof authLoginErrorRoute
'/backups/create': typeof dashboardBackupsCreateRoute '/backups/create': typeof dashboardBackupsCreateRoute
'/notifications/$notificationId': typeof dashboardNotificationsNotificationIdRoute
'/notifications/create': typeof dashboardNotificationsCreateRoute '/notifications/create': typeof dashboardNotificationsCreateRoute
'/repositories/create': typeof dashboardRepositoriesCreateRoute '/repositories/create': typeof dashboardRepositoriesCreateRoute
'/volumes/create': typeof dashboardVolumesCreateRoute '/volumes/create': typeof dashboardVolumesCreateRoute
@ -216,10 +222,12 @@ export interface FileRoutesByFullPath {
'/settings/': typeof dashboardSettingsIndexRoute '/settings/': typeof dashboardSettingsIndexRoute
'/volumes/': typeof dashboardVolumesIndexRoute '/volumes/': typeof dashboardVolumesIndexRoute
'/backups/$backupId/edit': typeof dashboardBackupsBackupIdEditRoute '/backups/$backupId/edit': typeof dashboardBackupsBackupIdEditRoute
'/notifications/$notificationId/edit': typeof dashboardNotificationsNotificationIdEditRoute
'/repositories/$repositoryId/edit': typeof dashboardRepositoriesRepositoryIdEditRoute '/repositories/$repositoryId/edit': typeof dashboardRepositoriesRepositoryIdEditRoute
'/settings/sso/new': typeof dashboardSettingsSsoNewRoute '/settings/sso/new': typeof dashboardSettingsSsoNewRoute
'/volumes/$volumeId/edit': typeof dashboardVolumesVolumeIdEditRoute '/volumes/$volumeId/edit': typeof dashboardVolumesVolumeIdEditRoute
'/backups/$backupId/': typeof dashboardBackupsBackupIdIndexRoute '/backups/$backupId/': typeof dashboardBackupsBackupIdIndexRoute
'/notifications/$notificationId/': typeof dashboardNotificationsNotificationIdIndexRoute
'/repositories/$repositoryId/': typeof dashboardRepositoriesRepositoryIdIndexRoute '/repositories/$repositoryId/': typeof dashboardRepositoriesRepositoryIdIndexRoute
'/volumes/$volumeId/': typeof dashboardVolumesVolumeIdIndexRoute '/volumes/$volumeId/': typeof dashboardVolumesVolumeIdIndexRoute
'/backups/$backupId/$snapshotId/restore': typeof dashboardBackupsBackupIdSnapshotIdRestoreRoute '/backups/$backupId/$snapshotId/restore': typeof dashboardBackupsBackupIdSnapshotIdRestoreRoute
@ -234,7 +242,6 @@ export interface FileRoutesByTo {
'/api/$': typeof ApiSplatRoute '/api/$': typeof ApiSplatRoute
'/login/error': typeof authLoginErrorRoute '/login/error': typeof authLoginErrorRoute
'/backups/create': typeof dashboardBackupsCreateRoute '/backups/create': typeof dashboardBackupsCreateRoute
'/notifications/$notificationId': typeof dashboardNotificationsNotificationIdRoute
'/notifications/create': typeof dashboardNotificationsCreateRoute '/notifications/create': typeof dashboardNotificationsCreateRoute
'/repositories/create': typeof dashboardRepositoriesCreateRoute '/repositories/create': typeof dashboardRepositoriesCreateRoute
'/volumes/create': typeof dashboardVolumesCreateRoute '/volumes/create': typeof dashboardVolumesCreateRoute
@ -245,10 +252,12 @@ export interface FileRoutesByTo {
'/settings': typeof dashboardSettingsIndexRoute '/settings': typeof dashboardSettingsIndexRoute
'/volumes': typeof dashboardVolumesIndexRoute '/volumes': typeof dashboardVolumesIndexRoute
'/backups/$backupId/edit': typeof dashboardBackupsBackupIdEditRoute '/backups/$backupId/edit': typeof dashboardBackupsBackupIdEditRoute
'/notifications/$notificationId/edit': typeof dashboardNotificationsNotificationIdEditRoute
'/repositories/$repositoryId/edit': typeof dashboardRepositoriesRepositoryIdEditRoute '/repositories/$repositoryId/edit': typeof dashboardRepositoriesRepositoryIdEditRoute
'/settings/sso/new': typeof dashboardSettingsSsoNewRoute '/settings/sso/new': typeof dashboardSettingsSsoNewRoute
'/volumes/$volumeId/edit': typeof dashboardVolumesVolumeIdEditRoute '/volumes/$volumeId/edit': typeof dashboardVolumesVolumeIdEditRoute
'/backups/$backupId': typeof dashboardBackupsBackupIdIndexRoute '/backups/$backupId': typeof dashboardBackupsBackupIdIndexRoute
'/notifications/$notificationId': typeof dashboardNotificationsNotificationIdIndexRoute
'/repositories/$repositoryId': typeof dashboardRepositoriesRepositoryIdIndexRoute '/repositories/$repositoryId': typeof dashboardRepositoriesRepositoryIdIndexRoute
'/volumes/$volumeId': typeof dashboardVolumesVolumeIdIndexRoute '/volumes/$volumeId': typeof dashboardVolumesVolumeIdIndexRoute
'/backups/$backupId/$snapshotId/restore': typeof dashboardBackupsBackupIdSnapshotIdRestoreRoute '/backups/$backupId/$snapshotId/restore': typeof dashboardBackupsBackupIdSnapshotIdRestoreRoute
@ -266,7 +275,6 @@ export interface FileRoutesById {
'/api/$': typeof ApiSplatRoute '/api/$': typeof ApiSplatRoute
'/(auth)/login/error': typeof authLoginErrorRoute '/(auth)/login/error': typeof authLoginErrorRoute
'/(dashboard)/backups/create': typeof dashboardBackupsCreateRoute '/(dashboard)/backups/create': typeof dashboardBackupsCreateRoute
'/(dashboard)/notifications/$notificationId': typeof dashboardNotificationsNotificationIdRoute
'/(dashboard)/notifications/create': typeof dashboardNotificationsCreateRoute '/(dashboard)/notifications/create': typeof dashboardNotificationsCreateRoute
'/(dashboard)/repositories/create': typeof dashboardRepositoriesCreateRoute '/(dashboard)/repositories/create': typeof dashboardRepositoriesCreateRoute
'/(dashboard)/volumes/create': typeof dashboardVolumesCreateRoute '/(dashboard)/volumes/create': typeof dashboardVolumesCreateRoute
@ -277,10 +285,12 @@ export interface FileRoutesById {
'/(dashboard)/settings/': typeof dashboardSettingsIndexRoute '/(dashboard)/settings/': typeof dashboardSettingsIndexRoute
'/(dashboard)/volumes/': typeof dashboardVolumesIndexRoute '/(dashboard)/volumes/': typeof dashboardVolumesIndexRoute
'/(dashboard)/backups/$backupId/edit': typeof dashboardBackupsBackupIdEditRoute '/(dashboard)/backups/$backupId/edit': typeof dashboardBackupsBackupIdEditRoute
'/(dashboard)/notifications/$notificationId/edit': typeof dashboardNotificationsNotificationIdEditRoute
'/(dashboard)/repositories/$repositoryId/edit': typeof dashboardRepositoriesRepositoryIdEditRoute '/(dashboard)/repositories/$repositoryId/edit': typeof dashboardRepositoriesRepositoryIdEditRoute
'/(dashboard)/settings/sso/new': typeof dashboardSettingsSsoNewRoute '/(dashboard)/settings/sso/new': typeof dashboardSettingsSsoNewRoute
'/(dashboard)/volumes/$volumeId/edit': typeof dashboardVolumesVolumeIdEditRoute '/(dashboard)/volumes/$volumeId/edit': typeof dashboardVolumesVolumeIdEditRoute
'/(dashboard)/backups/$backupId/': typeof dashboardBackupsBackupIdIndexRoute '/(dashboard)/backups/$backupId/': typeof dashboardBackupsBackupIdIndexRoute
'/(dashboard)/notifications/$notificationId/': typeof dashboardNotificationsNotificationIdIndexRoute
'/(dashboard)/repositories/$repositoryId/': typeof dashboardRepositoriesRepositoryIdIndexRoute '/(dashboard)/repositories/$repositoryId/': typeof dashboardRepositoriesRepositoryIdIndexRoute
'/(dashboard)/volumes/$volumeId/': typeof dashboardVolumesVolumeIdIndexRoute '/(dashboard)/volumes/$volumeId/': typeof dashboardVolumesVolumeIdIndexRoute
'/(dashboard)/backups/$backupId/$snapshotId/restore': typeof dashboardBackupsBackupIdSnapshotIdRestoreRoute '/(dashboard)/backups/$backupId/$snapshotId/restore': typeof dashboardBackupsBackupIdSnapshotIdRestoreRoute
@ -297,7 +307,6 @@ export interface FileRouteTypes {
| '/api/$' | '/api/$'
| '/login/error' | '/login/error'
| '/backups/create' | '/backups/create'
| '/notifications/$notificationId'
| '/notifications/create' | '/notifications/create'
| '/repositories/create' | '/repositories/create'
| '/volumes/create' | '/volumes/create'
@ -308,10 +317,12 @@ export interface FileRouteTypes {
| '/settings/' | '/settings/'
| '/volumes/' | '/volumes/'
| '/backups/$backupId/edit' | '/backups/$backupId/edit'
| '/notifications/$notificationId/edit'
| '/repositories/$repositoryId/edit' | '/repositories/$repositoryId/edit'
| '/settings/sso/new' | '/settings/sso/new'
| '/volumes/$volumeId/edit' | '/volumes/$volumeId/edit'
| '/backups/$backupId/' | '/backups/$backupId/'
| '/notifications/$notificationId/'
| '/repositories/$repositoryId/' | '/repositories/$repositoryId/'
| '/volumes/$volumeId/' | '/volumes/$volumeId/'
| '/backups/$backupId/$snapshotId/restore' | '/backups/$backupId/$snapshotId/restore'
@ -326,7 +337,6 @@ export interface FileRouteTypes {
| '/api/$' | '/api/$'
| '/login/error' | '/login/error'
| '/backups/create' | '/backups/create'
| '/notifications/$notificationId'
| '/notifications/create' | '/notifications/create'
| '/repositories/create' | '/repositories/create'
| '/volumes/create' | '/volumes/create'
@ -337,10 +347,12 @@ export interface FileRouteTypes {
| '/settings' | '/settings'
| '/volumes' | '/volumes'
| '/backups/$backupId/edit' | '/backups/$backupId/edit'
| '/notifications/$notificationId/edit'
| '/repositories/$repositoryId/edit' | '/repositories/$repositoryId/edit'
| '/settings/sso/new' | '/settings/sso/new'
| '/volumes/$volumeId/edit' | '/volumes/$volumeId/edit'
| '/backups/$backupId' | '/backups/$backupId'
| '/notifications/$notificationId'
| '/repositories/$repositoryId' | '/repositories/$repositoryId'
| '/volumes/$volumeId' | '/volumes/$volumeId'
| '/backups/$backupId/$snapshotId/restore' | '/backups/$backupId/$snapshotId/restore'
@ -357,7 +369,6 @@ export interface FileRouteTypes {
| '/api/$' | '/api/$'
| '/(auth)/login/error' | '/(auth)/login/error'
| '/(dashboard)/backups/create' | '/(dashboard)/backups/create'
| '/(dashboard)/notifications/$notificationId'
| '/(dashboard)/notifications/create' | '/(dashboard)/notifications/create'
| '/(dashboard)/repositories/create' | '/(dashboard)/repositories/create'
| '/(dashboard)/volumes/create' | '/(dashboard)/volumes/create'
@ -368,10 +379,12 @@ export interface FileRouteTypes {
| '/(dashboard)/settings/' | '/(dashboard)/settings/'
| '/(dashboard)/volumes/' | '/(dashboard)/volumes/'
| '/(dashboard)/backups/$backupId/edit' | '/(dashboard)/backups/$backupId/edit'
| '/(dashboard)/notifications/$notificationId/edit'
| '/(dashboard)/repositories/$repositoryId/edit' | '/(dashboard)/repositories/$repositoryId/edit'
| '/(dashboard)/settings/sso/new' | '/(dashboard)/settings/sso/new'
| '/(dashboard)/volumes/$volumeId/edit' | '/(dashboard)/volumes/$volumeId/edit'
| '/(dashboard)/backups/$backupId/' | '/(dashboard)/backups/$backupId/'
| '/(dashboard)/notifications/$notificationId/'
| '/(dashboard)/repositories/$repositoryId/' | '/(dashboard)/repositories/$repositoryId/'
| '/(dashboard)/volumes/$volumeId/' | '/(dashboard)/volumes/$volumeId/'
| '/(dashboard)/backups/$backupId/$snapshotId/restore' | '/(dashboard)/backups/$backupId/$snapshotId/restore'
@ -500,13 +513,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof dashboardNotificationsCreateRouteImport preLoaderRoute: typeof dashboardNotificationsCreateRouteImport
parentRoute: typeof dashboardRouteRoute parentRoute: typeof dashboardRouteRoute
} }
'/(dashboard)/notifications/$notificationId': {
id: '/(dashboard)/notifications/$notificationId'
path: '/notifications/$notificationId'
fullPath: '/notifications/$notificationId'
preLoaderRoute: typeof dashboardNotificationsNotificationIdRouteImport
parentRoute: typeof dashboardRouteRoute
}
'/(dashboard)/backups/create': { '/(dashboard)/backups/create': {
id: '/(dashboard)/backups/create' id: '/(dashboard)/backups/create'
path: '/backups/create' path: '/backups/create'
@ -535,6 +541,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof dashboardRepositoriesRepositoryIdIndexRouteImport preLoaderRoute: typeof dashboardRepositoriesRepositoryIdIndexRouteImport
parentRoute: typeof dashboardRouteRoute parentRoute: typeof dashboardRouteRoute
} }
'/(dashboard)/notifications/$notificationId/': {
id: '/(dashboard)/notifications/$notificationId/'
path: '/notifications/$notificationId'
fullPath: '/notifications/$notificationId/'
preLoaderRoute: typeof dashboardNotificationsNotificationIdIndexRouteImport
parentRoute: typeof dashboardRouteRoute
}
'/(dashboard)/backups/$backupId/': { '/(dashboard)/backups/$backupId/': {
id: '/(dashboard)/backups/$backupId/' id: '/(dashboard)/backups/$backupId/'
path: '/backups/$backupId' path: '/backups/$backupId'
@ -563,6 +576,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof dashboardRepositoriesRepositoryIdEditRouteImport preLoaderRoute: typeof dashboardRepositoriesRepositoryIdEditRouteImport
parentRoute: typeof dashboardRouteRoute parentRoute: typeof dashboardRouteRoute
} }
'/(dashboard)/notifications/$notificationId/edit': {
id: '/(dashboard)/notifications/$notificationId/edit'
path: '/notifications/$notificationId/edit'
fullPath: '/notifications/$notificationId/edit'
preLoaderRoute: typeof dashboardNotificationsNotificationIdEditRouteImport
parentRoute: typeof dashboardRouteRoute
}
'/(dashboard)/backups/$backupId/edit': { '/(dashboard)/backups/$backupId/edit': {
id: '/(dashboard)/backups/$backupId/edit' id: '/(dashboard)/backups/$backupId/edit'
path: '/backups/$backupId/edit' path: '/backups/$backupId/edit'
@ -624,7 +644,6 @@ const authRouteRouteWithChildren = authRouteRoute._addFileChildren(
interface dashboardRouteRouteChildren { interface dashboardRouteRouteChildren {
dashboardBackupsCreateRoute: typeof dashboardBackupsCreateRoute dashboardBackupsCreateRoute: typeof dashboardBackupsCreateRoute
dashboardNotificationsNotificationIdRoute: typeof dashboardNotificationsNotificationIdRoute
dashboardNotificationsCreateRoute: typeof dashboardNotificationsCreateRoute dashboardNotificationsCreateRoute: typeof dashboardNotificationsCreateRoute
dashboardRepositoriesCreateRoute: typeof dashboardRepositoriesCreateRoute dashboardRepositoriesCreateRoute: typeof dashboardRepositoriesCreateRoute
dashboardVolumesCreateRoute: typeof dashboardVolumesCreateRoute dashboardVolumesCreateRoute: typeof dashboardVolumesCreateRoute
@ -635,10 +654,12 @@ interface dashboardRouteRouteChildren {
dashboardSettingsIndexRoute: typeof dashboardSettingsIndexRoute dashboardSettingsIndexRoute: typeof dashboardSettingsIndexRoute
dashboardVolumesIndexRoute: typeof dashboardVolumesIndexRoute dashboardVolumesIndexRoute: typeof dashboardVolumesIndexRoute
dashboardBackupsBackupIdEditRoute: typeof dashboardBackupsBackupIdEditRoute dashboardBackupsBackupIdEditRoute: typeof dashboardBackupsBackupIdEditRoute
dashboardNotificationsNotificationIdEditRoute: typeof dashboardNotificationsNotificationIdEditRoute
dashboardRepositoriesRepositoryIdEditRoute: typeof dashboardRepositoriesRepositoryIdEditRoute dashboardRepositoriesRepositoryIdEditRoute: typeof dashboardRepositoriesRepositoryIdEditRoute
dashboardSettingsSsoNewRoute: typeof dashboardSettingsSsoNewRoute dashboardSettingsSsoNewRoute: typeof dashboardSettingsSsoNewRoute
dashboardVolumesVolumeIdEditRoute: typeof dashboardVolumesVolumeIdEditRoute dashboardVolumesVolumeIdEditRoute: typeof dashboardVolumesVolumeIdEditRoute
dashboardBackupsBackupIdIndexRoute: typeof dashboardBackupsBackupIdIndexRoute dashboardBackupsBackupIdIndexRoute: typeof dashboardBackupsBackupIdIndexRoute
dashboardNotificationsNotificationIdIndexRoute: typeof dashboardNotificationsNotificationIdIndexRoute
dashboardRepositoriesRepositoryIdIndexRoute: typeof dashboardRepositoriesRepositoryIdIndexRoute dashboardRepositoriesRepositoryIdIndexRoute: typeof dashboardRepositoriesRepositoryIdIndexRoute
dashboardVolumesVolumeIdIndexRoute: typeof dashboardVolumesVolumeIdIndexRoute dashboardVolumesVolumeIdIndexRoute: typeof dashboardVolumesVolumeIdIndexRoute
dashboardBackupsBackupIdSnapshotIdRestoreRoute: typeof dashboardBackupsBackupIdSnapshotIdRestoreRoute dashboardBackupsBackupIdSnapshotIdRestoreRoute: typeof dashboardBackupsBackupIdSnapshotIdRestoreRoute
@ -648,8 +669,6 @@ interface dashboardRouteRouteChildren {
const dashboardRouteRouteChildren: dashboardRouteRouteChildren = { const dashboardRouteRouteChildren: dashboardRouteRouteChildren = {
dashboardBackupsCreateRoute: dashboardBackupsCreateRoute, dashboardBackupsCreateRoute: dashboardBackupsCreateRoute,
dashboardNotificationsNotificationIdRoute:
dashboardNotificationsNotificationIdRoute,
dashboardNotificationsCreateRoute: dashboardNotificationsCreateRoute, dashboardNotificationsCreateRoute: dashboardNotificationsCreateRoute,
dashboardRepositoriesCreateRoute: dashboardRepositoriesCreateRoute, dashboardRepositoriesCreateRoute: dashboardRepositoriesCreateRoute,
dashboardVolumesCreateRoute: dashboardVolumesCreateRoute, dashboardVolumesCreateRoute: dashboardVolumesCreateRoute,
@ -660,11 +679,15 @@ const dashboardRouteRouteChildren: dashboardRouteRouteChildren = {
dashboardSettingsIndexRoute: dashboardSettingsIndexRoute, dashboardSettingsIndexRoute: dashboardSettingsIndexRoute,
dashboardVolumesIndexRoute: dashboardVolumesIndexRoute, dashboardVolumesIndexRoute: dashboardVolumesIndexRoute,
dashboardBackupsBackupIdEditRoute: dashboardBackupsBackupIdEditRoute, dashboardBackupsBackupIdEditRoute: dashboardBackupsBackupIdEditRoute,
dashboardNotificationsNotificationIdEditRoute:
dashboardNotificationsNotificationIdEditRoute,
dashboardRepositoriesRepositoryIdEditRoute: dashboardRepositoriesRepositoryIdEditRoute:
dashboardRepositoriesRepositoryIdEditRoute, dashboardRepositoriesRepositoryIdEditRoute,
dashboardSettingsSsoNewRoute: dashboardSettingsSsoNewRoute, dashboardSettingsSsoNewRoute: dashboardSettingsSsoNewRoute,
dashboardVolumesVolumeIdEditRoute: dashboardVolumesVolumeIdEditRoute, dashboardVolumesVolumeIdEditRoute: dashboardVolumesVolumeIdEditRoute,
dashboardBackupsBackupIdIndexRoute: dashboardBackupsBackupIdIndexRoute, dashboardBackupsBackupIdIndexRoute: dashboardBackupsBackupIdIndexRoute,
dashboardNotificationsNotificationIdIndexRoute:
dashboardNotificationsNotificationIdIndexRoute,
dashboardRepositoriesRepositoryIdIndexRoute: dashboardRepositoriesRepositoryIdIndexRoute:
dashboardRepositoriesRepositoryIdIndexRoute, dashboardRepositoriesRepositoryIdIndexRoute,
dashboardVolumesVolumeIdIndexRoute: dashboardVolumesVolumeIdIndexRoute, dashboardVolumesVolumeIdIndexRoute: dashboardVolumesVolumeIdIndexRoute,

View file

@ -0,0 +1,38 @@
import { createFileRoute } from "@tanstack/react-router";
import { getNotificationDestinationOptions } from "~/client/api-client/@tanstack/react-query.gen";
import { EditNotificationPage } from "~/client/modules/notifications/routes/edit-notification";
export const Route = createFileRoute("/(dashboard)/notifications/$notificationId/edit")({
component: RouteComponent,
errorComponent: () => <div>Failed to load notification</div>,
loader: async ({ params, context }) => {
const notification = await context.queryClient.ensureQueryData({
...getNotificationDestinationOptions({ path: { id: params.notificationId } }),
});
return notification;
},
staticData: {
breadcrumb: (match) => [
{ label: "Notifications", href: "/notifications" },
{
label: match.loaderData?.name || "Notification Details",
href: `/notifications/${match.params.notificationId}`,
},
{ label: "Edit" },
],
},
head: ({ loaderData }) => ({
meta: [
{ title: `Zerobyte - Edit ${loaderData?.name}` },
{
name: "description",
content: "Edit notification destination settings.",
},
],
}),
});
function RouteComponent() {
return <EditNotificationPage notificationId={Route.useParams().notificationId} />;
}

View file

@ -2,7 +2,7 @@ import { createFileRoute } from "@tanstack/react-router";
import { getNotificationDestinationOptions } from "~/client/api-client/@tanstack/react-query.gen"; import { getNotificationDestinationOptions } from "~/client/api-client/@tanstack/react-query.gen";
import { NotificationDetailsPage } from "~/client/modules/notifications/routes/notification-details"; import { NotificationDetailsPage } from "~/client/modules/notifications/routes/notification-details";
export const Route = createFileRoute("/(dashboard)/notifications/$notificationId")({ export const Route = createFileRoute("/(dashboard)/notifications/$notificationId/")({
component: RouteComponent, component: RouteComponent,
errorComponent: () => <div>Failed to load notification</div>, errorComponent: () => <div>Failed to load notification</div>,
loader: async ({ params, context }) => { loader: async ({ params, context }) => {
@ -23,7 +23,7 @@ export const Route = createFileRoute("/(dashboard)/notifications/$notificationId
{ title: `Zerobyte - ${loaderData?.name}` }, { title: `Zerobyte - ${loaderData?.name}` },
{ {
name: "description", name: "description",
content: "View and edit notification destination settings.", content: "View notification destination settings.",
}, },
], ],
}), }),