Compare commits

...

1 Commits

Author SHA1 Message Date
YounixM
056a440148 feat: enable ms teams channel for all users 2024-07-29 11:46:14 +05:30
2 changed files with 6 additions and 23 deletions

View File

@@ -1,6 +1,5 @@
import { Form, FormInstance, Input, Select, Switch, Typography } from 'antd'; import { Form, FormInstance, Input, Select, Switch, Typography } from 'antd';
import { Store } from 'antd/lib/form/interface'; import { Store } from 'antd/lib/form/interface';
import UpgradePrompt from 'components/Upgrade/UpgradePrompt';
import { FeatureKeys } from 'constants/features'; import { FeatureKeys } from 'constants/features';
import ROUTES from 'constants/routes'; import ROUTES from 'constants/routes';
import { import {
@@ -39,27 +38,13 @@ function FormAlertChannels({
editing = false, editing = false,
}: FormAlertChannelsProps): JSX.Element { }: FormAlertChannelsProps): JSX.Element {
const { t } = useTranslation('channels'); const { t } = useTranslation('channels');
const isUserOnEEPlan = useFeatureFlags(FeatureKeys.ENTERPRISE_PLAN);
const feature = `ALERT_CHANNEL_${type.toUpperCase()}`; const feature = `ALERT_CHANNEL_${type.toUpperCase()}`;
const hasFeature = useFeatureFlags( const hasFeature = useFeatureFlags(
isFeatureKeys(feature) ? feature : FeatureKeys.ALERT_CHANNEL_SLACK, isFeatureKeys(feature) ? feature : FeatureKeys.ALERT_CHANNEL_SLACK,
); );
const isOssFeature = useFeatureFlags(FeatureKeys.OSS);
const renderSettings = (): ReactElement | null => { const renderSettings = (): ReactElement | null => {
if (
// for ee plan
!isOssFeature?.active &&
(!hasFeature || !hasFeature.active) &&
type === 'msteams'
) {
// channel type is not available for users plan
return <UpgradePrompt />;
}
switch (type) { switch (type) {
case ChannelType.Slack: case ChannelType.Slack:
return <SlackSettings setSelectedConfig={setSelectedConfig} />; return <SlackSettings setSelectedConfig={setSelectedConfig} />;
@@ -128,13 +113,9 @@ function FormAlertChannels({
<Select.Option value="email" key="email"> <Select.Option value="email" key="email">
Email Email
</Select.Option> </Select.Option>
{!isOssFeature?.active && ( <Select.Option value="msteams" key="msteams">
<Select.Option value="msteams" key="msteams"> Microsoft Teams
<div> </Select.Option>
Microsoft Teams {!isUserOnEEPlan && '(Supported in Paid Plans Only)'}{' '}
</div>
</Select.Option>
)}
</Select> </Select>
</Form.Item> </Form.Item>
@@ -169,7 +150,7 @@ function FormAlertChannels({
); );
} }
interface FormAlertChannelsProps { export interface FormAlertChannelsProps {
formInstance: FormInstance; formInstance: FormInstance;
type: ChannelType; type: ChannelType;
setSelectedConfig: Dispatch< setSelectedConfig: Dispatch<

View File

@@ -204,6 +204,8 @@ export const routesToSkip = [
ROUTES.DASHBOARD, ROUTES.DASHBOARD,
ROUTES.DASHBOARD_WIDGET, ROUTES.DASHBOARD_WIDGET,
ROUTES.SERVICE_TOP_LEVEL_OPERATIONS, ROUTES.SERVICE_TOP_LEVEL_OPERATIONS,
ROUTES.CHANNELS_EDIT,
ROUTES.CHANNELS_NEW,
]; ];
export const routesToDisable = [ROUTES.LOGS_EXPLORER, ROUTES.LIVE_LOGS]; export const routesToDisable = [ROUTES.LOGS_EXPLORER, ROUTES.LIVE_LOGS];