Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/screenshots/teams-create-form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/teams-edit-form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/teams-provider-picker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {TelegramChannelConfigSchema} from "./providers/notifications/forms/teleg
import {GotifyChannelConfigSchema} from "./providers/notifications/forms/gotify.schema";
import {NtfyChannelConfigSchema} from "./providers/notifications/forms/ntfy.schema";
import {WebhookChannelConfigSchema} from "./providers/notifications/forms/webhook.schema";
import {TeamsChannelConfigSchema} from "./providers/notifications/forms/teams.schema";
import {S3ChannelConfigSchema} from "./providers/storages/forms/s3.schema";
import {GoogleDriveChannelConfigSchema} from "./providers/storages/forms/google-drive.schema";
import {LocalChannelConfigSchema} from "./providers/storages/forms/local.schema";
Expand Down Expand Up @@ -48,6 +49,10 @@ export const NotificationChannelFormSchema = z.discriminatedUnion("provider", [
provider: z.literal("webhook"),
config: WebhookChannelConfigSchema,
}),
BaseChannelFormSchema.extend({
provider: z.literal("microsoft-teams"),
config: TeamsChannelConfigSchema,
}),
]);

export const StorageChannelFormSchema = z.discriminatedUnion("provider", [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { UseFormReturn } from "react-hook-form";
import {
FormControl,
FormField,
FormItem,
FormLabel,
FormMessage,
} from "@/components/ui/form";
import { Separator } from "@/components/ui/separator";
import { PasswordInput } from "@/components/ui/password-input";

type NotifierTeamsFormProps = {
form: UseFormReturn<any, any, any>;
};

export const NotifierTeamsForm = ({ form }: NotifierTeamsFormProps) => {
return (
<>
<Separator className="my-1" />
<FormField
control={form.control}
name="config.teamsWebhook"
render={({ field }) => (
<FormItem>
<FormLabel>Teams Webhook URL *</FormLabel>
<FormControl>
<PasswordInput
{...field}
placeholder="e.g. https://outlook.office.com/webhook/..."
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
</>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {z} from "zod";

export const TeamsChannelConfigSchema = z.object({
teamsWebhook: z.string().url("Must be a valid URL"),
});
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import {
import {
NotifierWebhookForm
} from "@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/webhook.form";
import {
NotifierTeamsForm
} from "@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/teams.form";
import {
notificationProviders,
} from "@/components/wrappers/dashboard/admin/channels/helpers/notification";
Expand Down Expand Up @@ -87,6 +90,8 @@ export const renderChannelForm = (provider: string | undefined, form: UseFormRet
return <NotifierNtfyForm form={form}/>;
case "webhook":
return <NotifierWebhookForm form={form}/>;
case "microsoft-teams":
return <NotifierTeamsForm form={form}/>;
case "s3":
return <StorageS3Form form={form}/>
case "google-drive":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const notificationProviders: ProviderIconTypes[] = [
{value: "gotify", label: "Gotify", icon: GotifyIcon},
{value: "ntfy", label: "ntfy.sh", icon: NtfyIcon},
{value: "webhook", label: "Webhook", icon: WebhookIcon},
{value: "microsoft-teams", label: "Microsoft Teams", icon: MSTeamsIcon, preview: true}
{value: "microsoft-teams", label: "Microsoft Teams", icon: MSTeamsIcon}
]


Expand Down
1 change: 1 addition & 0 deletions src/db/migrations/0049_mixed_blur.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TYPE "public"."provider_kind" ADD VALUE 'microsoft-teams';
Loading