Skip to content

Commit

Permalink
Use new feature flag config model
Browse files Browse the repository at this point in the history
  • Loading branch information
pavinduLakshan committed Jan 26, 2025
1 parent 37f34d5 commit b14a9b7
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
10 changes: 10 additions & 0 deletions apps/console/src/public/deployment.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,16 @@
"pushProviders": {
"disabledFeatures": [],
"enabled": true,
"features": [
{
"feature": "pushProviders",
"flag": ""
},
{
"feature": "pushProviders.templates",
"flag": ""
}
],
"scopes": {
"create": [
"internal_notification_senders_create"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -60,6 +64,14 @@ const PushProviderCard: FunctionComponent<PushProviderCardPropsInterface> = ({

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)
Expand All @@ -72,6 +84,10 @@ const PushProviderCard: FunctionComponent<PushProviderCardPropsInterface> = ({
property?.key === PushProviderConstants.FEATURE_STATUS_ATTRIBUTE_KEY
);

if (featureFlag === "TRUE") {
return property?.value as PushProviderTemplateFeatureStatus;
}

return property?.value;
}, [ template ]);

Expand Down
1 change: 1 addition & 0 deletions features/admin.push-providers.v1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b14a9b7

Please sign in to comment.