-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
[Remotes] Add connection label in form #5599
Comments
Disclaimer: This comment was automatically generated with AI. It can give some useful hints as to where to look for, but sometimes it can also give very inaccurate answers so takes this with a pinch of salt :). To add a connection label in the form, follow these steps:
Implementation Steps:1. Update Form SchemaIn const editConnectionSchema = z.object({
// existing fields
label: z.string().nonempty('Label is required'),
}); 2. Edit Form ComponentIn <FormProvider {...formConfig}>
<TextField
label="Label"
{...formConfig.register('label')}
error={!!formConfig.formState.errors.label}
helperText={formConfig.formState.errors.label?.message}
/>
{/* existing fields */}
</FormProvider> 3. Handle SaveIn const handleSave = async () => {
const formValues = formConfig.getValues();
const dirtyFieldKeys = Object.keys(formConfig.formState.dirtyFields) as (keyof SettingsIntegrationEditConnectionFormValues)[];
try {
await updateOneDatabaseConnection({
...formatValuesForUpdate({
databaseKey,
formValues: pick(formValues, dirtyFieldKeys),
}),
id: connection?.id ?? '',
label: formValues.label, // include label
});
navigate(`${settingsIntegrationsPagePath}/${databaseKey}/${connection?.id}`);
} catch (error) {
enqueueSnackBar((error as Error).message, {
variant: SnackBarVariant.Error,
});
}
}; Repeat similar steps for the new connection form in References/packages/twenty-front/src/modules/settings/integrations/database-connection/components/SettingsIntegrationEditDatabaseConnectionContent.tsx |
The text was updated successfully, but these errors were encountered: