diff --git a/app/client/api-client/types.gen.ts b/app/client/api-client/types.gen.ts index 4ada52f3..e6e5f670 100644 --- a/app/client/api-client/types.gen.ts +++ b/app/client/api-client/types.gen.ts @@ -2434,15 +2434,17 @@ export type ListBackupSchedulesResponses = { includePatterns: Array | null; oneFileSystem: boolean; customResticParams: Array | null; - preBackupWebhook: { - url: string; - headers?: Array; - body?: string; - } | null; - postBackupWebhook: { - url: string; - headers?: Array; - body?: string; + backupWebhooks: { + pre: { + url: string; + headers?: Array; + body?: string; + } | null; + post: { + url: string; + headers?: Array; + body?: string; + } | null; } | null; maxRetries: number; retryDelay: number; @@ -2722,15 +2724,17 @@ export type CreateBackupScheduleData = { oneFileSystem?: boolean; tags?: Array; customResticParams?: Array; - preBackupWebhook?: { - url: string; - headers?: Array; - body?: string; - } | null; - postBackupWebhook?: { - url: string; - headers?: Array; - body?: string; + backupWebhooks?: { + pre: { + url: string; + headers?: Array; + body?: string; + } | null; + post: { + url: string; + headers?: Array; + body?: string; + } | null; } | null; maxRetries?: number; retryDelay?: number; @@ -2767,15 +2771,17 @@ export type CreateBackupScheduleResponses = { includePatterns: Array | null; oneFileSystem: boolean; customResticParams: Array | null; - preBackupWebhook: { - url: string; - headers?: Array; - body?: string; - } | null; - postBackupWebhook: { - url: string; - headers?: Array; - body?: string; + backupWebhooks: { + pre: { + url: string; + headers?: Array; + body?: string; + } | null; + post: { + url: string; + headers?: Array; + body?: string; + } | null; } | null; maxRetries: number; retryDelay: number; @@ -2846,15 +2852,17 @@ export type GetBackupScheduleResponses = { includePatterns: Array | null; oneFileSystem: boolean; customResticParams: Array | null; - preBackupWebhook: { - url: string; - headers?: Array; - body?: string; - } | null; - postBackupWebhook: { - url: string; - headers?: Array; - body?: string; + backupWebhooks: { + pre: { + url: string; + headers?: Array; + body?: string; + } | null; + post: { + url: string; + headers?: Array; + body?: string; + } | null; } | null; maxRetries: number; retryDelay: number; @@ -3133,15 +3141,17 @@ export type UpdateBackupScheduleData = { oneFileSystem?: boolean; tags?: Array; customResticParams?: Array; - preBackupWebhook?: { - url: string; - headers?: Array; - body?: string; - } | null; - postBackupWebhook?: { - url: string; - headers?: Array; - body?: string; + backupWebhooks?: { + pre: { + url: string; + headers?: Array; + body?: string; + } | null; + post: { + url: string; + headers?: Array; + body?: string; + } | null; } | null; maxRetries?: number; retryDelay?: number; @@ -3180,15 +3190,17 @@ export type UpdateBackupScheduleResponses = { includePatterns: Array | null; oneFileSystem: boolean; customResticParams: Array | null; - preBackupWebhook: { - url: string; - headers?: Array; - body?: string; - } | null; - postBackupWebhook: { - url: string; - headers?: Array; - body?: string; + backupWebhooks: { + pre: { + url: string; + headers?: Array; + body?: string; + } | null; + post: { + url: string; + headers?: Array; + body?: string; + } | null; } | null; maxRetries: number; retryDelay: number; @@ -3239,15 +3251,17 @@ export type GetBackupScheduleForVolumeResponses = { includePatterns: Array | null; oneFileSystem: boolean; customResticParams: Array | null; - preBackupWebhook: { - url: string; - headers?: Array; - body?: string; - } | null; - postBackupWebhook: { - url: string; - headers?: Array; - body?: string; + backupWebhooks: { + pre: { + url: string; + headers?: Array; + body?: string; + } | null; + post: { + url: string; + headers?: Array; + body?: string; + } | null; } | null; maxRetries: number; retryDelay: number; diff --git a/app/client/modules/backups/components/create-schedule-form/advanced-section.tsx b/app/client/modules/backups/components/create-schedule-form/advanced-section.tsx index 87ca541e..0b6c3d33 100644 --- a/app/client/modules/backups/components/create-schedule-form/advanced-section.tsx +++ b/app/client/modules/backups/components/create-schedule-form/advanced-section.tsx @@ -8,6 +8,72 @@ type AdvancedSectionProps = { form: UseFormReturn; }; +type WebhookFieldsProps = { + form: UseFormReturn; + phase: "pre" | "post"; + urlPlaceholder: string; + bodyPlaceholder: string; + description: string; +}; + +const WebhookFields = ({ form, phase, urlPlaceholder, bodyPlaceholder, description }: WebhookFieldsProps) => { + const labelPrefix = phase === "pre" ? "Pre-backup" : "Post-backup"; + const fieldPrefix = phase === "pre" ? "preBackupWebhook" : "postBackupWebhook"; + + return ( + <> + ( + + {labelPrefix} webhook + + + + {description} + + + )} + /> + ( + + {labelPrefix} webhook headers + +