({
defaultValues: {
@@ -298,6 +315,19 @@ export const HandleNotifications = ({ notificationId }: Props) => {
name: notification.name,
dockerCleanup: notification.dockerCleanup,
});
+ } else if (notification.notificationType === "custom") {
+ form.reset({
+ appBuildError: notification.appBuildError,
+ appDeploy: notification.appDeploy,
+ dokployRestart: notification.dokployRestart,
+ databaseBackup: notification.databaseBackup,
+ type: notification.notificationType,
+ endpoint: notification.custom?.endpoint || "",
+ headers: notification.custom?.headers || "",
+ name: notification.name,
+ dockerCleanup: notification.dockerCleanup,
+ serverThreshold: notification.serverThreshold,
+ });
}
} else {
form.reset();
@@ -311,6 +341,7 @@ export const HandleNotifications = ({ notificationId }: Props) => {
email: emailMutation,
gotify: gotifyMutation,
ntfy: ntfyMutation,
+ custom: customMutation,
};
const onSubmit = async (data: NotificationSchema) => {
@@ -414,6 +445,20 @@ export const HandleNotifications = ({ notificationId }: Props) => {
notificationId: notificationId || "",
ntfyId: notification?.ntfyId || "",
});
+ } else if (data.type === "custom") {
+ promise = customMutation.mutateAsync({
+ appBuildError: appBuildError,
+ appDeploy: appDeploy,
+ dokployRestart: dokployRestart,
+ databaseBackup: databaseBackup,
+ endpoint: data.endpoint,
+ headers: data.headers || "",
+ name: data.name,
+ dockerCleanup: dockerCleanup,
+ serverThreshold: serverThreshold,
+ notificationId: notificationId || "",
+ customId: notification?.customId || "",
+ });
}
if (promise) {
@@ -1000,6 +1045,49 @@ export const HandleNotifications = ({ notificationId }: Props) => {
/>
>
)}
+
+ {type === "custom" && (
+
+ (
+
+ Webhook URL
+
+
+
+
+ The URL where POST requests will be sent with
+ notification data.
+
+
+
+ )}
+ />
+
+ (
+
+
+
+
+
+
+ )}
+ />
+
+ )}
@@ -1150,7 +1238,8 @@ export const HandleNotifications = ({ notificationId }: Props) => {
isLoadingDiscord ||
isLoadingEmail ||
isLoadingGotify ||
- isLoadingNtfy
+ isLoadingNtfy ||
+ isLoadingCustom
}
variant="secondary"
onClick={async () => {
@@ -1194,6 +1283,11 @@ export const HandleNotifications = ({ notificationId }: Props) => {
accessToken: form.getValues("accessToken"),
priority: form.getValues("priority"),
});
+ } else if (type === "custom") {
+ await testCustomConnection({
+ endpoint: form.getValues("endpoint") as string,
+ headers: form.getValues("headers") as string | undefined,
+ });
}
toast.success("Connection Success");
} catch {