From 19556b85a311e333ebab93002c248fffea111a43 Mon Sep 17 00:00:00 2001 From: MartinSchoeler Date: Thu, 18 Dec 2025 18:26:10 -0300 Subject: [PATCH 01/11] regression(ABAC): Adjust attributes form spacing --- .../admin/ABAC/ABACAttributesTab/AttributesForm.tsx | 10 ++++++++-- .../__snapshots__/AttributesForm.spec.tsx.snap | 12 ++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesForm.tsx b/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesForm.tsx index 7e2cb90fba850..28e49c60f5d6e 100644 --- a/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesForm.tsx +++ b/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesForm.tsx @@ -8,6 +8,7 @@ import { FieldLabel, FieldRow, IconButton, + Margins, TextInput, } from '@rocket.chat/fuselage'; import { ContextualbarScrollableContent } from '@rocket.chat/ui-client'; @@ -114,7 +115,9 @@ const AttributesForm = ({ onSave, onCancel, description }: AttributesFormProps) })} /> {index !== 0 && ( - removeLockedAttribute(index)} /> + + removeLockedAttribute(index)} /> + )} {errors.lockedAttributes?.[index]?.value && {errors.lockedAttributes?.[index]?.value?.message}} @@ -132,13 +135,16 @@ const AttributesForm = ({ onSave, onCancel, description }: AttributesFormProps) })} /> {(index !== 0 || lockedAttributesFields.length > 0) && ( - remove(index)} /> + + remove(index)} /> + )} {errors.attributeValues?.[index]?.value && {errors.attributeValues[index].value.message}} ))} - - + + {description} + + + {t('Name')} + + + + + {errors.name && ( + + {errors.name.message} + + )} + + + + {t('Values')} + + {lockedAttributesFields.map((field, index) => ( + + + validateRepeatedValues(value), + })} + /> + {index !== 0 && ( + removeLockedAttribute(index)} /> + )} + + {errors.lockedAttributes?.[index]?.value && ( + + {errors.lockedAttributes?.[index]?.value?.message} + + )} + + ))} + {fields.map((field, index) => ( + + + validateRepeatedValues(value), + })} + /> + {(index !== 0 || lockedAttributesFields.length > 0) && ( + remove(index)} /> + )} + + {errors.attributeValues?.[index]?.value && ( + + {errors.attributeValues[index].value.message} + + )} + + ))} + + From 986de5b839301697273b5b6e5fb9e380965f9667 Mon Sep 17 00:00:00 2001 From: MartinSchoeler Date: Fri, 19 Dec 2025 11:48:39 -0300 Subject: [PATCH 03/11] chore: bump debounced text --- .../views/admin/ABAC/ABACAttributesTab/AttributesPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesPage.tsx b/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesPage.tsx index a52d6d4a743c4..e50902b9f8d8b 100644 --- a/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesPage.tsx +++ b/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesPage.tsx @@ -23,7 +23,7 @@ const AttributesPage = () => { const { t } = useTranslation(); const [text, setText] = useState(''); - const debouncedText = useDebouncedValue(text, 200); + const debouncedText = useDebouncedValue(text, 400); const { current, itemsPerPage, setItemsPerPage, setCurrent, ...paginationProps } = usePagination(); const getAttributes = useEndpoint('GET', '/v1/abac/attributes'); const isABACAvailable = useIsABACAvailable(); From 5ac96cefa233e360c938fa3efd1a4ff6a59ac64e Mon Sep 17 00:00:00 2001 From: MartinSchoeler Date: Fri, 19 Dec 2025 11:54:53 -0300 Subject: [PATCH 04/11] fix: missing parameter on querykey --- .../admin/ABAC/ABACAttributesTab/AttributesContextualBar.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesContextualBar.tsx b/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesContextualBar.tsx index a41e7b6b87ca2..7e479bef80f87 100644 --- a/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesContextualBar.tsx +++ b/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesContextualBar.tsx @@ -75,7 +75,8 @@ const AttributesContextualBar = ({ attributeData, onClose }: AttributesContextua dispatchToastMessage({ type: 'error', message: error }); }, onSettled: () => { - queryClient.invalidateQueries({ queryKey: ABACQueryKeys.roomAttributes.list() }); + console.log('onSettled'); + queryClient.invalidateQueries({ queryKey: ABACQueryKeys.roomAttributes.list({}) }); }, }); From 4ce1131230dbacef5039586df1fc5aba6db30fff Mon Sep 17 00:00:00 2001 From: Douglas Fabris Date: Fri, 19 Dec 2025 12:03:06 -0300 Subject: [PATCH 05/11] fix: missing describedby --- .../views/admin/ABAC/ABACAttributesTab/AttributesForm.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesForm.tsx b/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesForm.tsx index 6d8cc86b98358..e846e15402230 100644 --- a/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesForm.tsx +++ b/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesForm.tsx @@ -113,7 +113,10 @@ const AttributesForm = ({ onSave, onCancel, description }: AttributesFormProps) validateRepeatedValues(value), @@ -135,7 +138,10 @@ const AttributesForm = ({ onSave, onCancel, description }: AttributesFormProps) validateRepeatedValues(value), From 48d43117d9286c8cd9902cad23d2d34051d1c261 Mon Sep 17 00:00:00 2001 From: MartinSchoeler Date: Fri, 19 Dec 2025 12:10:54 -0300 Subject: [PATCH 06/11] fix: Accessibility in Room Form --- .../admin/ABAC/ABACRoomsTab/RoomForm.tsx | 87 ++++++++++--------- .../ABACRoomsTab/RoomFormAttributeField.tsx | 31 +++++-- .../ABACRoomsTab/RoomFormAttributeFields.tsx | 5 +- 3 files changed, 74 insertions(+), 49 deletions(-) diff --git a/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomForm.tsx b/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomForm.tsx index ca427d377ea33..91c45e2779c32 100644 --- a/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomForm.tsx +++ b/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomForm.tsx @@ -74,47 +74,52 @@ const RoomForm = ({ onClose, onSave, roomInfo, setSelectedRoomLabel }: RoomFormP return ( <> - - - - - {t('ABAC_Room_to_be_managed')} - - - {roomInfo ? ( - - ) : ( - ( - { - field.onChange(value); - setSelectedRoomLabel(label); - }} - /> - )} - /> - )} - - {errors.room && {errors.room.message}} - - - - + + + + {t('ABAC_Room_to_be_managed')} + + + {roomInfo ? ( + + ) : ( + ( + { + field.onChange(value); + setSelectedRoomLabel(label); + }} + /> + )} + /> + )} + + {errors.room && ( + + {errors.room.message} + + )} + + + diff --git a/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomFormAttributeField.tsx b/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomFormAttributeField.tsx index d9a4247c3db55..2f9b46da75719 100644 --- a/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomFormAttributeField.tsx +++ b/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomFormAttributeField.tsx @@ -10,9 +10,10 @@ type ABACAttributeAutocompleteProps = { onRemove: () => void; index: number; attributeList: { value: string; label: string; attributeValues: string[] }[]; + required?: boolean; }; -const RoomFormAttributeField = ({ onRemove, index, attributeList }: ABACAttributeAutocompleteProps) => { +const RoomFormAttributeField = ({ onRemove, index, attributeList, required = false }: ABACAttributeAutocompleteProps) => { const { t } = useTranslation(); const { control, getValues, resetField } = useFormContext(); @@ -60,6 +61,10 @@ const RoomFormAttributeField = ({ onRemove, index, attributeList }: ABACAttribut - {keyFieldState.error && {keyFieldState.error.message}} + {keyFieldState.error && ( + + {keyFieldState.error.message} + + )} - {valuesFieldState.error && {valuesFieldState.error.message}} + {valuesFieldState.error && ( + + {valuesFieldState.error.message} + + )} - + {index !== 0 && ( + + )} ); }; diff --git a/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomFormAttributeFields.tsx b/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomFormAttributeFields.tsx index bfcdf21464b28..86cbad999eecc 100644 --- a/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomFormAttributeFields.tsx +++ b/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomFormAttributeFields.tsx @@ -19,12 +19,13 @@ const RoomFormAttributeFields = ({ fields, remove }: RoomFormAttributeFieldsProp } return fields.map((field, index) => ( - - + + {t('Attribute')} { remove(index); }} From a1664df39355b25b46df07660c49f40b7490d1cf Mon Sep 17 00:00:00 2001 From: MartinSchoeler Date: Fri, 19 Dec 2025 12:15:08 -0300 Subject: [PATCH 07/11] [Martin martin] --- .../admin/ABAC/ABACAttributesTab/AttributesContextualBar.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesContextualBar.tsx b/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesContextualBar.tsx index 7e479bef80f87..a1f22fd11a1dd 100644 --- a/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesContextualBar.tsx +++ b/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesContextualBar.tsx @@ -75,7 +75,6 @@ const AttributesContextualBar = ({ attributeData, onClose }: AttributesContextua dispatchToastMessage({ type: 'error', message: error }); }, onSettled: () => { - console.log('onSettled'); queryClient.invalidateQueries({ queryKey: ABACQueryKeys.roomAttributes.list({}) }); }, }); From 5414eb33818a4e80e4b271c891b78492c47597fd Mon Sep 17 00:00:00 2001 From: Douglas Fabris Date: Fri, 19 Dec 2025 14:16:06 -0300 Subject: [PATCH 08/11] fix: conditionally aria-describedby --- .../admin/ABAC/ABACAttributesTab/AttributesForm.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesForm.tsx b/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesForm.tsx index e846e15402230..287bbdd200d93 100644 --- a/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesForm.tsx +++ b/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/AttributesForm.tsx @@ -94,7 +94,7 @@ const AttributesForm = ({ onSave, onCancel, description }: AttributesFormProps) aria-required='true' {...register('name', { required: t('Required_field', { field: t('Name') }) })} aria-invalid={errors.name ? 'true' : 'false'} - aria-describedby={`${nameField}-error`} + aria-describedby={errors.name ? `${nameField}-error` : undefined} /> {errors.name && ( @@ -113,7 +113,7 @@ const AttributesForm = ({ onSave, onCancel, description }: AttributesFormProps) {errors.lockedAttributes?.[index]?.value && ( - + {errors.lockedAttributes?.[index]?.value?.message} )} @@ -138,7 +138,7 @@ const AttributesForm = ({ onSave, onCancel, description }: AttributesFormProps) {errors.attributeValues?.[index]?.value && ( - + {errors.attributeValues[index].value.message} )} From 900d93ab50d70634eeb2ef94bca83fcf295b1e75 Mon Sep 17 00:00:00 2001 From: MartinSchoeler Date: Fri, 19 Dec 2025 14:29:48 -0300 Subject: [PATCH 09/11] fix: empty contextual bar when no license --- .../client/views/admin/ABAC/AdminABACPage.tsx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/apps/meteor/client/views/admin/ABAC/AdminABACPage.tsx b/apps/meteor/client/views/admin/ABAC/AdminABACPage.tsx index ae7b2062887a4..a4fdde032fb89 100644 --- a/apps/meteor/client/views/admin/ABAC/AdminABACPage.tsx +++ b/apps/meteor/client/views/admin/ABAC/AdminABACPage.tsx @@ -76,22 +76,18 @@ const AdminABACPage = ({ shouldShowWarning }: AdminABACPageProps) => { {tab === 'logs' && } - {tab !== undefined && context !== undefined && ( + {isABACAvailable === true && tab !== undefined && context !== undefined && ( handleCloseContextualbar()}> {tab === 'room-attributes' && ( <> - {context === 'new' && isABACAvailable === true && handleCloseContextualbar()} />} - {context === 'edit' && _id && isABACAvailable === true && ( - handleCloseContextualbar()} /> - )} + {context === 'new' && handleCloseContextualbar()} />} + {context === 'edit' && _id && handleCloseContextualbar()} />} )} {tab === 'rooms' && ( <> - {context === 'new' && isABACAvailable === true && handleCloseContextualbar()} />} - {context === 'edit' && _id && isABACAvailable === true && ( - handleCloseContextualbar()} /> - )} + {context === 'new' && handleCloseContextualbar()} />} + {context === 'edit' && _id && handleCloseContextualbar()} />} )} From 029a8c3929ab1ddb52e061cd5c2e927b29c95d0a Mon Sep 17 00:00:00 2001 From: Douglas Fabris Date: Fri, 19 Dec 2025 14:44:04 -0300 Subject: [PATCH 10/11] fix: RoomFormAttribute review --- .../ABAC/ABACRoomsTab/RoomFormAttributeField.tsx | 15 ++++++++------- .../ABAC/ABACRoomsTab/RoomFormAttributeFields.tsx | 3 ++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomFormAttributeField.tsx b/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomFormAttributeField.tsx index 2f9b46da75719..21a54fd8539f5 100644 --- a/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomFormAttributeField.tsx +++ b/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomFormAttributeField.tsx @@ -7,13 +7,14 @@ import { useTranslation } from 'react-i18next'; import type { RoomFormData } from './RoomForm'; type ABACAttributeAutocompleteProps = { + labelId: string; onRemove: () => void; index: number; attributeList: { value: string; label: string; attributeValues: string[] }[]; required?: boolean; }; -const RoomFormAttributeField = ({ onRemove, index, attributeList, required = false }: ABACAttributeAutocompleteProps) => { +const RoomFormAttributeField = ({ labelId, onRemove, index, attributeList, required = false }: ABACAttributeAutocompleteProps) => { const { t } = useTranslation(); const { control, getValues, resetField } = useFormContext(); @@ -63,8 +64,9 @@ const RoomFormAttributeField = ({ onRemove, index, attributeList, required = fal options={options} required={required} aria-required={required} + aria-labelledby={labelId} aria-invalid={keyFieldState.error ? 'true' : 'false'} - aria-describedby={`${keyField.name}-error`} + aria-describedby={keyFieldState.error ? `${keyField.name}-error` : undefined} placeholder={t('ABAC_Search_Attribute')} mbe={4} error={keyFieldState.error?.message} @@ -80,13 +82,13 @@ const RoomFormAttributeField = ({ onRemove, index, attributeList, required = fal {keyFieldState.error.message} )} - {valuesFieldState.error && ( - + {valuesFieldState.error.message} )} - {index !== 0 && ( - )} diff --git a/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomFormAttributeFields.tsx b/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomFormAttributeFields.tsx index 86cbad999eecc..49555685329a8 100644 --- a/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomFormAttributeFields.tsx +++ b/apps/meteor/client/views/admin/ABAC/ABACRoomsTab/RoomFormAttributeFields.tsx @@ -20,10 +20,11 @@ const RoomFormAttributeFields = ({ fields, remove }: RoomFormAttributeFieldsProp return fields.map((field, index) => ( - + {t('Attribute')} { From 72acce3e5f039a5d087173271de0516ca93425eb Mon Sep 17 00:00:00 2001 From: Douglas Fabris Date: Fri, 19 Dec 2025 14:44:11 -0300 Subject: [PATCH 11/11] test: update snapshots --- .../AttributesForm.spec.tsx.snap | 352 +++++++++--------- .../RoomFormAttributeField.spec.tsx.snap | 15 +- 2 files changed, 182 insertions(+), 185 deletions(-) diff --git a/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/__snapshots__/AttributesForm.spec.tsx.snap b/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/__snapshots__/AttributesForm.spec.tsx.snap index 350f110134579..17b7c700a50b5 100644 --- a/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/__snapshots__/AttributesForm.spec.tsx.snap +++ b/apps/meteor/client/views/admin/ABAC/ABACAttributesTab/__snapshots__/AttributesForm.spec.tsx.snap @@ -26,85 +26,85 @@ exports[`AttributesForm renders NewAttribute without crashing 1`] = ` style="margin-right: 0px; margin-bottom: 0px; margin-left: 0px; top: 0px; left: 0px; width: calc(100% + 0px); padding: 0px 0px 0px 0px;" tabindex="-1" > -
-
-
- Create an attribute that can later be assigned to rooms. -
-
+
+
-
+ - + + +
+
+
- -
+ Add Value + + +
+
-
-
-
- Attribute values cannot be edited, but can be added or deleted. -
-
+
+
-
+ - - - - + + +
+
+
- -
+ + +
+
@@ -46,6 +48,8 @@ exports[`RoomFormAttributeField renders Default without crashing 1`] = ` class="rcx-box rcx-box--full rcx-field__row" >
@@ -77,17 +81,6 @@ exports[`RoomFormAttributeField renders Default without crashing 1`] = `
-