mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-04-29 13:10:03 -05:00
Extracted string to use i18n implementation.
This commit is contained in:
@@ -90,7 +90,10 @@ const useNotifications = () => {
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await networkService.axiosInstance.post('/notifications/test-webhook', payload);
|
||||
const response = await networkService.testNotification({
|
||||
platform: type,
|
||||
payload: payload
|
||||
});
|
||||
|
||||
if (response.data.success === true) {
|
||||
toast.success(t('notifications.testSuccess'));
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useNavigate, useParams } from "react-router-dom";
|
||||
import { useEffect } from "react";
|
||||
import { useState } from "react";
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
// Utility and Network
|
||||
import { checkEndpointResolution } from "../../../Features/UptimeMonitors/uptimeMonitorsSlice";
|
||||
@@ -74,6 +75,7 @@ const CreateMonitor = () => {
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
const theme = useTheme();
|
||||
const { t } = useTranslation();
|
||||
const { monitorId } = useParams();
|
||||
const crumbs = [
|
||||
{ name: "uptime", path: "/uptime" },
|
||||
@@ -418,8 +420,8 @@ const CreateMonitor = () => {
|
||||
variant="contained"
|
||||
color="accent"
|
||||
onClick={handleOpenNotificationModal}
|
||||
>
|
||||
Notification Integration
|
||||
>
|
||||
{t('notifications.integrationButton')}
|
||||
</Button>
|
||||
</Box>
|
||||
|
||||
|
||||
@@ -669,6 +669,28 @@ class NetworkService {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ************************************
|
||||
* Test a notification integration
|
||||
* ************************************
|
||||
*
|
||||
* @async
|
||||
* @param {Object} config - The configuration object.
|
||||
* @param {string} config.platform - The notification platform (slack, discord, telegram, webhook).
|
||||
* @param {Object} config.payload - The payload with configuration for the notification.
|
||||
* @returns {Promise<AxiosResponse>} The response from the axios POST request.
|
||||
*/
|
||||
async testNotification(config) {
|
||||
return this.axiosInstance.post('/notifications/test-webhook', {
|
||||
platform: config.platform,
|
||||
...config.payload
|
||||
}, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ************************************
|
||||
* Creates a maintenance window
|
||||
|
||||
@@ -147,6 +147,7 @@
|
||||
"enableNotifications": "Enable {{platform}} notifications",
|
||||
"testNotification": "Test notification",
|
||||
"addOrEditNotifications": "Add or edit notifications",
|
||||
"integrationButton": "Notification Integration",
|
||||
"slack": {
|
||||
"label": "Slack",
|
||||
"description": "To enable Slack notifications, create a Slack app and enable incoming webhooks. After that, simply provide the webhook URL here.",
|
||||
|
||||
Reference in New Issue
Block a user