Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/apps/admin-ui/src/user/components/OptionsComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<UserProfileGroup {...attr}>
Expand Down
8 changes: 7 additions & 1 deletion js/apps/admin-ui/src/user/components/UserProfileGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ export type UserProfileFieldsProps = UserProfileAttribute & {
roles?: string[];
};

type LengthValidator =
| {
min: number;
}
| undefined;

const isRequired = (attribute: UserProfileAttribute) =>
Object.keys(attribute.required || {}).length !== 0 ||
((attribute.validations?.length?.min as number) || 0) > 0;
(((attribute.validators?.length as LengthValidator)?.min as number) || 0) > 0;

export const UserProfileGroup = ({
children,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default interface UserProfileConfig {
export interface UserProfileAttribute {
name?: string;
validations?: Record<string, Record<string, unknown>>;
validators?: Record<string, unknown>;
annotations?: Record<string, unknown>;
required?: UserProfileAttributeRequired;
readOnly?: boolean;
Expand Down