-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Enhance postgre sql setup script and documentation for various distros 7636 #7637
Enhance postgre sql setup script and documentation for various distros 7636 #7637
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 pull request enhances the PostgreSQL setup script, improves the SettingsObjectNewFieldConfigure component, and introduces a new file for mapping field types to icons.
- Enhanced
provision-postgres-linux.sh
to support multiple Linux distributions (Debian/Ubuntu and Arch Linux) - Added
packages/twenty-front/src/pages/settings/data-model/constants/FieldTypeIcons.ts
for mapping field types to default icons - Updated
SettingsObjectNewFieldConfigure.tsx
to use default icons and improve form configuration - Improved error handling and user prompts in the PostgreSQL setup script
- Added a new useEffect hook in
SettingsObjectNewFieldConfigure.tsx
to update icons when field type changes
3 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile
useEffect(() => { | ||
formConfig.setValue('icon', defaultIconsByFieldType[fieldType] || 'IconUsers'); | ||
}, [fieldType, formConfig]); |
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 a dependency array to this useEffect to prevent unnecessary re-renders
fieldMetadataItem={{ | ||
icon: formConfig.watch('icon'), | ||
label: formConfig.watch('label') || 'New Field', | ||
type: fieldType as FieldMetadataType, | ||
}} |
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.
logic: Ensure that fieldType is always a valid FieldMetadataType to avoid potential runtime errors
[FieldMetadataType.Numeric]: 'IconUsers', | ||
[FieldMetadataType.Position]: 'IconUsers', | ||
[FieldMetadataType.RichText]: 'IconUsers', | ||
[FieldMetadataType.TsVector]: 'IconUsers' |
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 using more specific icons for Numeric, Position, RichText, and TsVector field types instead of the generic IconUsers
if ! yay -S --noconfirm pg_graphql; then | ||
handle_error "Failed to install pg_graphql package from AUR." | ||
fi |
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.
logic: The script assumes 'yay' is installed for Arch Linux, but doesn't check for its presence or provide an alternative. This could cause issues for users without yay.
if sudo -u postgres sh -c 'test "$(ls -A /var/lib/postgres/data 2>/dev/null)"'; then | ||
echo "PostgreSQL data directory already contains data. Skipping initdb." | ||
else | ||
sudo -iu postgres initdb --locale en_US.UTF-8 -D /var/lib/postgres/data || handle_error "Failed to initialize PostgreSQL database." | ||
fi |
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: The indentation for the 'else' block is incorrect, which could lead to readability issues.
…ation-for-Various-Distros-7636
@@ -0,0 +1,27 @@ | |||
import { FieldMetadataType } from '~/generated-metadata/graphql'; |
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.
@dostavic what is this change about?
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.
Thank you @dostavic
I'm not sure about the FieldTypeIcon.ts file change? Could you remove this change?
Regarding the provision-postres-linux.sh, looks great! I don't have linux setup on my side so I will trust you on this one :)
Thank you, @charlesBochet! Regarding the file change, that was my mistake 😊. I've removed it now |
Thank you for improving the experience on Linux. If you see anything else, do not hesitate! |
/award 300 |
Awarding dostavic: 300 points 🕹️ Well done! Check out your new contribution on oss.gg/dostavic |
No description provided.