diff --git a/engine/apps/api/views/features.py b/engine/apps/api/views/features.py index b09a6160..b0e41897 100644 --- a/engine/apps/api/views/features.py +++ b/engine/apps/api/views/features.py @@ -5,6 +5,7 @@ from rest_framework.views import APIView from apps.auth_token.auth import PluginAuthentication from apps.base.utils import live_settings +from apps.webhooks.utils import is_webhooks_enabled_for_organization FEATURE_SLACK = "slack" FEATURE_TELEGRAM = "telegram" @@ -12,6 +13,7 @@ FEATURE_LIVE_SETTINGS = "live_settings" FEATURE_GRAFANA_CLOUD_NOTIFICATIONS = "grafana_cloud_notifications" FEATURE_GRAFANA_CLOUD_CONNECTION = "grafana_cloud_connection" FEATURE_WEB_SCHEDULES = "web_schedules" +FEATURE_WEBHOOKS2 = "webhooks2" class FeaturesAPIView(APIView): @@ -58,4 +60,7 @@ class FeaturesAPIView(APIView): if request.auth.organization.pk in enabled_web_schedules_orgs.json_value["org_ids"]: enabled_features.append(FEATURE_WEB_SCHEDULES) + if is_webhooks_enabled_for_organization(request.auth.organization.pk): + enabled_features.append(FEATURE_WEBHOOKS2) + return enabled_features diff --git a/grafana-plugin/src/containers/AlertReceiveChannelCard/AlertReceiveChannelCard.tsx b/grafana-plugin/src/containers/AlertReceiveChannelCard/AlertReceiveChannelCard.tsx index 729498f2..b8af2abc 100644 --- a/grafana-plugin/src/containers/AlertReceiveChannelCard/AlertReceiveChannelCard.tsx +++ b/grafana-plugin/src/containers/AlertReceiveChannelCard/AlertReceiveChannelCard.tsx @@ -1,8 +1,9 @@ import React from 'react'; -import { Badge, HorizontalGroup, Tooltip, VerticalGroup } from '@grafana/ui'; +import { Badge, HorizontalGroup, IconButton, Tooltip, VerticalGroup } from '@grafana/ui'; import cn from 'classnames/bind'; import { observer } from 'mobx-react'; +import CopyToClipboard from 'react-copy-to-clipboard'; import Emoji from 'react-emoji-render'; import IntegrationLogo from 'components/IntegrationLogo/IntegrationLogo'; @@ -11,6 +12,7 @@ import Text from 'components/Text/Text'; import TeamName from 'containers/TeamName/TeamName'; import { HeartGreenIcon, HeartRedIcon } from 'icons'; import { AlertReceiveChannel } from 'models/alert_receive_channel/alert_receive_channel.types'; +import { AppFeature } from 'state/features'; import { useStore } from 'state/useStore'; import styles from './AlertReceiveChannelCard.module.scss'; @@ -63,6 +65,22 @@ const AlertReceiveChannelCard = observer((props: AlertReceiveChannelCardProps) = + {store.hasFeature(AppFeature.Webhooks2) && ( + + + ID {alertReceiveChannel.id} +
+ (click to copy ID to clipboard) + + } + tooltipPlacement="top" + name="info-circle" + /> +
+ )} {alertReceiveChannelCounter && ( { /> )} + {store.hasFeature(AppFeature.Webhooks2) && ( + + + ID {channelFilter.id} +
+ (click to copy ID to clipboard) + + } + tooltipPlacement="top" + name="info-circle" + /> +
+ )}