From 858944d27367f75732cf517ad286663e97be2ddf Mon Sep 17 00:00:00 2001 From: Yunus M Date: Thu, 20 Feb 2025 16:12:49 +0530 Subject: [PATCH] feat: enable ms teams channel for all users (#7144) * feat: enable ms teams channel for all users * fix: update copy in test files --- .../src/components/Upgrade/UpgradePrompt.tsx | 31 ------------------- .../__tests__/CreateAlertChannel.test.tsx | 4 +-- .../CreateAlertChannelNormalUser.test.tsx | 6 ++-- .../src/container/FormAlertChannels/index.tsx | 31 +++++-------------- .../TopNav/DateTimeSelectionV2/config.ts | 2 ++ 5 files changed, 12 insertions(+), 62 deletions(-) delete mode 100644 frontend/src/components/Upgrade/UpgradePrompt.tsx diff --git a/frontend/src/components/Upgrade/UpgradePrompt.tsx b/frontend/src/components/Upgrade/UpgradePrompt.tsx deleted file mode 100644 index 9281530056..0000000000 --- a/frontend/src/components/Upgrade/UpgradePrompt.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { Alert, Space } from 'antd'; -import { SIGNOZ_UPGRADE_PLAN_URL } from 'constants/app'; - -type UpgradePromptProps = { - title?: string; -}; - -function UpgradePrompt({ title }: UpgradePromptProps): JSX.Element { - return ( - - - This feature is available for paid plans only.{' '} - - Click here - {' '} - to Upgrade - - } - type="warning" - />{' '} - - ); -} - -UpgradePrompt.defaultProps = { - title: 'Upgrade to a Paid Plan', -}; -export default UpgradePrompt; diff --git a/frontend/src/container/AllAlertChannels/__tests__/CreateAlertChannel.test.tsx b/frontend/src/container/AllAlertChannels/__tests__/CreateAlertChannel.test.tsx index 060cb28c18..1292df6374 100644 --- a/frontend/src/container/AllAlertChannels/__tests__/CreateAlertChannel.test.tsx +++ b/frontend/src/container/AllAlertChannels/__tests__/CreateAlertChannel.test.tsx @@ -378,9 +378,7 @@ describe('Create Alert Channel', () => { }); it('Should check if the selected item in the type dropdown has text "msteams"', () => { - expect( - screen.getByText('Microsoft Teams (Supported in Paid Plans Only)'), - ).toBeInTheDocument(); + expect(screen.getByText('Microsoft Teams')).toBeInTheDocument(); }); it('Should check if Webhook URL label and input are displayed properly ', () => { diff --git a/frontend/src/container/AllAlertChannels/__tests__/CreateAlertChannelNormalUser.test.tsx b/frontend/src/container/AllAlertChannels/__tests__/CreateAlertChannelNormalUser.test.tsx index aa9a7b0c35..d08ae52923 100644 --- a/frontend/src/container/AllAlertChannels/__tests__/CreateAlertChannelNormalUser.test.tsx +++ b/frontend/src/container/AllAlertChannels/__tests__/CreateAlertChannelNormalUser.test.tsx @@ -308,10 +308,8 @@ describe('Create Alert Channel (Normal User)', () => { render(); }); - it('Should check if the selected item in the type dropdown has text "Microsoft Teams (Supported in Paid Plans Only)"', () => { - expect( - screen.getByText('Microsoft Teams (Supported in Paid Plans Only)'), - ).toBeInTheDocument(); + it('Should check if the selected item in the type dropdown has text "Microsoft Teams"', () => { + expect(screen.getByText('Microsoft Teams')).toBeInTheDocument(); }); // TODO[vikrantgupta25]: check with Shaheer diff --git a/frontend/src/container/FormAlertChannels/index.tsx b/frontend/src/container/FormAlertChannels/index.tsx index 09f0732dcc..1a8b5aa1e8 100644 --- a/frontend/src/container/FormAlertChannels/index.tsx +++ b/frontend/src/container/FormAlertChannels/index.tsx @@ -1,6 +1,5 @@ import { Form, FormInstance, Input, Select, Switch, Typography } from 'antd'; import { Store } from 'antd/lib/form/interface'; -import UpgradePrompt from 'components/Upgrade/UpgradePrompt'; import { FeatureKeys } from 'constants/features'; import ROUTES from 'constants/routes'; import { @@ -15,6 +14,7 @@ import history from 'lib/history'; import { useAppContext } from 'providers/App/App'; import { Dispatch, ReactElement, SetStateAction } from 'react'; import { useTranslation } from 'react-i18next'; +import { FeatureFlagProps } from 'types/api/features/getFeaturesFlags'; import { isFeatureKeys } from 'utils/app'; import EmailSettings from './Settings/Email'; @@ -40,32 +40,18 @@ function FormAlertChannels({ }: FormAlertChannelsProps): JSX.Element { const { t } = useTranslation('channels'); const { featureFlags } = useAppContext(); - const isUserOnEEPlan = - featureFlags?.find((flag) => flag.name === FeatureKeys.ENTERPRISE_PLAN) - ?.active || false; const feature = `ALERT_CHANNEL_${type.toUpperCase()}`; const featureKey = isFeatureKeys(feature) ? feature : FeatureKeys.ALERT_CHANNEL_SLACK; - const hasFeature = featureFlags?.find((flag) => flag.name === featureKey); - const isOssFeature = featureFlags?.find( - (flag) => flag.name === FeatureKeys.OSS, + const hasFeature = featureFlags?.find( + (flag: FeatureFlagProps) => flag.name === featureKey, ); const renderSettings = (): ReactElement | null => { - if ( - // for ee plan - !isOssFeature?.active && - (!hasFeature || !hasFeature.active) && - type === 'msteams' - ) { - // channel type is not available for users plan - return ; - } - switch (type) { case ChannelType.Slack: return ; @@ -149,13 +135,10 @@ function FormAlertChannels({ Email - {!isOssFeature?.active && ( - -
- Microsoft Teams {!isUserOnEEPlan && '(Supported in Paid Plans Only)'}{' '} -
-
- )} + + + Microsoft Teams + diff --git a/frontend/src/container/TopNav/DateTimeSelectionV2/config.ts b/frontend/src/container/TopNav/DateTimeSelectionV2/config.ts index 4a63dbba33..bb24e884e5 100644 --- a/frontend/src/container/TopNav/DateTimeSelectionV2/config.ts +++ b/frontend/src/container/TopNav/DateTimeSelectionV2/config.ts @@ -222,6 +222,8 @@ export const routesToSkip = [ ROUTES.METRICS_EXPLORER, ROUTES.METRICS_EXPLORER_EXPLORER, ROUTES.METRICS_EXPLORER_VIEWS, + ROUTES.CHANNELS_NEW, + ROUTES.CHANNELS_EDIT, ]; export const routesToDisable = [ROUTES.LOGS_EXPLORER, ROUTES.LIVE_LOGS];