feat: Add channel_id field for Notifiarr

- Add channel_id field for Notifiarr to store record of the discord channel_id into the PB.
This commit is contained in:
Tola Leng
2025-09-03 21:48:59 +07:00
parent 05f46969c4
commit b2269187d8
2 changed files with 36 additions and 16 deletions
@@ -92,6 +92,7 @@ const pushoverSchema = baseSchema.extend({
const notifiarrSchema = baseSchema.extend({ const notifiarrSchema = baseSchema.extend({
notification_type: z.literal("notifiarr"), notification_type: z.literal("notifiarr"),
api_token: z.string().min(1, "API token is required"), api_token: z.string().min(1, "API token is required"),
channel_id: z.string().min(1, "Channel ID is required"),
}); });
const webhookSchema = baseSchema.extend({ const webhookSchema = baseSchema.extend({
@@ -635,22 +636,40 @@ export const NotificationChannelDialog = ({
)} )}
{notificationType === "notifiarr" && ( {notificationType === "notifiarr" && (
<FormField <>
control={form.control} <FormField
name="api_token" control={form.control}
render={({ field }) => ( name="api_token"
<FormItem> render={({ field }) => (
<FormLabel>API Token</FormLabel> <FormItem>
<FormControl> <FormLabel>API Token</FormLabel>
<Input placeholder="Your Notifiarr API token" {...field} type="password" /> <FormControl>
</FormControl> <Input placeholder="Your Notifiarr API token" {...field} type="password" />
<FormDescription> </FormControl>
Your Notifiarr API token for sending notifications <FormDescription>
</FormDescription> Your Notifiarr API token for sending notifications
<FormMessage /> </FormDescription>
</FormItem> <FormMessage />
)} </FormItem>
/> )}
/>
<FormField
control={form.control}
name="channel_id"
render={({ field }) => (
<FormItem>
<FormLabel>Channel ID</FormLabel>
<FormControl>
<Input placeholder="Discord Channel ID" {...field} />
</FormControl>
<FormDescription>
The Discord channel ID where notifications will be sent
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
</>
)} )}
{notificationType === "webhook" && ( {notificationType === "webhook" && (
@@ -94,6 +94,7 @@ export const alertConfigService = {
} else if (config.notification_type === "notifiarr") { } else if (config.notification_type === "notifiarr") {
cleanConfig.api_token = config.api_token || ""; cleanConfig.api_token = config.api_token || "";
cleanConfig.channel_id = config.channel_id || "";
} else if (config.notification_type === "webhook") { } else if (config.notification_type === "webhook") {
cleanConfig.webhook_url = config.webhook_url || ""; cleanConfig.webhook_url = config.webhook_url || "";