diff --git a/.changeset/mean-avocados-unite.md b/.changeset/mean-avocados-unite.md new file mode 100644 index 00000000000..e15e71d62bf --- /dev/null +++ b/.changeset/mean-avocados-unite.md @@ -0,0 +1,6 @@ +--- +"@wso2is/admin.validation.v1": patch +"@wso2is/i18n": patch +--- + +Change wordings of rule based password expiry diff --git a/features/admin.validation.v1/components/password-expiry-rule-list.tsx b/features/admin.validation.v1/components/password-expiry-rule-list.tsx index 85e2a3c0a13..3fa51525e2c 100644 --- a/features/admin.validation.v1/components/password-expiry-rule-list.tsx +++ b/features/admin.validation.v1/components/password-expiry-rule-list.tsx @@ -32,6 +32,7 @@ import TextField from "@oxygen-ui/react/TextField"; import { ChevronDownIcon, ChevronUpIcon, PlusIcon, TrashIcon } from "@oxygen-ui/react-icons"; import { userstoresConfig } from "@wso2is/admin.extensions.v1"; import { GroupsInterface } from "@wso2is/admin.groups.v1"; +import { RoleAudienceTypes } from "@wso2is/admin.roles.v2/constants"; import { GovernanceConnectorConstants } from "@wso2is/admin.server-configurations.v1/constants/governance-connector-constants"; @@ -57,10 +58,13 @@ interface PasswordExpiryRuleListProps { type Resource = RolesInterface | GroupsInterface; +enum Direction { + UP = "up", + DOWN = "down" +} + export const PasswordExpiryRuleList: FunctionComponent = ( - props: PasswordExpiryRuleListProps -) => { - const { + { componentId, ruleList, isPasswordExpiryEnabled, @@ -73,7 +77,8 @@ export const PasswordExpiryRuleList: FunctionComponent { const [ rules, setRules ] = useState(ruleList); const [ hasErrors, setHasErrors ] = useState<{ [key: string]: { values: boolean; expiryDays: boolean } }>({}); @@ -180,12 +185,13 @@ export const PasswordExpiryRuleList: FunctionComponent { - if ((direction === "up" && index === 0) || (direction === "down" && index === rules.length - 1)) { + const movePriority = (index: number, direction: Direction) => { + if ((direction === Direction.UP && index === 0) || (direction === Direction.DOWN && index === rules.length - 1)) + { return; } const updatedRules: PasswordExpiryRule[] = [ ...rules ]; - const swapIndex: number = direction === "up" ? index - 1 : index + 1; + const swapIndex: number = direction === Direction.UP ? index - 1 : index + 1; [ updatedRules[index], updatedRules[swapIndex] ] = [ updatedRules[swapIndex], updatedRules[index] ]; updatedRules.forEach((rule: PasswordExpiryRule, i: number) => rule.priority = i + 1); @@ -250,7 +256,7 @@ export const PasswordExpiryRuleList: FunctionComponent { selected?.length > 1 && ( - + ) } ); @@ -423,7 +429,7 @@ export const PasswordExpiryRuleList: FunctionComponent
movePriority(index, "up") } + onClick={ () => movePriority(index, Direction.UP) } disabled={ !isPasswordExpiryEnabled || index === 0 || isReadOnly } data-componentid={ `${componentId}-move-up-${index}` } > @@ -435,7 +441,7 @@ export const PasswordExpiryRuleList: FunctionComponent movePriority(index, "down") } + onClick={ () => movePriority(index, Direction.DOWN) } data-componentid={ `${componentId}-move-down-${index}` } >