diff --git a/.changeset/six-scissors-collect.md b/.changeset/six-scissors-collect.md new file mode 100644 index 00000000000..4e9b60257bf --- /dev/null +++ b/.changeset/six-scissors-collect.md @@ -0,0 +1,5 @@ +--- +"@wso2is/admin.actions.v1": patch +--- + +Add action disabling through feature flag diff --git a/features/admin.actions.v1/constants/actions-constants.ts b/features/admin.actions.v1/constants/actions-constants.ts index 993333cc293..215097acbe6 100644 --- a/features/admin.actions.v1/constants/actions-constants.ts +++ b/features/admin.actions.v1/constants/actions-constants.ts @@ -68,6 +68,8 @@ export class ActionsConstants { public static readonly PRE_UPDATE_PROFILE_API_PATH: string = "preUpdateProfile"; public static readonly PRE_REGISTRATION_API_PATH: string = "preRegistration"; + public static readonly ACTION_COMING_SOON_LABEL: string = "COMING_SOON"; + public static readonly ERROR_MESSAGES: { CREATE_ACTION_INVALID_STATUS_CODE_ERROR: IdentityAppsError; DELETE_ACTION_INVALID_STATUS_CODE_ERROR: IdentityAppsError; diff --git a/features/admin.actions.v1/pages/actions.tsx b/features/admin.actions.v1/pages/actions.tsx index 8e4a96e8ee5..799e21b181f 100644 --- a/features/admin.actions.v1/pages/actions.tsx +++ b/features/admin.actions.v1/pages/actions.tsx @@ -36,6 +36,7 @@ import { AlertInterface, AlertLevels, FeatureAccessConfigInterface, + FeatureFlagsInterface, IdentifiableComponentInterface } from "@wso2is/core/models"; import { addAlert } from "@wso2is/core/store"; @@ -225,44 +226,62 @@ export const ActionTypesListingPage: FunctionComponent + actionsFeatureConfig["featureFlags"].some( + (featureFlag: FeatureFlagsInterface) => featureFlag.feature === actionType + && featureFlag.flag === ActionsConstants.ACTION_COMING_SOON_LABEL + ); + const actionTypesCardsInfo = (): ActionTypeCardInterface[] => { return [ { description: t("actions:types.preIssueAccessToken.description.shortened"), - disabled: false, + disabled: isActionTypeDisabled(FeatureFlagConstants.FEATURE_FLAG_KEY_MAP + .ACTIONS_TYPES_PRE_ISSUE_ACCESS_TOKEN), featureStatusKey: FeatureFlagConstants.FEATURE_FLAG_KEY_MAP .ACTIONS_TYPES_PRE_ISSUE_ACCESS_TOKEN, heading: t("actions:types.preIssueAccessToken.heading"), icon: , identifier: ActionsConstants.PRE_ISSUE_ACCESS_TOKEN_URL_PATH, - route: AppConstants.getPaths().get("PRE_ISSUE_ACCESS_TOKEN_EDIT") + route: isActionTypeDisabled(FeatureFlagConstants.FEATURE_FLAG_KEY_MAP + .ACTIONS_TYPES_PRE_ISSUE_ACCESS_TOKEN) ? undefined : + AppConstants.getPaths().get("PRE_ISSUE_ACCESS_TOKEN_EDIT") }, { description: t("actions:types.preUpdatePassword.description.shortened"), - disabled: false, + disabled: isActionTypeDisabled(FeatureFlagConstants.FEATURE_FLAG_KEY_MAP + .ACTIONS_TYPES_PRE_UPDATE_PASSWORD), featureStatusKey: FeatureFlagConstants.FEATURE_FLAG_KEY_MAP.ACTIONS_TYPES_PRE_UPDATE_PASSWORD, heading: t("actions:types.preUpdatePassword.heading"), icon: , identifier: ActionsConstants.PRE_UPDATE_PASSWORD_URL_PATH, - route: AppConstants.getPaths().get("PRE_UPDATE_PASSWORD_EDIT") + route: isActionTypeDisabled(FeatureFlagConstants.FEATURE_FLAG_KEY_MAP + .ACTIONS_TYPES_PRE_UPDATE_PASSWORD) ? undefined + : AppConstants.getPaths().get("PRE_UPDATE_PASSWORD_EDIT") }, { description: t("actions:types.preUpdateProfile.description.shortened"), - disabled: true, + disabled: isActionTypeDisabled(FeatureFlagConstants + .FEATURE_FLAG_KEY_MAP.ACTIONS_TYPES_PRE_UPDATE_PROFILE), featureStatusKey: FeatureFlagConstants.FEATURE_FLAG_KEY_MAP.ACTIONS_TYPES_PRE_UPDATE_PROFILE, heading: t("actions:types.preUpdateProfile.heading"), icon: , identifier: ActionsConstants.PRE_UPDATE_PROFILE_URL_PATH, - route: AppConstants.getPaths().get("PRE_UPDATE_PROFILE_EDIT") + route: isActionTypeDisabled(FeatureFlagConstants.FEATURE_FLAG_KEY_MAP + .ACTIONS_TYPES_PRE_UPDATE_PASSWORD) ? undefined + : AppConstants.getPaths().get("PRE_UPDATE_PROFILE_EDIT") }, { description: t("actions:types.preRegistration.description.shortened"), - disabled: true, + disabled: isActionTypeDisabled(FeatureFlagConstants + .FEATURE_FLAG_KEY_MAP.ACTIONS_TYPES_PRE_REGISTRATION), featureStatusKey: FeatureFlagConstants.FEATURE_FLAG_KEY_MAP.ACTIONS_TYPES_PRE_REGISTRATION, heading: t("actions:types.preRegistration.heading"), icon: , identifier: ActionsConstants.PRE_REGISTRATION_URL_PATH, - route: AppConstants.getPaths().get("PRE_REGISTRATION_EDIT") + route: isActionTypeDisabled(FeatureFlagConstants.FEATURE_FLAG_KEY_MAP + .ACTIONS_TYPES_PRE_UPDATE_PASSWORD) ? undefined + : AppConstants.getPaths().get("PRE_UPDATE_REGISTRATION_EDIT") } ]; };