twenty
twenty copied to clipboard
Sort Metadata Fields by Custom Status and Creation Date
Summary
This pull request closes #3253 and introduces a change in the way we display metadata fields in objects such as People, Opportunities, Companies. With this change, the fields are sorted first by their isCustom status (standard fields first, then custom fields), and then by their creationDate (older fields first).
Changes:
-
Created a new function
sortFieldMetadataIteminutils.tsthat takes two fields and returns a sorting score based on theisCustomstatus andcreationDate. -
Used the
sortFieldMetadataItemfunction to sortactiveMetadataFieldsanddisabledMetadataFieldsbefore they are displayed inSettingsObjectDetails.tsx -
Created Jest tests for
sortFieldMetadataItemutility file.
Test
- Navigate to the settings page of an object (http://localhost:3001/settings/objects).
- Add a new custom field and verify that it appears last in the list of fields.
- Verify that both of the active and disabled fields are sorted first by
Customstatus (standard first, then custom), and then byCreation Date(older first).
Screenshots
Before
After
Checklist
- [x] Extract the sort fucntion to
util.ts - [x] Add Jest tests for it
@charlesBochet Gladly. I also don't want any regression from my pull request either. 😊
@charlesBochet Hello again! The changes are up now 🚀