From b215c6a0ce14fd97ca7aa04fccc77dc43502fee6 Mon Sep 17 00:00:00 2001 From: Shaheer Kochai Date: Thu, 6 Feb 2025 13:56:10 +0430 Subject: [PATCH] feat: aws integration feature flag changes (#7033) * feat: aws integration feature flag changes * fix: fix the failing build --- ee/query-service/model/plans.go | 21 ++++++++++++++++ frontend/src/constants/features.ts | 1 + .../pages/Integrations/IntegrationsList.tsx | 25 +++++++++++++++---- pkg/query-service/model/featureSet.go | 1 + 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/ee/query-service/model/plans.go b/ee/query-service/model/plans.go index 6dbfa8ba56..9579a700ad 100644 --- a/ee/query-service/model/plans.go +++ b/ee/query-service/model/plans.go @@ -157,6 +157,13 @@ var BasicPlan = basemodel.FeatureSet{ UsageLimit: -1, Route: "", }, + basemodel.Feature{ + Name: basemodel.AWSIntegration, + Active: false, + Usage: 0, + UsageLimit: -1, + Route: "", + }, } var ProPlan = basemodel.FeatureSet{ @@ -279,6 +286,13 @@ var ProPlan = basemodel.FeatureSet{ UsageLimit: -1, Route: "", }, + basemodel.Feature{ + Name: basemodel.AWSIntegration, + Active: false, + Usage: 0, + UsageLimit: -1, + Route: "", + }, } var EnterprisePlan = basemodel.FeatureSet{ @@ -415,4 +429,11 @@ var EnterprisePlan = basemodel.FeatureSet{ UsageLimit: -1, Route: "", }, + basemodel.Feature{ + Name: basemodel.AWSIntegration, + Active: false, + Usage: 0, + UsageLimit: -1, + Route: "", + }, } diff --git a/frontend/src/constants/features.ts b/frontend/src/constants/features.ts index 9a2550ec0b..a2e4ac54fe 100644 --- a/frontend/src/constants/features.ts +++ b/frontend/src/constants/features.ts @@ -23,4 +23,5 @@ export enum FeatureKeys { PREMIUM_SUPPORT = 'PREMIUM_SUPPORT', QUERY_BUILDER_SEARCH_V2 = 'QUERY_BUILDER_SEARCH_V2', ANOMALY_DETECTION = 'ANOMALY_DETECTION', + AWS_INTEGRATION = 'AWS_INTEGRATION', } diff --git a/frontend/src/pages/Integrations/IntegrationsList.tsx b/frontend/src/pages/Integrations/IntegrationsList.tsx index 1daa2c1c24..901afcec92 100644 --- a/frontend/src/pages/Integrations/IntegrationsList.tsx +++ b/frontend/src/pages/Integrations/IntegrationsList.tsx @@ -4,8 +4,10 @@ import './Integrations.styles.scss'; import { Color } from '@signozhq/design-tokens'; import { Button, List, Typography } from 'antd'; +import { FeatureKeys } from 'constants/features'; import { useGetAllIntegrations } from 'hooks/Integrations/useGetAllIntegrations'; import { MoveUpRight, RotateCw } from 'lucide-react'; +import { useAppContext } from 'providers/App/App'; import { Dispatch, SetStateAction, useMemo } from 'react'; import { IntegrationsProps } from 'types/api/integrations/types'; import { isCloudUser } from 'utils/app'; @@ -16,7 +18,13 @@ export const AWS_INTEGRATION = { id: INTEGRATION_TYPES.AWS_INTEGRATION, title: 'AWS Web Services', description: 'One-click setup for AWS monitoring with SigNoz', + author: { + name: 'SigNoz', + email: 'integrations@signoz.io', + homepage: 'https://signoz.io', + }, icon: `Logos/aws-dark.svg`, + is_installed: false, is_new: true, }; @@ -38,13 +46,20 @@ function IntegrationsList(props: IntegrationsListProps): JSX.Element { refetch, } = useGetAllIntegrations(); + const { featureFlags } = useAppContext(); + const isAwsIntegrationEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.AWS_INTEGRATION) + ?.active || false; + const filteredDataList = useMemo(() => { let integrationsList: IntegrationsProps[] = []; - // Temporarily hide AWS Integration from the list, uncomment when the BE changes are finalized - // if (AWS_INTEGRATION.title.toLowerCase().includes(searchTerm.toLowerCase())) { - // integrationsList.push(AWS_INTEGRATION); - // } + if ( + isAwsIntegrationEnabled && + AWS_INTEGRATION.title.toLowerCase().includes(searchTerm.toLowerCase()) + ) { + integrationsList.push(AWS_INTEGRATION); + } // Add other integrations if (data?.data.data.integrations) { @@ -57,7 +72,7 @@ function IntegrationsList(props: IntegrationsListProps): JSX.Element { } return integrationsList; - }, [data?.data.data.integrations, searchTerm]); + }, [data?.data.data.integrations, isAwsIntegrationEnabled, searchTerm]); const loading = isLoading || isFetching || isRefetching; diff --git a/pkg/query-service/model/featureSet.go b/pkg/query-service/model/featureSet.go index d6c986619c..9a0b1daccc 100644 --- a/pkg/query-service/model/featureSet.go +++ b/pkg/query-service/model/featureSet.go @@ -24,6 +24,7 @@ const AlertChannelOpsgenie = "ALERT_CHANNEL_OPSGENIE" const AlertChannelEmail = "ALERT_CHANNEL_EMAIL" const AnomalyDetection = "ANOMALY_DETECTION" const HostsInfraMonitoring = "HOSTS_INFRA_MONITORING" +const AWSIntegration = "AWS_INTEGRATION" var BasicPlan = FeatureSet{ Feature{