From b14a9b7d600ed5582f6b7db7d77a1c431ace7db8 Mon Sep 17 00:00:00 2001 From: Pavindu Lakshan Date: Sun, 26 Jan 2025 15:53:22 +0530 Subject: [PATCH] Use new feature flag config model --- apps/console/src/public/deployment.config.json | 10 ++++++++++ .../components/push-provider-card.tsx | 18 +++++++++++++++++- features/admin.push-providers.v1/package.json | 1 + pnpm-lock.yaml | 3 +++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/apps/console/src/public/deployment.config.json b/apps/console/src/public/deployment.config.json index 4f7aa599a93..156a50f5a9d 100644 --- a/apps/console/src/public/deployment.config.json +++ b/apps/console/src/public/deployment.config.json @@ -1015,6 +1015,16 @@ "pushProviders": { "disabledFeatures": [], "enabled": true, + "features": [ + { + "feature": "pushProviders", + "flag": "" + }, + { + "feature": "pushProviders.templates", + "flag": "" + } + ], "scopes": { "create": [ "internal_notification_senders_create" diff --git a/features/admin.push-providers.v1/components/push-provider-card.tsx b/features/admin.push-providers.v1/components/push-provider-card.tsx index e69f2ff9951..2eb1133f455 100644 --- a/features/admin.push-providers.v1/components/push-provider-card.tsx +++ b/features/admin.push-providers.v1/components/push-provider-card.tsx @@ -19,17 +19,21 @@ import Card from "@oxygen-ui/react/Card"; import CardContent from "@oxygen-ui/react/CardContent"; import Typography from "@oxygen-ui/react/Typography"; +import { AppState } from "@wso2is/admin.core.v1/store"; +import FeatureFlagConstants from "@wso2is/admin.feature-gate.v1/constants/feature-flag-constants"; +import useFeatureFlag from "@wso2is/admin.feature-gate.v1/hooks/use-feature-flag"; import { CustomAttributeInterface, ExtensionTemplateListInterface, ResourceTypes } from "@wso2is/admin.template-core.v1/models/templates"; import { ExtensionTemplateManagementUtils } from "@wso2is/admin.template-core.v1/utils/templates"; -import { IdentifiableComponentInterface } from "@wso2is/core/models"; +import { FeatureFlagsInterface, IdentifiableComponentInterface } from "@wso2is/core/models"; import classnames from "classnames"; import React, { FunctionComponent, MouseEvent, ReactElement, useMemo } from "react"; import { useTranslation } from "react-i18next"; import "./push-provider-card.scss"; +import { useSelector } from "react-redux"; import { PushProviderConstants } from "../constants/push-provider-constants"; import { PushProviderTemplateFeatureStatus } from "../models/templates"; @@ -60,6 +64,14 @@ const PushProviderCard: FunctionComponent = ({ const { t } = useTranslation(); + const pushProviderFeatureFlagsConfig: FeatureFlagsInterface[] = useSelector( + (state: AppState) => state.config.ui.features.pushProviders.featureFlags + ); + + const featureFlag: string = useFeatureFlag(FeatureFlagConstants.FEATURE_FLAG_KEY_MAP.APPLICATION_TEMPLATES, + pushProviderFeatureFlagsConfig + ); + const featureStatus: PushProviderTemplateFeatureStatus = useMemo(() => { if (!template?.customAttributes || !Array.isArray(template?.customAttributes) @@ -72,6 +84,10 @@ const PushProviderCard: FunctionComponent = ({ property?.key === PushProviderConstants.FEATURE_STATUS_ATTRIBUTE_KEY ); + if (featureFlag === "TRUE") { + return property?.value as PushProviderTemplateFeatureStatus; + } + return property?.value; }, [ template ]); diff --git a/features/admin.push-providers.v1/package.json b/features/admin.push-providers.v1/package.json index 72c2f78d1e6..283ddc1f1c7 100644 --- a/features/admin.push-providers.v1/package.json +++ b/features/admin.push-providers.v1/package.json @@ -7,6 +7,7 @@ "license": "Apache-2.0", "dependencies": { "@wso2is/admin.core.v1": "^2.34.26", + "@wso2is/admin.feature-gate.v1": "^1.4.109", "@wso2is/admin.template-core.v1": "^1.4.26" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 14b97def156..dcdb45b2170 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13490,6 +13490,9 @@ importers: '@wso2is/admin.core.v1': specifier: ^2.34.26 version: link:../admin.core.v1 + '@wso2is/admin.feature-gate.v1': + specifier: ^1.4.109 + version: link:../admin.feature-gate.v1 '@wso2is/admin.template-core.v1': specifier: ^1.4.26 version: link:../admin.template-core.v1