Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

chore(notification-channels): remove the v1 channel client and the old list (#12974)

Ashwin Bhatkal8d8fafdaba45
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 09c6884aec..06839cb672 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -213,9 +213,7 @@ go.mod @therealpandey
## Notification Channels
/frontend/src/pages/ChannelsEdit/ @SigNoz/pulse-frontend
/frontend/src/pages/ChannelsNew/ @SigNoz/pulse-frontend
-/frontend/src/container/AllAlertChannels/ @SigNoz/pulse-frontend
/frontend/src/container/CreateAlertChannels/ @SigNoz/pulse-frontend
-/frontend/src/container/EditAlertChannels/ @SigNoz/pulse-frontend
/frontend/src/container/FormAlertChannels/ @SigNoz/pulse-frontend
/frontend/src/hooks/notificationChannels/ @SigNoz/pulse-frontend
diff --git a/frontend/public/locales/en-GB/channels.json b/frontend/public/locales/en-GB/channels.json
index 30b4347499..b177a0993d 100644
--- a/frontend/public/locales/en-GB/channels.json
+++ b/frontend/public/locales/en-GB/channels.json
@@ -1,13 +1,5 @@
{
"channel_delete_unexp_error": "Something went wrong",
- "channel_delete_success": "Channel Deleted Successfully",
- "column_channel_name": "Name",
- "column_channel_type": "Type",
- "column_channel_action": "Action",
- "column_channel_edit": "Edit",
- "button_new_channel": "New Alert Channel",
- "tooltip_notification_channels": "More details on how to setting notification channels",
- "sending_channels_note": "The alerts will be sent to all the configured channels.",
"loading_channels_message": "Loading Channels..",
"page_title_create": "New Notification Channel",
"page_title_edit": "Edit Notification Channel",
@@ -124,12 +116,9 @@
"help_webhook_password": "Specify a password or bearer token",
"help_pager_description": "Shows up as description in pagerduty",
"channel_creation_done": "Successfully created the channel",
- "channel_creation_failed": "An unexpected error occurred while creating this channel",
"channel_edit_done": "Channels Edited Successfully",
- "channel_edit_failed": "An unexpected error occurred while updating this channel",
"selected_channel_invalid": "Channel type selected is invalid",
"username_no_password": "A Password must be provided with user name",
- "test_unsupported": "Sorry, this channel type does not support test yet",
"channel_test_done": "An alert has been sent to this channel",
"channel_test_failed": "Failed to send a test message to this channel, please confirm that the parameters are set correctly",
"channel_test_unexpected": "An unexpected error occurred while sending a message to this channel, please try again",
diff --git a/frontend/public/locales/en/channels.json b/frontend/public/locales/en/channels.json
index 3668ba568d..5a10405e5f 100644
--- a/frontend/public/locales/en/channels.json
+++ b/frontend/public/locales/en/channels.json
@@ -1,13 +1,5 @@
{
"channel_delete_unexp_error": "Something went wrong",
- "channel_delete_success": "Channel Deleted Successfully",
- "column_channel_name": "Name",
- "column_channel_type": "Type",
- "column_channel_action": "Action",
- "column_channel_edit": "Edit",
- "button_new_channel": "New Alert Channel",
- "tooltip_notification_channels": "More details on how to setting notification channels",
- "sending_channels_note": "The alerts will be sent to all the configured channels.",
"channel_load_failed": "This channel could not be opened",
"loading_channels_message": "Loading Channels..",
"page_title_create": "New Notification Channel",
@@ -183,12 +175,9 @@
"help_opsgenie_priority": "Priority of the incident",
"help_opsgenie_description": "Shows up as description in opsgenie",
"channel_creation_done": "Successfully created the channel",
- "channel_creation_failed": "An unexpected error occurred while creating this channel",
"channel_edit_done": "Channels Edited Successfully",
- "channel_edit_failed": "An unexpected error occurred while updating this channel",
"selected_channel_invalid": "Channel type selected is invalid",
"username_no_password": "A Password must be provided with user name",
- "test_unsupported": "Sorry, this channel type does not support test yet",
"channel_test_done": "An alert has been sent to this channel",
"channel_test_failed": "Failed to send a test message to this channel, please confirm that the parameters are set correctly",
"channel_test_unexpected": "An unexpected error occurred while sending a message to this channel, please try again",
diff --git a/frontend/src/api/channels/createEmail.ts b/frontend/src/api/channels/createEmail.ts
deleted file mode 100644
index a464914666..0000000000
--- a/frontend/src/api/channels/createEmail.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/createEmail';
-
-/**
- * @deprecated Use the generated `useCreateChannel` hook (or `createChannel` fetcher) from
- * `api/generated/services/channels` instead. This hand-written client targets the
- * same endpoint and will be removed once call sites migrate.
- *
- * Part of https://github.com/SigNoz/engineering-pod/issues/5289, add a comment or update when removing this method.
- */
-const create = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps>> => {
- try {
- const response = await axios.post<PayloadProps>('/channels', {
- name: props.name,
- email_configs: [
- {
- send_resolved: props.send_resolved,
- to: props.to,
- html: props.html,
- headers: props.headers,
- },
- ],
- });
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default create;
diff --git a/frontend/src/api/channels/createMsTeams.ts b/frontend/src/api/channels/createMsTeams.ts
deleted file mode 100644
index 21f75df6f7..0000000000
--- a/frontend/src/api/channels/createMsTeams.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/createMsTeams';
-
-/**
- * @deprecated Use the generated `useCreateChannel` hook (or `createChannel` fetcher) from
- * `api/generated/services/channels` instead. This hand-written client targets the
- * same endpoint and will be removed once call sites migrate.
- *
- * Part of https://github.com/SigNoz/engineering-pod/issues/5289, add a comment or update when removing this method.
- */
-const create = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps>> => {
- try {
- const response = await axios.post<PayloadProps>('/channels', {
- name: props.name,
- msteamsv2_configs: [
- {
- send_resolved: props.send_resolved,
- webhook_url: props.webhook_url,
- title: props.title,
- text: props.text,
- },
- ],
- });
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default create;
diff --git a/frontend/src/api/channels/createOpsgenie.ts b/frontend/src/api/channels/createOpsgenie.ts
deleted file mode 100644
index 325788f914..0000000000
--- a/frontend/src/api/channels/createOpsgenie.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/createOpsgenie';
-
-/**
- * @deprecated Use the generated `useCreateChannel` hook (or `createChannel` fetcher) from
- * `api/generated/services/channels` instead. This hand-written client targets the
- * same endpoint and will be removed once call sites migrate.
- *
- * Part of https://github.com/SigNoz/engineering-pod/issues/5289, add a comment or update when removing this method.
- */
-const create = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps>> => {
- try {
- const response = await axios.post<PayloadProps>('/channels', {
- name: props.name,
- opsgenie_configs: [
- {
- api_key: props.api_key,
- description: props.description,
- priority: props.priority,
- message: props.message,
- details: {
- ...props.detailsArray,
- },
- },
- ],
- });
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default create;
diff --git a/frontend/src/api/channels/createPager.ts b/frontend/src/api/channels/createPager.ts
deleted file mode 100644
index 9b40c71a4e..0000000000
--- a/frontend/src/api/channels/createPager.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/createPager';
-
-/**
- * @deprecated Use the generated `useCreateChannel` hook (or `createChannel` fetcher) from
- * `api/generated/services/channels` instead. This hand-written client targets the
- * same endpoint and will be removed once call sites migrate.
- *
- * Part of https://github.com/SigNoz/engineering-pod/issues/5289, add a comment or update when removing this method.
- */
-const create = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps>> => {
- try {
- const response = await axios.post<PayloadProps>('/channels', {
- name: props.name,
- pagerduty_configs: [
- {
- send_resolved: props.send_resolved,
- routing_key: props.routing_key,
- client: props.client,
- client_url: props.client_url,
- description: props.description,
- severity: props.severity,
- class: props.class,
- component: props.component,
- group: props.group,
- details: {
- ...props.detailsArray,
- },
- },
- ],
- });
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default create;
diff --git a/frontend/src/api/channels/createSlack.ts b/frontend/src/api/channels/createSlack.ts
deleted file mode 100644
index 3a61ccdf49..0000000000
--- a/frontend/src/api/channels/createSlack.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/createSlack';
-
-/**
- * @deprecated Use the generated `useCreateChannel` hook (or `createChannel` fetcher) from
- * `api/generated/services/channels` instead. This hand-written client targets the
- * same endpoint and will be removed once call sites migrate.
- *
- * Part of https://github.com/SigNoz/engineering-pod/issues/5289, add a comment or update when removing this method.
- */
-const create = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps>> => {
- try {
- const response = await axios.post<PayloadProps>('/channels', {
- name: props.name,
- slack_configs: [
- {
- send_resolved: props.send_resolved,
- api_url: props.api_url,
- channel: props.channel,
- title: props.title,
- text: props.text,
- },
- ],
- });
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default create;
diff --git a/frontend/src/api/channels/createWebhook.ts b/frontend/src/api/channels/createWebhook.ts
deleted file mode 100644
index 1fe8dd98f2..0000000000
--- a/frontend/src/api/channels/createWebhook.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/createWebhook';
-
-/**
- * @deprecated Use the generated `useCreateChannel` hook (or `createChannel` fetcher) from
- * `api/generated/services/channels` instead. This hand-written client targets the
- * same endpoint and will be removed once call sites migrate.
- *
- * Part of https://github.com/SigNoz/engineering-pod/issues/5289, add a comment or update when removing this method.
- */
-const create = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps>> => {
- try {
- let httpConfig = {};
- const username = props.username ? props.username.trim() : '';
- const password = props.password ? props.password.trim() : '';
-
- if (username !== '' && password !== '') {
- httpConfig = {
- basic_auth: {
- username,
- password,
- },
- };
- } else if (username === '' && password !== '') {
- httpConfig = {
- authorization: {
- type: 'Bearer',
- credentials: password,
- },
- };
- }
-
- const response = await axios.post<PayloadProps>('/channels', {
- name: props.name,
- webhook_configs: [
- {
- send_resolved: props.send_resolved,
- url: props.api_url,
- http_config: httpConfig,
- },
- ],
- });
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default create;
diff --git a/frontend/src/api/channels/delete.ts b/frontend/src/api/channels/delete.ts
deleted file mode 100644
index a8701788b6..0000000000
--- a/frontend/src/api/channels/delete.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/delete';
-
-/**
- * @deprecated Use the generated `useDeleteChannelByID` hook (or `deleteChannelByID` fetcher) from
- * `api/generated/services/channels` instead. This hand-written client targets the
- * same endpoint and will be removed once call sites migrate.
- *
- * Part of https://github.com/SigNoz/engineering-pod/issues/5289, add a comment or update when removing this method.
- */
-const deleteChannel = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps>> => {
- try {
- const response = await axios.delete<PayloadProps>(`/channels/${props.id}`);
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default deleteChannel;
diff --git a/frontend/src/api/channels/editEmail.ts b/frontend/src/api/channels/editEmail.ts
deleted file mode 100644
index 4a5443388b..0000000000
--- a/frontend/src/api/channels/editEmail.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/editEmail';
-
-/**
- * @deprecated Use the generated `useUpdateChannelByID` hook (or `updateChannelByID` fetcher) from
- * `api/generated/services/channels` instead. This hand-written client targets the
- * same endpoint and will be removed once call sites migrate.
- *
- * Part of https://github.com/SigNoz/engineering-pod/issues/5289, add a comment or update when removing this method.
- */
-const editEmail = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps>> => {
- try {
- const response = await axios.put<PayloadProps>(`/channels/${props.id}`, {
- name: props.name,
- email_configs: [
- {
- send_resolved: props.send_resolved,
- to: props.to,
- html: props.html,
- headers: props.headers,
- },
- ],
- });
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default editEmail;
diff --git a/frontend/src/api/channels/editMsTeams.ts b/frontend/src/api/channels/editMsTeams.ts
deleted file mode 100644
index 935949ab68..0000000000
--- a/frontend/src/api/channels/editMsTeams.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/editMsTeams';
-
-/**
- * @deprecated Use the generated `useUpdateChannelByID` hook (or `updateChannelByID` fetcher) from
- * `api/generated/services/channels` instead. This hand-written client targets the
- * same endpoint and will be removed once call sites migrate.
- *
- * Part of https://github.com/SigNoz/engineering-pod/issues/5289, add a comment or update when removing this method.
- */
-const editMsTeams = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps>> => {
- try {
- const response = await axios.put<PayloadProps>(`/channels/${props.id}`, {
- name: props.name,
- msteamsv2_configs: [
- {
- send_resolved: props.send_resolved,
- webhook_url: props.webhook_url,
- title: props.title,
- text: props.text,
- },
- ],
- });
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default editMsTeams;
diff --git a/frontend/src/api/channels/editOpsgenie.ts b/frontend/src/api/channels/editOpsgenie.ts
deleted file mode 100644
index 4a16175287..0000000000
--- a/frontend/src/api/channels/editOpsgenie.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorResponse, ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/editOpsgenie';
-
-/**
- * @deprecated Use the generated `useUpdateChannelByID` hook (or `updateChannelByID` fetcher) from
- * `api/generated/services/channels` instead. This hand-written client targets the
- * same endpoint and will be removed once call sites migrate.
- *
- * Part of https://github.com/SigNoz/engineering-pod/issues/5289, add a comment or update when removing this method.
- */
-const editOpsgenie = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps> | ErrorResponse> => {
- try {
- const response = await axios.put<PayloadProps>(`/channels/${props.id}`, {
- name: props.name,
- opsgenie_configs: [
- {
- send_resolved: props.send_resolved,
- api_key: props.api_key,
- description: props.description,
- priority: props.priority,
- message: props.message,
- details: {
- ...props.detailsArray,
- },
- },
- ],
- });
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- return ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default editOpsgenie;
diff --git a/frontend/src/api/channels/editPager.ts b/frontend/src/api/channels/editPager.ts
deleted file mode 100644
index 1c0b5bad65..0000000000
--- a/frontend/src/api/channels/editPager.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/editPager';
-
-/**
- * @deprecated Use the generated `useUpdateChannelByID` hook (or `updateChannelByID` fetcher) from
- * `api/generated/services/channels` instead. This hand-written client targets the
- * same endpoint and will be removed once call sites migrate.
- *
- * Part of https://github.com/SigNoz/engineering-pod/issues/5289, add a comment or update when removing this method.
- */
-const editPager = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps>> => {
- try {
- const response = await axios.put<PayloadProps>(`/channels/${props.id}`, {
- name: props.name,
- pagerduty_configs: [
- {
- send_resolved: props.send_resolved,
- routing_key: props.routing_key,
- client: props.client,
- client_url: props.client_url,
- description: props.description,
- severity: props.severity,
- class: props.class,
- component: props.component,
- group: props.group,
- details: {
- ...props.detailsArray,
- },
- },
- ],
- });
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default editPager;
diff --git a/frontend/src/api/channels/editSlack.ts b/frontend/src/api/channels/editSlack.ts
deleted file mode 100644
index 91ca47473d..0000000000
--- a/frontend/src/api/channels/editSlack.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/editSlack';
-
-/**
- * @deprecated Use the generated `useUpdateChannelByID` hook (or `updateChannelByID` fetcher) from
- * `api/generated/services/channels` instead. This hand-written client targets the
- * same endpoint and will be removed once call sites migrate.
- *
- * Part of https://github.com/SigNoz/engineering-pod/issues/5289, add a comment or update when removing this method.
- */
-const editSlack = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps>> => {
- try {
- const response = await axios.put<PayloadProps>(`/channels/${props.id}`, {
- name: props.name,
- slack_configs: [
- {
- send_resolved: props.send_resolved,
- api_url: props.api_url,
- channel: props.channel,
- title: props.title,
- text: props.text,
- },
- ],
- });
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default editSlack;
diff --git a/frontend/src/api/channels/editWebhook.ts b/frontend/src/api/channels/editWebhook.ts
deleted file mode 100644
index 6cc4d26ce8..0000000000
--- a/frontend/src/api/channels/editWebhook.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/editWebhook';
-
-/**
- * @deprecated Use the generated `useUpdateChannelByID` hook (or `updateChannelByID` fetcher) from
- * `api/generated/services/channels` instead. This hand-written client targets the
- * same endpoint and will be removed once call sites migrate.
- *
- * Part of https://github.com/SigNoz/engineering-pod/issues/5289, add a comment or update when removing this method.
- */
-const editWebhook = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps>> => {
- try {
- let httpConfig = {};
- const username = props.username ? props.username.trim() : '';
- const password = props.password ? props.password.trim() : '';
-
- if (username !== '' && password !== '') {
- httpConfig = {
- basic_auth: {
- username,
- password,
- },
- };
- } else if (username === '' && password !== '') {
- httpConfig = {
- authorization: {
- type: 'Bearer',
- credentials: password,
- },
- };
- }
-
- const response = await axios.put<PayloadProps>(`/channels/${props.id}`, {
- name: props.name,
- webhook_configs: [
- {
- send_resolved: props.send_resolved,
- url: props.api_url,
- http_config: httpConfig,
- },
- ],
- });
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default editWebhook;
diff --git a/frontend/src/api/channels/get.ts b/frontend/src/api/channels/get.ts
deleted file mode 100644
index 087a584886..0000000000
--- a/frontend/src/api/channels/get.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/get';
-import { Channels } from 'types/api/channels/getAll';
-
-/**
- * @deprecated Use the generated `useGetChannelByID` hook (or `getChannelByID` fetcher) from
- * `api/generated/services/channels` instead. This hand-written client targets the
- * same endpoint and will be removed once call sites migrate.
- *
- * Part of https://github.com/SigNoz/engineering-pod/issues/5289, add a comment or update when removing this method.
- */
-const get = async (props: Props): Promise<SuccessResponseV2<Channels>> => {
- try {
- const response = await axios.get<PayloadProps>(`/channels/${props.id}`);
-
- return {
- httpStatusCode: response.status,
- data: response.data.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default get;
diff --git a/frontend/src/api/channels/getAll.ts b/frontend/src/api/channels/getAll.ts
deleted file mode 100644
index 2db4ef7cb9..0000000000
--- a/frontend/src/api/channels/getAll.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { Channels, PayloadProps } from 'types/api/channels/getAll';
-
-/**
- * @deprecated Use the generated `useListChannels` hook (or `listChannels` fetcher) from
- * `api/generated/services/channels` instead. This hand-written client targets the
- * same endpoint and will be removed once call sites migrate.
- *
- * Part of https://github.com/SigNoz/engineering-pod/issues/5289, add a comment or update when removing this method.
- */
-const getAll = async (): Promise<SuccessResponseV2<Channels[]>> => {
- try {
- const response = await axios.get<PayloadProps>('/channels');
-
- return {
- httpStatusCode: response.status,
- data: response.data.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default getAll;
diff --git a/frontend/src/api/channels/testEmail.ts b/frontend/src/api/channels/testEmail.ts
deleted file mode 100644
index 66a934ca9b..0000000000
--- a/frontend/src/api/channels/testEmail.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/createEmail';
-
-const testEmail = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps>> => {
- try {
- const response = await axios.post<PayloadProps>('/testChannel', {
- name: props.name,
- email_configs: [
- {
- send_resolved: true,
- to: props.to,
- html: props.html,
- headers: props.headers,
- },
- ],
- });
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default testEmail;
diff --git a/frontend/src/api/channels/testMsTeams.ts b/frontend/src/api/channels/testMsTeams.ts
deleted file mode 100644
index 5399d7db4a..0000000000
--- a/frontend/src/api/channels/testMsTeams.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/createMsTeams';
-
-const testMsTeams = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps>> => {
- try {
- const response = await axios.post<PayloadProps>('/testChannel', {
- name: props.name,
- msteamsv2_configs: [
- {
- send_resolved: true,
- webhook_url: props.webhook_url,
- title: props.title,
- text: props.text,
- },
- ],
- });
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default testMsTeams;
diff --git a/frontend/src/api/channels/testOpsgenie.ts b/frontend/src/api/channels/testOpsgenie.ts
deleted file mode 100644
index 1cdbfbe36d..0000000000
--- a/frontend/src/api/channels/testOpsgenie.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/createOpsgenie';
-
-const testOpsgenie = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps>> => {
- try {
- const response = await axios.post<PayloadProps>('/testChannel', {
- name: props.name,
- opsgenie_configs: [
- {
- api_key: props.api_key,
- description: props.description,
- priority: props.priority,
- message: props.message,
- details: {
- ...props.detailsArray,
- },
- },
- ],
- });
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default testOpsgenie;
diff --git a/frontend/src/api/channels/testPager.ts b/frontend/src/api/channels/testPager.ts
deleted file mode 100644
index b247229c79..0000000000
--- a/frontend/src/api/channels/testPager.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/createPager';
-
-const testPager = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps>> => {
- try {
- const response = await axios.post<PayloadProps>('/testChannel', {
- name: props.name,
- pagerduty_configs: [
- {
- send_resolved: true,
- routing_key: props.routing_key,
- client: props.client,
- client_url: props.client_url,
- description: props.description,
- severity: props.severity,
- class: props.class,
- component: props.component,
- group: props.group,
- details: {
- ...props.detailsArray,
- },
- },
- ],
- });
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default testPager;
diff --git a/frontend/src/api/channels/testSlack.ts b/frontend/src/api/channels/testSlack.ts
deleted file mode 100644
index 39f04637af..0000000000
--- a/frontend/src/api/channels/testSlack.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/createSlack';
-
-const testSlack = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps>> => {
- try {
- const response = await axios.post<PayloadProps>('/testChannel', {
- name: props.name,
- slack_configs: [
- {
- send_resolved: true,
- api_url: props.api_url,
- channel: props.channel,
- title: props.title,
- text: props.text,
- },
- ],
- });
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default testSlack;
diff --git a/frontend/src/api/channels/testWebhook.ts b/frontend/src/api/channels/testWebhook.ts
deleted file mode 100644
index cce92ff91f..0000000000
--- a/frontend/src/api/channels/testWebhook.ts
+++ /dev/null
@@ -1,52 +0,0 @@
-import axios from 'api';
-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
-import { AxiosError } from 'axios';
-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
-import { PayloadProps, Props } from 'types/api/channels/createWebhook';
-
-const testWebhook = async (
- props: Props,
-): Promise<SuccessResponseV2<PayloadProps>> => {
- try {
- let httpConfig = {};
- const username = props.username ? props.username.trim() : '';
- const password = props.password ? props.password.trim() : '';
-
- if (username !== '' && password !== '') {
- httpConfig = {
- basic_auth: {
- username,
- password,
- },
- };
- } else if (username === '' && password !== '') {
- httpConfig = {
- authorization: {
- type: 'Bearer',
- credentials: password,
- },
- };
- }
-
- const response = await axios.post<PayloadProps>('/testChannel', {
- name: props.name,
- webhook_configs: [
- {
- send_resolved: true,
- url: props.api_url,
- http_config: httpConfig,
- },
- ],
- });
-
- return {
- httpStatusCode: response.status,
- data: response.data,
- };
- } catch (error) {
- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
- throw error;
- }
-};
-
-export default testWebhook;
diff --git a/frontend/src/container/AllAlertChannels/AlertChannels.tsx b/frontend/src/container/AllAlertChannels/AlertChannels.tsx
deleted file mode 100644
index 942baea132..0000000000
--- a/frontend/src/container/AllAlertChannels/AlertChannels.tsx
+++ /dev/null
@@ -1,77 +0,0 @@
-import { useCallback } from 'react';
-import { useTranslation } from 'react-i18next';
-import { generatePath } from 'react-router-dom';
-import { Button } from 'antd';
-import type { ColumnsType } from 'antd/lib/table';
-import { ResizeTable } from 'components/ResizeTable';
-import ROUTES from 'constants/routes';
-import useComponentPermission from 'hooks/useComponentPermission';
-import { useNotifications } from 'hooks/useNotifications';
-import history from 'lib/history';
-import { useAppContext } from 'providers/App/App';
-import { Channels } from 'types/api/channels/getAll';
-
-import Delete from './Delete';
-
-function AlertChannels({ allChannels }: AlertChannelsProps): JSX.Element {
- const { t } = useTranslation(['channels']);
- const { notifications } = useNotifications();
- const { user } = useAppContext();
- const [action] = useComponentPermission(['new_alert_action'], user.role);
-
- const onClickEditHandler = useCallback((id: string) => {
- history.push(
- generatePath(ROUTES.CHANNELS_EDIT, {
- channelId: id,
- }),
- );
- }, []);
-
- const columns: ColumnsType<Channels> = [
- {
- title: t('column_channel_name'),
- dataIndex: 'name',
- key: 'name',
- width: 100,
- },
- {
- title: t('column_channel_type'),
- dataIndex: 'type',
- key: 'type',
- width: 80,
- },
- ];
-
- if (action) {
- columns.push({
- title: t('column_channel_action'),
- dataIndex: 'id',
- key: 'action',
- align: 'center',
- width: 80,
- render: (id: string): JSX.Element => (
- <>
- <Button onClick={(): void => onClickEditHandler(id)} type="link">
- {t('column_channel_edit')}
- </Button>
- <Delete id={id} notifications={notifications} />
- </>
- ),
- });
- }
-
- return (
- <ResizeTable
- columns={columns}
- dataSource={allChannels}
- rowKey="id"
- bordered
- />
- );
-}
-
-interface AlertChannelsProps {
- allChannels: Channels[];
-}
-
-export default AlertChannels;
diff --git a/frontend/src/container/AllAlertChannels/AllAlertChannels.styles.scss b/frontend/src/container/AllAlertChannels/AllAlertChannels.styles.scss
deleted file mode 100644
index 1cbeddb579..0000000000
--- a/frontend/src/container/AllAlertChannels/AllAlertChannels.styles.scss
+++ /dev/null
@@ -1,4 +0,0 @@
-.alert-channels-container {
- width: 100%;
- padding: 0 var(--spacing-8);
-}
diff --git a/frontend/src/container/AllAlertChannels/Delete.tsx b/frontend/src/container/AllAlertChannels/Delete.tsx
deleted file mode 100644
index abfea1d0c4..0000000000
--- a/frontend/src/container/AllAlertChannels/Delete.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-import { useState } from 'react';
-import { useTranslation } from 'react-i18next';
-import { useQueryClient } from 'react-query';
-import { Button } from 'antd';
-import type { NotificationInstance } from 'antd/es/notification/interface';
-import deleteChannel from 'api/channels/delete';
-import APIError from 'types/api/error';
-
-function Delete({ notifications, id }: DeleteProps): JSX.Element {
- const { t } = useTranslation(['channels']);
- const [loading, setLoading] = useState(false);
- const queryClient = useQueryClient();
-
- const onClickHandler = async (): Promise<void> => {
- try {
- setLoading(true);
- await deleteChannel({
- id,
- });
-
- notifications.success({
- message: 'Success',
- description: t('channel_delete_success'),
- });
- // Invalidate and refetch
- queryClient.invalidateQueries(['getChannels']);
- setLoading(false);
- } catch (error) {
- notifications.error({
- message: (error as APIError).getErrorCode(),
- description: (error as APIError).getErrorMessage(),
- });
- setLoading(false);
- }
- };
-
- return (
- <Button
- loading={loading}
- disabled={loading}
- type="link"
- onClick={onClickHandler}
- >
- Delete
- </Button>
- );
-}
-
-interface DeleteProps {
- notifications: NotificationInstance;
- id: string;
-}
-
-export default Delete;
diff --git a/frontend/src/container/AllAlertChannels/__tests__/AlertChannels.test.tsx b/frontend/src/container/AllAlertChannels/__tests__/AlertChannels.test.tsx
deleted file mode 100644
index 82644acc12..0000000000
--- a/frontend/src/container/AllAlertChannels/__tests__/AlertChannels.test.tsx
+++ /dev/null
@@ -1,84 +0,0 @@
-import ROUTES from 'constants/routes';
-import AlertChannels from 'container/AllAlertChannels';
-import { act, fireEvent, render, screen, waitFor } from 'tests/test-utils';
-
-const successNotification = jest.fn();
-jest.mock('hooks/useNotifications', () => ({
- __esModule: true,
- useNotifications: jest.fn(() => ({
- notifications: {
- success: successNotification,
- error: jest.fn(),
- },
- })),
-}));
-
-jest.mock('react-router-dom', () => ({
- ...jest.requireActual('react-router-dom'),
- useLocation: (): { pathname: string } => ({
- pathname: `${process.env.FRONTEND_API_ENDPOINT}${ROUTES.ALL_CHANNELS}`,
- }),
-}));
-
-describe('Alert Channels Settings List page', () => {
- beforeEach(async () => {
- jest.useFakeTimers();
- jest.setSystemTime(new Date('2023-10-20'));
- render(<AlertChannels />);
- await waitFor(() =>
- expect(screen.getByText('sending_channels_note')).toBeInTheDocument(),
- );
- });
- afterEach(() => {
- jest.restoreAllMocks();
- jest.useRealTimers();
- });
- describe('Should display the Alert Channels page properly', () => {
- it('Should check if "The alerts will be sent to all the configured channels." is visible', () => {
- expect(screen.getByText('sending_channels_note')).toBeInTheDocument();
- });
- it('Should check if "New Alert Channel" Button is visble', () => {
- expect(screen.getByText('button_new_channel')).toBeInTheDocument();
- });
- it('Should check if the help icon is visible and displays "tooltip_notification_channels', async () => {
- const helpIcon = screen.getByRole('img', { name: /help/i });
-
- fireEvent.mouseOver(helpIcon);
-
- await waitFor(() => {
- const tooltip = screen.getByText('tooltip_notification_channels');
- expect(tooltip).toBeInTheDocument();
- });
- });
- });
- describe('Should check if the channels table is properly displayed', () => {
- it('Should check if the table columns are properly displayed', () => {
- expect(screen.getByText('column_channel_name')).toBeInTheDocument();
- expect(screen.getByText('column_channel_type')).toBeInTheDocument();
- expect(screen.getByText('column_channel_action')).toBeInTheDocument();
- });
-
- it('Should check if the data in the table is displayed properly', () => {
- expect(screen.getByText('Dummy-Channel')).toBeInTheDocument();
- expect(screen.getAllByText('slack')[0]).toBeInTheDocument();
- expect(screen.getAllByText('column_channel_edit')[0]).toBeInTheDocument();
- expect(screen.getAllByText('Delete')[0]).toBeInTheDocument();
- });
-
- it('Should check if clicking on Delete displays Success Toast "Channel Deleted Successfully"', async () => {
- const deleteButton = screen.getAllByRole('button', { name: 'Delete' })[0];
- expect(deleteButton).toBeInTheDocument();
-
- act(() => {
- fireEvent.click(deleteButton);
- });
-
- await waitFor(() => {
- expect(successNotification).toHaveBeenCalledWith({
- message: 'Success',
- description: 'channel_delete_success',
- });
- });
- });
- });
-});
diff --git a/frontend/src/container/AllAlertChannels/__tests__/AlertChannelsNormalUser.test.tsx b/frontend/src/container/AllAlertChannels/__tests__/AlertChannelsNormalUser.test.tsx
deleted file mode 100644
index b9e247b450..0000000000
--- a/frontend/src/container/AllAlertChannels/__tests__/AlertChannelsNormalUser.test.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-import ROUTES from 'constants/routes';
-import AlertChannels from 'container/AllAlertChannels';
-import { fireEvent, render, screen, waitFor } from 'tests/test-utils';
-
-const successNotification = jest.fn();
-jest.mock('hooks/useNotifications', () => ({
- __esModule: true,
- useNotifications: jest.fn(() => ({
- notifications: {
- success: successNotification,
- error: jest.fn(),
- },
- })),
-}));
-
-jest.mock('hooks/useComponentPermission', () => ({
- __esModule: true,
- default: jest.fn().mockImplementation(() => [false]),
-}));
-
-jest.mock('react-router-dom', () => ({
- ...jest.requireActual('react-router-dom'),
- useLocation: (): { pathname: string } => ({
- pathname: `${process.env.FRONTEND_API_ENDPOINT}${ROUTES.ALL_CHANNELS}`,
- }),
-}));
-
-describe('Alert Channels Settings List page (Normal User)', () => {
- beforeEach(async () => {
- jest.useFakeTimers();
- render(<AlertChannels />);
- await waitFor(() =>
- expect(screen.getByText('sending_channels_note')).toBeInTheDocument(),
- );
- });
- afterEach(() => {
- jest.restoreAllMocks();
- jest.useRealTimers();
- });
- describe('Should display the Alert Channels page properly', () => {
- it('Should check if "The alerts will be sent to all the configured channels." is visible', async () => {
- await waitFor(() =>
- expect(screen.getByText('sending_channels_note')).toBeInTheDocument(),
- );
- });
-
- it('Should check if "New Alert Channel" Button is visble and disabled', async () => {
- const newAlertButton = screen.getByRole('button', {
- name: /button_new_channel/i,
- });
- await waitFor(() => expect(newAlertButton).toBeInTheDocument());
- expect(newAlertButton).toBeDisabled();
- });
- it('Should check if the help icon is visible and displays "tooltip_notification_channels', async () => {
- const helpIcon = screen.getByRole('img', { name: /help/i });
- fireEvent.mouseOver(helpIcon);
-
- await waitFor(() => {
- const tooltip = screen.getByText('tooltip_notification_channels');
- expect(tooltip).toBeInTheDocument();
- });
- });
- });
- describe('Should check if the channels table is properly displayed', () => {
- it('Should check if the table columns are properly displayed', async () => {
- expect(screen.getByText('column_channel_name')).toBeInTheDocument();
- expect(screen.getByText('column_channel_type')).toBeInTheDocument();
- expect(screen.queryByText('column_channel_action')).not.toBeInTheDocument();
- });
-
- it('Should check if the data in the table is displayed properly', async () => {
- expect(screen.getByText('Dummy-Channel')).toBeInTheDocument();
- expect(screen.getAllByText('slack')[0]).toBeInTheDocument();
- expect(screen.queryByText('column_channel_edit')).not.toBeInTheDocument();
- expect(screen.queryByText('Delete')).not.toBeInTheDocument();
- });
- });
-});
diff --git a/frontend/src/container/AllAlertChannels/index.tsx b/frontend/src/container/AllAlertChannels/index.tsx
deleted file mode 100644
index 1e6a76a9ae..0000000000
--- a/frontend/src/container/AllAlertChannels/index.tsx
+++ /dev/null
@@ -1,95 +0,0 @@
-import { useCallback, useEffect } from 'react';
-import { useTranslation } from 'react-i18next';
-import { useQuery } from 'react-query';
-import { Plus } from '@signozhq/icons';
-import { Tooltip, Flex } from 'antd';
-import { Typography } from '@signozhq/ui/typography';
-import getAll from 'api/channels/getAll';
-import logEvent from 'api/common/logEvent';
-import Spinner from 'components/Spinner';
-import TextToolTip from 'components/TextToolTip';
-import ROUTES from 'constants/routes';
-import useComponentPermission from 'hooks/useComponentPermission';
-import history from 'lib/history';
-import { isUndefined } from 'lodash-es';
-import { useAppContext } from 'providers/App/App';
-import { SuccessResponseV2 } from 'types/api';
-import { Channels } from 'types/api/channels/getAll';
-import APIError from 'types/api/error';
-
-import AlertChannelsComponent from './AlertChannels';
-import { Button, ButtonContainer, RightActionContainer } from './styles';
-
-import './AllAlertChannels.styles.scss';
-
-const { Text } = Typography;
-
-function AlertChannels(): JSX.Element {
- const { t } = useTranslation(['channels']);
- const { user } = useAppContext();
- const [addNewChannelPermission] = useComponentPermission(
- ['add_new_channel'],
- user.role,
- );
- const onToggleHandler = useCallback(() => {
- history.push(ROUTES.CHANNELS_NEW);
- }, []);
-
- const { isLoading, data, error } = useQuery<
- SuccessResponseV2<Channels[]>,
- APIError
- >(['getChannels'], {
- queryFn: () => getAll(),
- });
-
- useEffect(() => {
- if (!isUndefined(data?.data)) {
- logEvent('Alert Channel: Channel list page visited', {
- number: data?.data?.length,
- });
- }
- }, [data?.data]);
-
- if (error) {
- return <Typography>{error.getErrorMessage()}</Typography>;
- }
-
- if (isLoading || isUndefined(data?.data)) {
- return <Spinner tip={t('loading_channels_message')} height="90vh" />;
- }
-
- return (
- <div className="alert-channels-container">
- <ButtonContainer>
- <Text truncate={1} color="muted">
- {t('sending_channels_note')}
- </Text>
-
- <RightActionContainer>
- <TextToolTip
- text={t('tooltip_notification_channels')}
- url="https://signoz.io/docs/setup-alerts-notification/"
- />
-
- <Tooltip
- title={
- !addNewChannelPermission
- ? 'Ask an admin to create alert channel'
- : undefined
- }
- >
- <Button onClick={onToggleHandler} disabled={!addNewChannelPermission}>
- <Flex align="center" justify="center" gap={4}>
- <Plus size="md" /> {t('button_new_channel')}
- </Flex>
- </Button>
- </Tooltip>
- </RightActionContainer>
- </ButtonContainer>
-
- <AlertChannelsComponent allChannels={data?.data || []} />
- </div>
- );
-}
-
-export default AlertChannels;
diff --git a/frontend/src/container/AllAlertChannels/styles.ts b/frontend/src/container/AllAlertChannels/styles.ts
deleted file mode 100644
index 454e48aeaf..0000000000
--- a/frontend/src/container/AllAlertChannels/styles.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { Button as ButtonComponent } from 'antd';
-import styled from 'styled-components';
-
-export const RightActionContainer = styled.div`
- &&& {
- display: flex;
- align-items: center;
- }
-`;
-
-export const ButtonContainer = styled.div`
- &&& {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-top: 1rem;
- margin-bottom: 1rem;
- padding-right: 1rem;
- }
-`;
-
-export const Button = styled(ButtonComponent)`
- &&& {
- margin-left: 1rem;
- }
-`;
diff --git a/frontend/src/container/CreateAlertChannels/config.ts b/frontend/src/container/CreateAlertChannels/config.ts
deleted file mode 100644
index 7bb9cd4efe..0000000000
--- a/frontend/src/container/CreateAlertChannels/config.ts
+++ /dev/null
@@ -1,194 +0,0 @@
-export interface Channel {
- send_resolved?: boolean;
- name: string;
- filter?: Partial<Array<LabelFilterStatement>>;
-}
-
-export interface SlackChannel extends Channel {
- api_url?: string;
- channel?: string;
- title?: string;
- text?: string;
-}
-
-export interface WebhookChannel extends Channel {
- api_url?: string;
- // basic auth
- username?: string;
- password?: string;
-}
-
-// PagerChannel configures alert manager to send
-// events to pagerduty
-export interface PagerChannel extends Channel {
- // ref: https://prometheus.io/docs/alerting/latest/configuration/#pagerduty_config
- routing_key?: string;
- // displays source of the event in pager duty
- client?: string;
- client_url?: string;
- // A description of the incident
- description?: string;
- // Severity of the incident
- severity?: string;
- // The part or component of the affected system that is broken
- component?: string;
- // A cluster or grouping of sources
- group?: string;
- // The class/type of the event.
- class?: string;
-
- details?: string;
- detailsArray?: Record<string, string>;
-}
-
-// OpsgenieChannel configures alert manager to send
-// events to opsgenie
-export interface OpsgenieChannel extends Channel {
- // ref: https://prometheus.io/docs/alerting/latest/configuration/#opsgenie_config
- api_key: string;
-
- message?: string;
-
- // A description of the incident
- description?: string;
-
- // A backlink to the sender of the notification.
- source?: string;
-
- // A set of arbitrary key/value pairs that provide further detail
- // about the alert.
- details?: string;
- detailsArray?: Record<string, string>;
-
- // Priority level of alert. Possible values are P1, P2, P3, P4, and P5.
- priority?: string;
-}
-
-export interface EmailChannel extends Channel {
- // comma separated list of email addresses to send alerts to
- to: string;
- // HTML body of the email notification.
- html: string;
- // Further headers email header key/value pairs.
- // [ headers: { <string>: <tmpl_string>, ... } ]
- headers: Record<string, string>;
-}
-
-export const ValidatePagerChannel = (p: PagerChannel): string => {
- if (!p) {
- return 'Received unexpected input for this channel, please contact your administrator ';
- }
-
- if (!p.name || p.name === '') {
- return 'Name is mandatory for creating a channel';
- }
-
- if (!p.routing_key || p.routing_key === '') {
- return 'Routing Key is mandatory for creating pagerduty channel';
- }
-
- // validate details json
- try {
- JSON.parse(p.details || '{}');
- } catch (e) {
- return 'failed to parse additional information, please enter a valid json';
- }
-
- return '';
-};
-
-export enum ChannelType {
- Slack = 'slack',
- Email = 'email',
- Webhook = 'webhook',
- Pagerduty = 'pagerduty',
- Opsgenie = 'opsgenie',
- MsTeams = 'msteams',
- GoogleChat = 'googlechat',
- Jira = 'jira',
- JsmOps = 'jsmops',
- IncidentIO = 'incidentio',
-}
-
-// LabelFilterStatement will be used for preparing filter conditions / matchers
-export interface LabelFilterStatement {
- // ref: https://prometheus.io/docs/alerting/latest/configuration/#matcher
-
- // label name
- name: string;
-
- // comparators supported by promql are =, !=, =~, or !~. =
- comparator: string;
-
- // filter value
- value: string;
-}
-
-export interface MsTeamsChannel extends Channel {
- webhook_url?: string;
- title?: string;
- text?: string;
-}
-
-export interface GoogleChatChannel extends Channel {
- // incoming webhook url of the google chat space, must be an
- // https url on chat.googleapis.com
- webhook_url?: string;
- title?: string;
- text?: string;
-}
-
-// JiraChannel configures the Jira Cloud alert channel. Auth is basic auth
-// (Atlassian account email + API token) carried in username / password.
-export interface JiraChannel extends Channel {
- // Jira Cloud base URL, e.g. https://acme.atlassian.net
- site: string;
- project: string;
- issue_type: string;
- // issue title template
- summary?: string;
- // issue body template, rendered to rich text server-side
- description?: string;
- // basic auth: username is the Atlassian account email, password is the API token
- username: string;
- password: string;
- priority?: string;
- labels?: string[];
- resolve_transition?: string;
- reopen_transition?: string;
- // issues resolved with this resolution are never reopened; a refire
- // creates a new issue instead
- wont_fix_resolution?: string;
- // duration string, e.g. 72h or 3d
- reopen_duration?: string;
-}
-
-// IncidentIOChannel configures the incident.io alert channel, backed by an
-// incident.io HTTP alert source (Alert Events V2 API).
-export interface IncidentIOChannel extends Channel {
- // per-source alert events URL, e.g.
- // https://api.incident.io/v2/alert_events/http/<source_config_id>
- url: string;
- // the alert source's secret token
- token: string;
- // alert title template
- title?: string;
- // alert body template (markdown, rendered natively by incident.io)
- description?: string;
- // extra metadata pairs merged over the alert's labels (channel wins on clash)
- metadata?: Record<string, string>;
-}
-
-// JsmOpsChannel configures the Jira Service Management Ops alert channel
-// (ex-Opsgenie alert API). Auth is the JSM integration API key.
-export interface JsmOpsChannel extends Channel {
- api_key: string;
- // alert title template
- message?: string;
- // alert body template (markdown, rendered to HTML server-side)
- description?: string;
- // priority template, resolves to P1-P5
- priority?: string;
- // tags, joined to a comma-separated string for the backend
- tags?: string[];
-}
diff --git a/frontend/src/mocks-server/__mockdata__/alerts.ts b/frontend/src/mocks-server/__mockdata__/alerts.ts
index 557a74372d..f0f253a380 100644
--- a/frontend/src/mocks-server/__mockdata__/alerts.ts
+++ b/frontend/src/mocks-server/__mockdata__/alerts.ts
@@ -1,15 +1,3 @@
-export const allAlertChannels = [
- {
- id: '3',
- created_at: '2023-08-09T04:45:19.239344617Z',
- updated_at: '2024-06-27T11:37:14.841184399Z',
- name: 'Dummy-Channel',
- type: 'slack',
- data:
- '{"name":"Dummy-Channel","slack_configs":[{"api_url":"https://discord.com/api/webhooks/dummy_webhook_id/dummy_webhook_token/slack","channel":"#dummy_channel","send_resolved":true,"text":"{{ range .Alerts -}}\\n *Alert:* {{ .Labels.alertname }}{{ if .Labels.severity }} - {{ .Labels.severity }}{{ end }} dummy_summary\\n\\n *Summary:* {{ .Annotations.summary }}\\n *Description:* {{ .Annotations.description }}\\n\\n *Details:*\\n {{ range .Labels.SortedPairs }} • *{{ .Name }}:* {{ .Value }}\\n {{ end }}\\n {{ end }}","title":"[{{ .Status | toUpper }}{{ if eq .Status \\"firing\\" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .CommonLabels.alertname }} for {{ .CommonLabels.job }}\\n {{- if gt (len .CommonLabels) (len .GroupLabels) -}}\\n {{\\" \\"}}(\\n {{- with .CommonLabels.Remove .GroupLabels.Names }}\\n {{- range $index, $label := .SortedPairs -}}\\n {{ if $index }}, {{ end }}\\n {{- $label.Name }}=\\"{{ $label.Value -}}\\"\\n {{- end }}\\n {{- end -}}\\n )\\n {{- end }}"}]}',
- },
-];
-
export const editAlertChannelInitialValue = {
api_url:
'https://discord.com/api/webhooks/dummy_webhook_id/dummy_webhook_token/slack',
diff --git a/frontend/src/mocks-server/handlers.ts b/frontend/src/mocks-server/handlers.ts
index 3b0d322375..07394a6499 100644
--- a/frontend/src/mocks-server/handlers.ts
+++ b/frontend/src/mocks-server/handlers.ts
@@ -3,7 +3,6 @@ import { rest } from 'msw';
import commonEnTranslation from '../../public/locales/en/common.json';
import enTranslation from '../../public/locales/en/translation.json';
import {
- allAlertChannels,
notificationChannelsV2,
notificationChannelV2,
} from './__mockdata__/alerts';
@@ -206,9 +205,6 @@ export const handlers = [
(req, res, ctx) => res(ctx.status(200), ctx.json(traceDetailResponse)),
),
- rest.get('http://localhost/api/v1/channels', (_, res, ctx) =>
- res(ctx.status(200), ctx.json({ data: allAlertChannels, status: 'success' })),
- ),
rest.get('http://localhost/api/v2/notification_channels', (req, res, ctx) => {
const query = req.url.searchParams.get('query')?.toLowerCase() ?? '';
const kind = req.url.searchParams.get('kind');
@@ -267,15 +263,6 @@ export const handlers = [
rest.delete('http://localhost/api/v2/rules/:id', (_, res, ctx) =>
res(ctx.status(200), ctx.json({ status: 'success' })),
),
- rest.delete('http://localhost/api/v1/channels/:id', (_, res, ctx) =>
- res(
- ctx.status(200),
- ctx.json({
- status: 'success',
- data: 'notification channel successfully deleted',
- }),
- ),
- ),
rest.get('http://localhost/locales/en/translation.json', (_, res, ctx) =>
res(ctx.status(200), ctx.json(enTranslation)),
),
diff --git a/frontend/src/pages/AlertList/stories/__story_mockdata__/alerts.ts b/frontend/src/pages/AlertList/stories/__story_mockdata__/alerts.ts
index 7be7bc4954..e48f4a5725 100644
--- a/frontend/src/pages/AlertList/stories/__story_mockdata__/alerts.ts
+++ b/frontend/src/pages/AlertList/stories/__story_mockdata__/alerts.ts
@@ -31,7 +31,6 @@ import {
type AlertmanagertypesListedNotificationChannelDTO,
} from 'api/generated/services/sigNoz.schemas';
import { NEW_ALERT_SCHEMA_VERSION } from 'types/api/alerts/alertTypesV2';
-import type { Channels } from 'types/api/channels/getAll';
const MINUTE = 60 * 1000;
const HOUR = 60 * MINUTE;
@@ -694,19 +693,6 @@ const CHANNEL_SEEDS: ChannelSeed[] = [
export const CHANNEL_MAX = CHANNEL_SEEDS.length;
-const buildChannel = (index: number): Channels => {
- const seed = CHANNEL_SEEDS[index % CHANNEL_SEEDS.length];
-
- return {
- id: String(index + 1),
- name: seed.name,
- type: seed.type,
- created_at: ago((index + 10) * DAY),
- updated_at: ago((index + 1) * DAY),
- data: JSON.stringify({ name: seed.name, ...seed.receiver }),
- };
-};
-
const buildListedChannel = (
index: number,
): AlertmanagertypesListedNotificationChannelDTO => {
@@ -722,14 +708,6 @@ const buildListedChannel = (
};
};
-/** The v2 list, which is what the channel pickers read. */
-export const channelsResponse = (
- count: number,
-): { status: string; data: Channels[] } => ({
- status: 'success',
- data: Array.from({ length: count }, (_unused, index) => buildChannel(index)),
-});
-
/** The v2 list, which is what the redesigned channels list reads. */
export const notificationChannelsResponse = (
count: number,
@@ -797,7 +775,10 @@ export const notificationChannelByRowId = (
/** Channel names the alert form and the routing policies pick from. */
export const channelNames = (count: number): string[] =>
- channelsResponse(count).data.map((channel) => channel.name);
+ Array.from(
+ { length: count },
+ (_unused, index) => CHANNEL_SEEDS[index % CHANNEL_SEEDS.length].name,
+ );
/**
* The v2 spec each kind is fetched with, so the edit form renders populated
@@ -868,19 +849,6 @@ const CHANNEL_SPECS: Record<ChannelType, Record<string, unknown>> = {
},
};
-/** A single channel as the v2 API returns it, which the edit screen reads. */
-export const channelResponse = (
- id: string,
- type: ChannelType,
-): { status: string; data: Channels } => {
- const index = CHANNEL_SEEDS.findIndex((seed) => seed.type === type);
-
- return {
- status: 'success',
- data: { ...buildChannel(Math.max(index, 0)), id },
- };
-};
-
/** The v2 fetch by id, which is what the redesigned screens read. */
export const notificationChannelResponse = (
id: string,
diff --git a/frontend/src/types/api/channels/createEmail.ts b/frontend/src/types/api/channels/createEmail.ts
deleted file mode 100644
index 652e848773..0000000000
--- a/frontend/src/types/api/channels/createEmail.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { EmailChannel } from 'container/CreateAlertChannels/config';
-
-export type Props = EmailChannel;
-
-export interface PayloadProps {
- data: string;
- status: string;
-}
diff --git a/frontend/src/types/api/channels/createMsTeams.ts b/frontend/src/types/api/channels/createMsTeams.ts
deleted file mode 100644
index 186d0fd542..0000000000
--- a/frontend/src/types/api/channels/createMsTeams.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { MsTeamsChannel } from 'container/CreateAlertChannels/config';
-
-export type Props = MsTeamsChannel;
-
-export interface PayloadProps {
- data: string;
- status: string;
-}
diff --git a/frontend/src/types/api/channels/createOpsgenie.ts b/frontend/src/types/api/channels/createOpsgenie.ts
deleted file mode 100644
index 68b3b4bc2d..0000000000
--- a/frontend/src/types/api/channels/createOpsgenie.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { OpsgenieChannel } from 'container/CreateAlertChannels/config';
-
-export type Props = OpsgenieChannel;
-
-export interface PayloadProps {
- data: string;
- status: string;
-}
diff --git a/frontend/src/types/api/channels/createPager.ts b/frontend/src/types/api/channels/createPager.ts
deleted file mode 100644
index 4a50cff577..0000000000
--- a/frontend/src/types/api/channels/createPager.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { PagerChannel } from 'container/CreateAlertChannels/config';
-
-export type Props = PagerChannel;
-
-export interface PayloadProps {
- data: string;
- status: string;
-}
diff --git a/frontend/src/types/api/channels/createSlack.ts b/frontend/src/types/api/channels/createSlack.ts
deleted file mode 100644
index ebc6ede56a..0000000000
--- a/frontend/src/types/api/channels/createSlack.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { SlackChannel } from 'container/CreateAlertChannels/config';
-
-export type Props = SlackChannel;
-
-export interface PayloadProps {
- data: string;
- status: string;
-}
diff --git a/frontend/src/types/api/channels/createWebhook.ts b/frontend/src/types/api/channels/createWebhook.ts
deleted file mode 100644
index 295bb55f90..0000000000
--- a/frontend/src/types/api/channels/createWebhook.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { WebhookChannel } from 'container/CreateAlertChannels/config';
-
-export type Props = WebhookChannel;
-
-export interface PayloadProps {
- data: string;
- status: string;
-}
diff --git a/frontend/src/types/api/channels/delete.ts b/frontend/src/types/api/channels/delete.ts
deleted file mode 100644
index 9df1423bc1..0000000000
--- a/frontend/src/types/api/channels/delete.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { Channels } from './getAll';
-
-export interface Props {
- id: Channels['id'];
-}
-
-export interface PayloadProps {
- status: string;
- data: string;
-}
diff --git a/frontend/src/types/api/channels/editEmail.ts b/frontend/src/types/api/channels/editEmail.ts
deleted file mode 100644
index 3dfe404e28..0000000000
--- a/frontend/src/types/api/channels/editEmail.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { EmailChannel } from 'container/CreateAlertChannels/config';
-
-export interface Props extends EmailChannel {
- id: string;
-}
-
-export interface PayloadProps {
- data: string;
- status: string;
-}
diff --git a/frontend/src/types/api/channels/editMsTeams.ts b/frontend/src/types/api/channels/editMsTeams.ts
deleted file mode 100644
index 60962458d1..0000000000
--- a/frontend/src/types/api/channels/editMsTeams.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { MsTeamsChannel } from 'container/CreateAlertChannels/config';
-
-export interface Props extends MsTeamsChannel {
- id: string;
-}
-
-export interface PayloadProps {
- data: string;
- status: string;
-}
diff --git a/frontend/src/types/api/channels/editOpsgenie.ts b/frontend/src/types/api/channels/editOpsgenie.ts
deleted file mode 100644
index 39c72f3ca6..0000000000
--- a/frontend/src/types/api/channels/editOpsgenie.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { OpsgenieChannel } from 'container/CreateAlertChannels/config';
-
-export interface Props extends OpsgenieChannel {
- id: string;
-}
-
-export interface PayloadProps {
- data: string;
- status: string;
-}
diff --git a/frontend/src/types/api/channels/editPager.ts b/frontend/src/types/api/channels/editPager.ts
deleted file mode 100644
index 8f9cd3ed11..0000000000
--- a/frontend/src/types/api/channels/editPager.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { PagerChannel } from 'container/CreateAlertChannels/config';
-
-export interface Props extends PagerChannel {
- id: string;
-}
-
-export interface PayloadProps {
- data: string;
- status: string;
-}
diff --git a/frontend/src/types/api/channels/editSlack.ts b/frontend/src/types/api/channels/editSlack.ts
deleted file mode 100644
index b84ffe830e..0000000000
--- a/frontend/src/types/api/channels/editSlack.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { SlackChannel } from 'container/CreateAlertChannels/config';
-
-export interface Props extends SlackChannel {
- id: string;
-}
-
-export interface PayloadProps {
- data: string;
- status: string;
-}
diff --git a/frontend/src/types/api/channels/editWebhook.ts b/frontend/src/types/api/channels/editWebhook.ts
deleted file mode 100644
index 475bdb057c..0000000000
--- a/frontend/src/types/api/channels/editWebhook.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { WebhookChannel } from 'container/CreateAlertChannels/config';
-
-export interface Props extends WebhookChannel {
- id: string;
-}
-
-export interface PayloadProps {
- data: string;
- status: string;
-}
diff --git a/frontend/src/types/api/channels/get.ts b/frontend/src/types/api/channels/get.ts
deleted file mode 100644
index 5e370fada7..0000000000
--- a/frontend/src/types/api/channels/get.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { Channels } from './getAll';
-
-export interface Props {
- id: Channels['id'];
-}
-
-export type PayloadProps = {
- data: Channels;
- status: string;
-};
diff --git a/frontend/src/types/api/channels/getAll.ts b/frontend/src/types/api/channels/getAll.ts
deleted file mode 100644
index 38546c54b7..0000000000
--- a/frontend/src/types/api/channels/getAll.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-export type PayloadProps = {
- data: Channels[];
- status: string;
-};
-
-export interface Channels {
- created_at: string;
- data: string;
- id: string;
- name: string;
- type: string;
- updated_at: string;
-}