From a584ff94a39b1245935a7826b0336aabc6106f52 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Mon, 25 Sep 2023 07:19:54 +0200 Subject: [PATCH] changed to validators (#23250) fixes: #23180 --- js/apps/admin-ui/src/user/components/OptionsComponent.tsx | 2 +- js/apps/admin-ui/src/user/components/SelectComponent.tsx | 2 +- js/apps/admin-ui/src/user/components/UserProfileGroup.tsx | 3 +-- js/libs/keycloak-admin-client/src/defs/userProfileConfig.ts | 1 + 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/apps/admin-ui/src/user/components/OptionsComponent.tsx b/js/apps/admin-ui/src/user/components/OptionsComponent.tsx index 8fce15ee23..df003c4928 100644 --- a/js/apps/admin-ui/src/user/components/OptionsComponent.tsx +++ b/js/apps/admin-ui/src/user/components/OptionsComponent.tsx @@ -11,7 +11,7 @@ export const OptionComponent = (attr: UserProfileAttribute) => { const isMultiSelect = type.includes("multiselect"); const Component = isMultiSelect ? Checkbox : Radio; - const options = (attr.validations?.options as Options).options || []; + const options = (attr.validators?.options as Options).options || []; return ( diff --git a/js/apps/admin-ui/src/user/components/SelectComponent.tsx b/js/apps/admin-ui/src/user/components/SelectComponent.tsx index b4d57564b2..0c636ee7fb 100644 --- a/js/apps/admin-ui/src/user/components/SelectComponent.tsx +++ b/js/apps/admin-ui/src/user/components/SelectComponent.tsx @@ -41,7 +41,7 @@ export const SelectComponent = (attribute: UserProfileFieldsProps) => { }; const options = - (attribute.validations?.options as Options | undefined)?.options || []; + (attribute.validators?.options as Options | undefined)?.options || []; const optionLabel = attribute.annotations?.[ "inputOptionLabels" diff --git a/js/apps/admin-ui/src/user/components/UserProfileGroup.tsx b/js/apps/admin-ui/src/user/components/UserProfileGroup.tsx index 94eb17aac1..941d6b600b 100644 --- a/js/apps/admin-ui/src/user/components/UserProfileGroup.tsx +++ b/js/apps/admin-ui/src/user/components/UserProfileGroup.tsx @@ -19,8 +19,7 @@ type LengthValidator = const isRequired = (attribute: UserProfileAttribute) => Object.keys(attribute.required || {}).length !== 0 || - (((attribute.validations?.length as LengthValidator)?.min as number) || 0) > - 0; + (((attribute.validators?.length as LengthValidator)?.min as number) || 0) > 0; export const UserProfileGroup = ({ children, diff --git a/js/libs/keycloak-admin-client/src/defs/userProfileConfig.ts b/js/libs/keycloak-admin-client/src/defs/userProfileConfig.ts index 9a2b231506..27f37445d9 100644 --- a/js/libs/keycloak-admin-client/src/defs/userProfileConfig.ts +++ b/js/libs/keycloak-admin-client/src/defs/userProfileConfig.ts @@ -8,6 +8,7 @@ export default interface UserProfileConfig { export interface UserProfileAttribute { name?: string; validations?: Record; + validators?: Record; annotations?: Record; required?: UserProfileAttributeRequired; readOnly?: boolean;