diff --git a/src/components/notifier.tsx b/src/components/notifier.tsx index d892209..6004262 100644 --- a/src/components/notifier.tsx +++ b/src/components/notifier.tsx @@ -58,6 +58,7 @@ const notificationFormSchema = z.object({ verify_tls: asOptionalField(z.boolean()), skip_check: asOptionalField(z.boolean()), format_metric_units: asOptionalField(z.boolean()), + type: z.coerce.number().int().default(1), }) export const NotifierCard: React.FC = ({ data, mutate }) => { @@ -77,6 +78,7 @@ export const NotifierCard: React.FC = ({ data, mutate }) => { verify_tls: (data as any).verify_tls ?? false, skip_check: (data as any).skip_check ?? false, format_metric_units: (data as any).format_metric_units ?? false, + type: data.type ?? 1, } : { name: "", @@ -88,6 +90,7 @@ export const NotifierCard: React.FC = ({ data, mutate }) => { verify_tls: false, skip_check: false, format_metric_units: false, + type: 1, }, resetOptions: { keepDefaultValues: false, @@ -143,12 +146,36 @@ export const NotifierCard: React.FC = ({ data, mutate }) => { )} /> + ( + + Notification Type + + + + )} + /> ( - URL + {form.watch("type") == 2 ? "SMTP Server (host:port)" : "URL"} @@ -156,72 +183,76 @@ export const NotifierCard: React.FC = ({ data, mutate }) => { )} /> - ( - - {t("RequestMethod")} - - - - )} - /> - ( - - {t("Type")} - - - - )} - /> + {form.watch("type") != 2 && ( + <> + ( + + {t("RequestMethod")} + + + + )} + /> + ( + + {t("Type")} + + + + )} + /> + + )} ( - {t("RequestHeader")} + {form.watch("type") == 2 ? "SMTP User:Pass" : t("RequestHeader")}