1 parent
750fc9e238
commit
5774cb0e06
6 files changed
+34
-2
No files matched your search
@@ -46,6 +46,13 @@ function buildDefaults(data: Notification | null): NotificationFormData {
|
||||
address: data.address || "",
|
||||
};
|
||||
}
|
||||
if (data?.type === "rocket_chat") {
|
||||
return {
|
||||
type: "rocket_chat",
|
||||
notificationName: data.notificationName || "",
|
||||
address: data.address || "",
|
||||
};
|
||||
}
|
||||
if (data?.type === "pager_duty") {
|
||||
return {
|
||||
type: "pager_duty",
|
||||
|
||||
@@ -65,7 +65,13 @@ export const NotificationsTable = ({
|
||||
id: "type",
|
||||
content: t("common.table.headers.type"),
|
||||
render: (row) => {
|
||||
return <Typography textTransform={"capitalize"}>{row?.type}</Typography>;
|
||||
return (
|
||||
<Typography textTransform={"capitalize"}>
|
||||
{row?.type === "rocket_chat"
|
||||
? t("pages.notifications.form.type.rocketChat")
|
||||
: row?.type}
|
||||
</Typography>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -139,7 +139,11 @@ const NotificationsCreatePage = () => {
|
||||
key={type}
|
||||
value={type}
|
||||
>
|
||||
<Typography textTransform="capitalize">{type}</Typography>
|
||||
<Typography textTransform="capitalize">
|
||||
{type === "rocket_chat"
|
||||
? t("pages.notifications.form.type.rocketChat")
|
||||
: type}
|
||||
</Typography>
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
|
||||
@@ -3,6 +3,7 @@ export const NotificationChannels = [
|
||||
"slack",
|
||||
"discord",
|
||||
"webhook",
|
||||
"rocket_chat",
|
||||
"pager_duty",
|
||||
"matrix",
|
||||
"teams",
|
||||
|
||||
@@ -30,6 +30,18 @@ const webhookSchema = baseSchema.extend({
|
||||
address: z.string().min(1, "Webhook URL is required").url("Please enter a valid URL"),
|
||||
});
|
||||
|
||||
const rocketChatSchema = baseSchema.extend({
|
||||
type: z.literal("rocket_chat"),
|
||||
address: z
|
||||
.string()
|
||||
.min(1, "Webhook URL is required")
|
||||
.url("Please enter a valid URL")
|
||||
.refine(
|
||||
(url) => /^https?:\/\//i.test(url),
|
||||
"Rocket.Chat webhook URL must use HTTP or HTTPS"
|
||||
),
|
||||
});
|
||||
|
||||
const pagerDutySchema = baseSchema.extend({
|
||||
type: z.literal("pager_duty"),
|
||||
address: z.string().min(1, "Integration key is required"),
|
||||
@@ -81,6 +93,7 @@ export const notificationSchema = z.discriminatedUnion("type", [
|
||||
slackSchema,
|
||||
discordSchema,
|
||||
webhookSchema,
|
||||
rocketChatSchema,
|
||||
pagerDutySchema,
|
||||
matrixSchema,
|
||||
teamsSchema,
|
||||
|
||||
@@ -1164,6 +1164,7 @@
|
||||
"type": {
|
||||
"description": "Select the type of notification channel to create.",
|
||||
"optionType": "Type",
|
||||
"rocketChat": "Rocket.Chat",
|
||||
"title": "Channel type"
|
||||
},
|
||||
"telegram": {
|
||||
|
||||
Reference in new issue
Block a user