Skip to content

Commit

Permalink
Merge pull request #7412 from osandamaleesha/pre-update-password
Browse files Browse the repository at this point in the history
  • Loading branch information
ashanthamara authored Jan 26, 2025
2 parents 131b72f + b91585e commit 0f974ff
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/six-scissors-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wso2is/admin.actions.v1": patch
---

Add action disabling through feature flag
2 changes: 2 additions & 0 deletions features/admin.actions.v1/constants/actions-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
35 changes: 27 additions & 8 deletions features/admin.actions.v1/pages/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
AlertInterface,
AlertLevels,
FeatureAccessConfigInterface,
FeatureFlagsInterface,
IdentifiableComponentInterface
} from "@wso2is/core/models";
import { addAlert } from "@wso2is/core/store";
Expand Down Expand Up @@ -225,44 +226,62 @@ export const ActionTypesListingPage: FunctionComponent<ActionTypesListingPageInt
}
};

const isActionTypeDisabled = (actionType: string): boolean =>
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: <KeyFlowIcon size="small" className="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: <PadlockAsteriskFlowIcon size="small" className="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: <ProfileFlowIcon size="small" className="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: <UserFlowIcon size="small" className="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")
} ];
};

Expand Down

0 comments on commit 0f974ff

Please sign in to comment.