diff --git a/src/realm-settings/NewAttributeSettings.tsx b/src/realm-settings/NewAttributeSettings.tsx index 036976a027..9838873b33 100644 --- a/src/realm-settings/NewAttributeSettings.tsx +++ b/src/realm-settings/NewAttributeSettings.tsx @@ -142,7 +142,16 @@ export default function NewAttributeSettings() { : profileConfig.scopeRequired, }; - const validations = profileConfig.validations; + const validations = profileConfig.validations?.reduce( + (prevValidations: any, currentValidations: any) => { + prevValidations[currentValidations.name] = + currentValidations.config.length === 0 + ? {} + : currentValidations.config; + return prevValidations; + }, + {} + ); const annotations = (profileConfig.annotations! as KeyValueType[]).reduce( (obj, item) => Object.assign(obj, { [item.key]: item.value }), diff --git a/src/realm-settings/user-profile/attribute/AttributeValidations.tsx b/src/realm-settings/user-profile/attribute/AttributeValidations.tsx index 117c8918c0..c9b41ba31a 100644 --- a/src/realm-settings/user-profile/attribute/AttributeValidations.tsx +++ b/src/realm-settings/user-profile/attribute/AttributeValidations.tsx @@ -50,7 +50,10 @@ export const AttributeValidations = () => { continueButtonLabel: "common:delete", continueButtonVariant: ButtonVariant.danger, onConfirm: async () => { - console.log("TODO"); + const updatedValidators = validators.filter( + (validator) => validator.name !== validatorToDelete?.name + ); + setValue("validations", [...updatedValidators]); }, }); @@ -104,7 +107,6 @@ export const AttributeValidations = () => { key="validator" variant="link" data-testid="deleteValidator" - isDisabled={true} onClick={() => { toggleDeleteDialog(); setValidatorToDelete({