-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Support Full Name as Record Text Identifier #11610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR adds support for using full name fields as record text identifiers, allowing them to be clickable and selectable in the settings form.
- Added
FieldMetadataType.FULL_NAME
toLABEL_IDENTIFIER_FIELD_METADATA_TYPES
array in/packages/twenty-front/src/modules/object-metadata/constants/LabelIdentifierFieldMetadataTypes.ts
- Removed 'fullName' from reserved keywords in
/packages/twenty-server/src/engine/metadata-modules/utils/validate-metadata-name-is-not-reserved-keyword.ts
- Enhanced
RecordChip
component in/packages/twenty-front/src/modules/object-record/components/RecordChip.tsx
to handle full name concatenation - Modified
ChipFieldDisplay
anduseChipFieldDisplay
to properly handle full name fields as identifiers - Updated
SettingsDataModelObjectIdentifiersForm
to keep identifier fields clickable even with single field
💡 (5/5) You can turn off certain types of comments like style here!
6 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile
let name = recordChipData.name; | ||
|
||
if (field?.type === FieldMetadataType.FULL_NAME) { | ||
name = `${record[field.name]?.firstName || ''} ${record[field.name]?.lastName || ''}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider adding .trim() to remove extra space when either firstName or lastName is empty
name = `${record[field.name]?.firstName || ''} ${record[field.name]?.lastName || ''}`; | |
name = `${record[field.name]?.firstName || ''} ${record[field.name]?.lastName || ''}`.trim(); |
'currencies', | ||
'fullName', | ||
'fullNames', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider whether 'fullNames' should also be removed for consistency since 'fullName' is now allowed
@@ -35,6 +37,7 @@ export const RecordChip = ({ | |||
size, | |||
forceDisableClick = false, | |||
isLabelHidden = false, | |||
field, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should not pass the field here, and modify useRecordChipData instead!
@@ -70,12 +73,18 @@ export const RecordChip = ({ | |||
}) | |||
: undefined; | |||
|
|||
let name = recordChipData.name; | |||
|
|||
if (field?.type === FieldMetadataType.FULL_NAME) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see my comment above: this should be handled in useRecordChipData
@@ -47,7 +47,6 @@ const reservedKeywords = [ | |||
'links', | |||
'currency', | |||
'currencies', | |||
'fullName', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without removing it, Its not allowing to create field named 'Full Name' (As I created in demo clip above). It throws error: The name "fullName" is not available
fullWidth | ||
dropdownId={`${fieldName}-select`} | ||
emptyOption={emptyOption} | ||
options={options} | ||
value={value} | ||
withSearchInput={label === t`Record label`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Issue, required change is only in 'Record Label' dropdown, Not in 'Record Image' dropdown.
@@ -124,12 +128,23 @@ export const SettingsDataModelObjectIdentifiersForm = ({ | |||
render={({ field: { onChange, value } }) => ( | |||
<Select | |||
label={label} | |||
disabled={!objectMetadataItem.isCustom || !options.length} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this change either
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In issue, there's mentioned in Desired Behavior section: Implement this design when only one field is available as text identifier. (Keep the field clickable, do not disable it)
@@ -22,6 +23,10 @@ export const ChipFieldDisplay = () => { | |||
size={ChipSize.Small} | |||
to={labelIdentifierLink} | |||
isLabelHidden={isLabelIdentifierCompact} | |||
field={{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @b9aurav, thanks for the PR
I have left comments :)
@charlesBochet Thanks for your comments, I'll take a look at requested changes. |
…nd remove unused field prop
closes #11296
recording.webm