diff --git a/models/interfaces.ts b/models/interfaces.ts index 013245ed..083b1799 100644 --- a/models/interfaces.ts +++ b/models/interfaces.ts @@ -8,7 +8,6 @@ import { WebhookMethodType } from '../public/pages/Channels/types'; import { CHANNEL_TYPE, ENCRYPTION_TYPE, - NOTIFICATION_SOURCE, } from '../public/utils/constants'; export interface ChannelStatus { @@ -31,7 +30,6 @@ export type SenderType = 'smtp_account' | 'ses_account'; export interface ChannelItemType extends ConfigType { config_type: keyof typeof CHANNEL_TYPE; - feature_list: Array; is_enabled: boolean; // active or muted slack?: { url: string; diff --git a/public/pages/Channels/components/details/ChannelDetailsActions.tsx b/public/pages/Channels/components/details/ChannelDetailsActions.tsx index 0f113bce..e7bb7d1e 100644 --- a/public/pages/Channels/components/details/ChannelDetailsActions.tsx +++ b/public/pages/Channels/components/details/ChannelDetailsActions.tsx @@ -41,7 +41,6 @@ export function ChannelDetailsActions(props: ChannelDetailsActionsProps) { try { await servicesContext.notificationService.sendTestMessage( props.channel.config_id, - props.channel.feature_list[0] ); coreContext.notifications.toasts.addSuccess( 'Successfully sent a test message.' @@ -62,7 +61,6 @@ export function ChannelDetailsActions(props: ChannelDetailsActionsProps) { { label: 'Send test message', disabled: - props.channel.feature_list.length === 0 || !props.channel.config_id || !props.channel.is_enabled, action: sendTestMessage, diff --git a/public/pages/CreateChannel/CreateChannel.tsx b/public/pages/CreateChannel/CreateChannel.tsx index fc694cc7..c87fd8f9 100644 --- a/public/pages/CreateChannel/CreateChannel.tsx +++ b/public/pages/CreateChannel/CreateChannel.tsx @@ -264,7 +264,6 @@ export function CreateChannel(props: CreateChannelsProps) { name, description, config_type: channelType, - feature_list: ['alerting'], // TODO: Remove this from config when the backend no longer requires it is_enabled: isEnabled, }; if (channelType === BACKEND_CHANNEL_TYPE.SLACK) { @@ -327,7 +326,6 @@ export function CreateChannel(props: CreateChannelsProps) { await servicesContext.notificationService.sendTestMessage( tempChannelId, - config.feature_list[0] // for test message any source works ); coreContext.notifications.toasts.addSuccess( 'Successfully sent a test message.' diff --git a/public/pages/Emails/__tests__/helper.test.ts b/public/pages/Emails/__tests__/helper.test.ts index ca9f2049..841969a5 100644 --- a/public/pages/Emails/__tests__/helper.test.ts +++ b/public/pages/Emails/__tests__/helper.test.ts @@ -21,7 +21,6 @@ describe('creates sender and recipient groups as config object', () => { expect(config).toEqual({ name: 'sender', config_type: 'smtp_account', - feature_list: ['alerting', 'index_management', 'reports'], is_enabled: true, smtp_account: { host: 'test.com', @@ -52,7 +51,6 @@ describe('creates sender and recipient groups as config object', () => { name: 'recipient group', config_type: 'email_group', description: 'test description', - feature_list: ['alerting', 'index_management', 'reports'], is_enabled: true, email_group: { recipient_list: [ diff --git a/public/pages/Emails/utils/helper.ts b/public/pages/Emails/utils/helper.ts index 766a2d5c..acb9c292 100644 --- a/public/pages/Emails/utils/helper.ts +++ b/public/pages/Emails/utils/helper.ts @@ -4,7 +4,7 @@ */ import { EuiComboBoxOptionOption } from '@elastic/eui'; -import { ENCRYPTION_TYPE, NOTIFICATION_SOURCE } from '../../../utils/constants'; +import { ENCRYPTION_TYPE } from '../../../utils/constants'; export const createSenderConfigObject = ( senderName: string, @@ -16,7 +16,6 @@ export const createSenderConfigObject = ( return { name: senderName, config_type: 'smtp_account', - feature_list: Object.keys(NOTIFICATION_SOURCE), is_enabled: true, smtp_account: { host, @@ -36,7 +35,6 @@ export const createSesSenderConfigObject = ( return { name: senderName, config_type: 'ses_account', - feature_list: Object.keys(NOTIFICATION_SOURCE), is_enabled: true, ses_account: { from_address: email, @@ -55,7 +53,6 @@ export const createRecipientGroupConfigObject = ( name, description, config_type: 'email_group', - feature_list: Object.keys(NOTIFICATION_SOURCE), is_enabled: true, email_group: { recipient_list: selectedEmailOptions.map((email) => ({ diff --git a/public/services/NotificationService.ts b/public/services/NotificationService.ts index b7e35469..14022dfe 100644 --- a/public/services/NotificationService.ts +++ b/public/services/NotificationService.ts @@ -14,7 +14,7 @@ import { SenderType, SESSenderItemType, } from '../../models/interfaces'; -import {CHANNEL_TYPE, NOTIFICATION_SOURCE} from '../utils/constants'; +import { CHANNEL_TYPE } from '../utils/constants'; import { configListToChannels, configListToRecipientGroups, @@ -244,16 +244,10 @@ export default class NotificationService { }; sendTestMessage = async ( - configId: string, - feature: keyof typeof NOTIFICATION_SOURCE + configId: string ) => { const response = await this.httpClient.get( - `${NODE_API.SEND_TEST_MESSAGE}/${configId}`, - { - query: { - feature, - }, - } + `${NODE_API.SEND_TEST_MESSAGE}/${configId}` ); if (response.event_id != null) { await this.getNotification(response.event_id).then((response) => { diff --git a/public/utils/constants.ts b/public/utils/constants.ts index 88df348a..f328ad57 100644 --- a/public/utils/constants.ts +++ b/public/utils/constants.ts @@ -48,12 +48,6 @@ export const BREADCRUMBS = Object.freeze({ EDIT_RECIPIENT_GROUP: { text: 'Edit recipient group' }, }); -export const NOTIFICATION_SOURCE = Object.freeze({ - alerting: 'Alerting', - index_management: 'ISM', - reports: 'Reporting', -}); - export const BACKEND_CHANNEL_TYPE = Object.freeze({ SLACK: 'slack', EMAIL: 'email', diff --git a/server/routes/configRoutes.ts b/server/routes/configRoutes.ts index b340a011..5942399c 100644 --- a/server/routes/configRoutes.ts +++ b/server/routes/configRoutes.ts @@ -24,9 +24,6 @@ export function configRoutes(router: IRouter) { schema.arrayOf(schema.string()), schema.string(), ]), - feature_list: schema.maybe( - schema.oneOf([schema.arrayOf(schema.string()), schema.string()]) - ), is_enabled: schema.maybe(schema.boolean()), sort_field: schema.string(), sort_order: schema.string(), @@ -41,7 +38,6 @@ export function configRoutes(router: IRouter) { }, async (context, request, response) => { const config_type = joinRequestParams(request.query.config_type); - const feature_list = joinRequestParams(request.query.feature_list); const config_id_list = joinRequestParams(request.query.config_id_list); const encryption_method = joinRequestParams( request.query['smtp_account.method'] @@ -61,7 +57,6 @@ export function configRoutes(router: IRouter) { sort_field: request.query.sort_field, sort_order: request.query.sort_order, config_type, - ...(feature_list && { feature_list }), ...(query && { text_query: query }), // text_query will exclude keyword fields ...(config_id_list && { config_id_list }), ...(encryption_method && { diff --git a/server/routes/eventRoutes.ts b/server/routes/eventRoutes.ts index 0db439c8..d99f805a 100644 --- a/server/routes/eventRoutes.ts +++ b/server/routes/eventRoutes.ts @@ -47,9 +47,6 @@ export function eventRoutes(router: IRouter) { params: schema.object({ configId: schema.string(), }), - query: schema.object({ - feature: schema.string(), - }), }, }, async (context, request, response) => { @@ -62,7 +59,6 @@ export function eventRoutes(router: IRouter) { 'notifications.sendTestMessage', { configId: request.params.configId, - feature: request.query.feature, } ); return response.ok({ body: resp }); diff --git a/test/mocks/mockData.ts b/test/mocks/mockData.ts index 0f5449cd..6106ff96 100644 --- a/test/mocks/mockData.ts +++ b/test/mocks/mockData.ts @@ -14,7 +14,6 @@ const mockChime: ChannelItemType = { name: 'Chime test channel', description: 'test description', config_type: 'chime', - feature_list: ['reports'], is_enabled: true, chime: { url: 'https://chimehook', @@ -28,7 +27,6 @@ const mockSlack: ChannelItemType = { name: 'Slack test channel', description: 'test description', config_type: 'slack', - feature_list: ['reports'], is_enabled: false, slack: { url: 'https://chimehook', @@ -42,7 +40,6 @@ const mockEmail: ChannelItemType = { name: 'Email test channel', description: 'test description', config_type: 'email', - feature_list: ['alerting'], is_enabled: true, email: { email_account_id: 'dj8etXkBCzVy9Vy-nsiL', @@ -76,7 +73,6 @@ const mockEmailWithSES: ChannelItemType = { name: 'Email test channel', description: 'test description', config_type: 'email', - feature_list: ['alerting'], is_enabled: true, email: { email_account_id: 'dj8etXkBCzVy9Vy-nsiL', @@ -110,7 +106,6 @@ const mockWebhook: ChannelItemType = { name: 'Webhook test channel', description: 'test description', config_type: 'webhook', - feature_list: ['alerting'], is_enabled: true, webhook: { url: 'https://host:23/path?key1=%23%404&key2=&key3=value3', @@ -133,7 +128,6 @@ const mockSNS: ChannelItemType = { name: 'SNS test channel', description: 'test description', config_type: 'sns', - feature_list: ['alerting'], is_enabled: true, sns: { topic_arn: 'arn:aws:sns:us-west-2:012345678912:notifications-test',