-
SMTP port
-
{
- const nextPort = Number.parseInt(
- event.target.value,
- 10,
- );
- setDraft((current) =>
- current
- ? {
- ...current,
- smtpPort: Number.isNaN(nextPort)
- ? 587
- : nextPort,
- }
- : current,
- );
+
+ {NOTIFICATION_ACTION_OPTIONS.map((action) => {
+ const checked = draft.actions.includes(action.value);
+
+ return (
+
-
-
-
-
- Secure SMTP connection
-
-
- Activate if your SMTP server requires a secure
- connection (TLS/SSL).
-
+ >
+
+
+ {action.label}
+
+
+ {action.description}
+
+
+
+ setDraft((current) => {
+ if (!current) return current;
+
+ return {
+ ...current,
+ actions: checked
+ ? current.actions.filter(
+ (item) => item !== action.value,
+ )
+ : [...current.actions, action.value],
+ };
+ })
+ }
+ />
-
- setDraft((current) =>
- current
- ? {
- ...current,
- smtpSecure: !current.smtpSecure,
- }
- : current,
- )
- }
- />
-
-
- SMTP username
-
- setDraft((current) =>
- current
- ? {
- ...current,
- smtpUsername: event.target.value,
- }
- : current,
- )
- }
- placeholder="apikey or mailbox username"
- />
-
-
- SMTP password
-
- setDraft((current) =>
- current
- ? {
- ...current,
- smtpPassword: event.target.value,
- smtpPasswordConfigured:
- current.smtpPasswordConfigured ||
- Boolean(event.target.value.trim()),
- }
- : current,
- )
- }
- />
-
-
-
- From email
-
- setDraft((current) =>
- current
- ? {
- ...current,
- smtpFromEmail: event.target.value,
- }
- : current,
- )
- }
- placeholder="alerts@example.com"
- />
-
-
- From name
-
- setDraft((current) =>
- current
- ? {
- ...current,
- smtpFromName: event.target.value,
- }
- : current,
- )
- }
- placeholder="Doktainer Alerts"
- />
-
- >
- ) : null}
-
- {draft.type === "telegram" ? (
- <>
-
- Bot token
-
- setDraft((current) =>
- current
- ? {
- ...current,
- telegramBotToken: event.target.value,
- telegramBotTokenConfigured:
- current.telegramBotTokenConfigured ||
- Boolean(event.target.value.trim()),
- }
- : current,
- )
- }
- />
-
-
-
- Chat ID
-
- setDraft((current) =>
- current
- ? {
- ...current,
- telegramChatId: event.target.value,
- }
- : current,
- )
- }
- placeholder="-100xxxxxxxxxx"
- />
-
- >
- ) : null}
-
- {[
- "discord",
- "slack",
- "lark",
- "teams",
- "mattermost",
- "custom",
- ].includes(draft.type) ? (
- <>
-
- Webhook URL
-
- setDraft((current) =>
- current
- ? {
- ...current,
- webhookUrl: event.target.value,
- webhookConfigured:
- current.webhookConfigured ||
- Boolean(event.target.value.trim()),
- }
- : current,
- )
- }
- placeholder="https://hooks.example.com/..."
- />
-
-
-
- Channel / label
-
- setDraft((current) =>
- current
- ? { ...current, channel: event.target.value }
- : current,
- )
- }
- placeholder="#infra-alerts or Incident Room"
- />
-
- >
- ) : null}
-
- {draft.type === "resend" ? (
- <>
-
- API key
-
- setDraft((current) =>
- current
- ? {
- ...current,
- apiKey: event.target.value,
- apiKeyConfigured:
- current.apiKeyConfigured ||
- Boolean(event.target.value.trim()),
- }
- : current,
- )
- }
- />
-
-
-
- From email
-
- setDraft((current) =>
- current
- ? {
- ...current,
- smtpFromEmail: event.target.value,
- }
- : current,
- )
- }
- />
-
-
- From name
-
- setDraft((current) =>
- current
- ? {
- ...current,
- smtpFromName: event.target.value,
- }
- : current,
- )
- }
- />
-
- >
- ) : null}
-
- {draft.type === "gotify" ? (
- <>
-
- Server URL
-
- setDraft((current) =>
- current
- ? { ...current, serverUrl: event.target.value }
- : current,
- )
- }
- placeholder="https://gotify.example.com"
- />
-
-
- API key
-
- setDraft((current) =>
- current
- ? {
- ...current,
- apiKey: event.target.value,
- apiKeyConfigured:
- current.apiKeyConfigured ||
- Boolean(event.target.value.trim()),
- }
- : current,
- )
- }
- />
-
-
- >
- ) : null}
-
- {draft.type === "ntfy" ? (
- <>
-
- Server URL
-
- setDraft((current) =>
- current
- ? { ...current, serverUrl: event.target.value }
- : current,
- )
- }
- placeholder="https://ntfy.sh or internal endpoint"
- />
-
-
- Topic
-
- setDraft((current) =>
- current
- ? { ...current, topic: event.target.value }
- : current,
- )
- }
- placeholder="dokta infra alerts"
- />
-
- >
- ) : null}
-
- {draft.type === "pushover" ? (
- <>
-
- User key
-
- setDraft((current) =>
- current
- ? { ...current, userKey: event.target.value }
- : current,
- )
- }
- />
-
-
- API token
-
- setDraft((current) =>
- current
- ? {
- ...current,
- apiKey: event.target.value,
- apiKeyConfigured:
- current.apiKeyConfigured ||
- Boolean(event.target.value.trim()),
- }
- : current,
- )
- }
- />
-
-
- >
- ) : null}
-
-