dbeaver/pro#8197 add connection preferences plugin#4111
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new @cloudbeaver/plugin-connection-preferences package and wires it into the common plugin set, exposing a “connection preferences” action that opens an options-panel form (currently with an Info tab backed by connection metadata).
Changes:
- Added new
plugin-connection-preferencespackage (module, bootstrap, panel, form scaffolding, locales). - Integrated the plugin into
plugin-set-common(deps, TS references, and runtime set registration). - Moved/centralized connection config Zod schemas to
core-connectionsand updatedplugin-connectionsto consume them.
Reviewed changes
Copilot reviewed 35 out of 36 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| webapp/yarn.lock | Adds workspace entry + dependency linkage for the new plugin package. |
| webapp/packages/plugin-set-common/tsconfig.json | Adds TS project reference to plugin-connection-preferences. |
| webapp/packages/plugin-set-common/src/index.ts | Imports and appends plugin-connection-preferences to commonSet. |
| webapp/packages/plugin-set-common/package.json | Adds @cloudbeaver/plugin-connection-preferences dependency. |
| webapp/packages/plugin-connections/src/ConnectionForm/Options/IConnectionFormOptionsState.ts | Switches options schema base to core-connections exported schema. |
| webapp/packages/plugin-connections/src/ConnectionForm/DriverProperties/ConnectionFormDriverPropertiesPart.ts | Uses CONNECTION_PROPERTIES_SCHEMA inference from core-connections instead of local config typing. |
| webapp/packages/plugin-connection-preferences/tsconfig.json | New plugin TS build configuration and project references. |
| webapp/packages/plugin-connection-preferences/src/module.ts | Registers plugin services/bootstraps in DI container. |
| webapp/packages/plugin-connection-preferences/src/locales/en.ts | Adds plugin locale stub. |
| webapp/packages/plugin-connection-preferences/src/locales/fr.ts | Adds plugin locale stub. |
| webapp/packages/plugin-connection-preferences/src/locales/it.ts | Adds plugin locale stub. |
| webapp/packages/plugin-connection-preferences/src/locales/ru.ts | Adds plugin locale stub. |
| webapp/packages/plugin-connection-preferences/src/locales/vi.ts | Adds plugin locale stub. |
| webapp/packages/plugin-connection-preferences/src/locales/zh.ts | Adds plugin locale stub. |
| webapp/packages/plugin-connection-preferences/src/index.ts | Plugin entrypoint (side-effect module import + exports). |
| webapp/packages/plugin-connection-preferences/src/actions/ACTION_CONNECTION_PREFERENCES.ts | Defines new action used in menus to open preferences panel. |
| webapp/packages/plugin-connection-preferences/src/LocaleService.ts | Adds localization provider for plugin locales. |
| webapp/packages/plugin-connection-preferences/src/ConnectionPreferencesPanelService.ts | Manages opening/closing options-panel and form state lifecycle. |
| webapp/packages/plugin-connection-preferences/src/ConnectionPreferencesPanel.tsx | Lazy-loaded panel container rendering the form loader. |
| webapp/packages/plugin-connection-preferences/src/ConnectionPreferencesForm/IConnectionPreferencesFormState.ts | Defines form state schema/types (connection key). |
| webapp/packages/plugin-connection-preferences/src/ConnectionPreferencesForm/ConnectionPreferencesFormState.ts | Implements FormState wrapper for the plugin form. |
| webapp/packages/plugin-connection-preferences/src/ConnectionPreferencesForm/ConnectionPreferencesFormService.ts | Declares form service and registers actions placeholder container. |
| webapp/packages/plugin-connection-preferences/src/ConnectionPreferencesForm/ConnectionPreferencesFormLoader.ts | Lazy-load wrapper for the form component. |
| webapp/packages/plugin-connection-preferences/src/ConnectionPreferencesForm/ConnectionPreferencesFormInfo/getConnectionPreferencesFormInfoPart.ts | Creates/gets the Info form-part via data-context/DI. |
| webapp/packages/plugin-connection-preferences/src/ConnectionPreferencesForm/ConnectionPreferencesFormInfo/IConnectionPreferencesFormInfoState.ts | Info tab state schema derived from connection config schema. |
| webapp/packages/plugin-connection-preferences/src/ConnectionPreferencesForm/ConnectionPreferencesFormInfo/ConnectionPreferencesInfoTabService.ts | Registers the “Info” tab into the form’s parts container. |
| webapp/packages/plugin-connection-preferences/src/ConnectionPreferencesForm/ConnectionPreferencesFormInfo/ConnectionPreferencesFormInfoPart.ts | Loads connection info into the form part (read-only). |
| webapp/packages/plugin-connection-preferences/src/ConnectionPreferencesForm/ConnectionPreferencesFormInfo/ConnectionPreferencesFormInfo.tsx | Renders Info tab UI using loaded resources. |
| webapp/packages/plugin-connection-preferences/src/ConnectionPreferencesForm/ConnectionPreferencesFormBaseActions.tsx | Provides Cancel/Save action buttons via placeholder. |
| webapp/packages/plugin-connection-preferences/src/ConnectionPreferencesForm/ConnectionPreferencesFormActionsContext.ts | Context for form actions (save/cancel). |
| webapp/packages/plugin-connection-preferences/src/ConnectionPreferencesForm/ConnectionPreferencesForm.tsx | Form wrapper, tabs layout, submit handling + notifications. |
| webapp/packages/plugin-connection-preferences/src/ConnectionPreferencesBootstrap.ts | Adds menu creator + action handler to open the preferences panel. |
| webapp/packages/plugin-connection-preferences/package.json | New package manifest (exports, deps, scripts). |
| webapp/packages/plugin-connection-preferences/.gitignore | Plugin-level ignores for build/test artifacts. |
| webapp/packages/core-connections/src/index.ts | Re-exports CONNECTION_CONFIG_SCHEMA module publicly. |
| webapp/packages/core-connections/src/CONNECTION_CONFIG_SCHEMA.ts | Expands/centralizes connection config + network handler schemas. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export const ACTION_CONNECTION_PREFERENCES = createAction('connection-preferences', { | ||
| label: 'Preferences', | ||
| }); |
There was a problem hiding this comment.
label is hard-coded as "Preferences". Other actions in this codebase use localization keys (e.g., plugin-connection-custom/search), so this won’t be translatable and also doesn’t use the locale entries added in this plugin. Use a localization key for the action label (and add it to the plugin locales) instead of a raw English string.
| this.connectionFormService.parts.add({ | ||
| key: 'preferences-info', | ||
| name: 'Info', | ||
| order: 1, | ||
| panel: () => ConnectionPreferencesFormInfo, | ||
| }); |
There was a problem hiding this comment.
The tab name is hard-coded as "Info". In existing form tab registrations, name is typically a localization key (e.g., plugin_connections_connection_form_part_main). Use a localization key (for example the existing ui_information) and add plugin-specific keys if needed.
| const ConnectionFormBaseActionsLoader = importLazyComponent(() => | ||
| import('./ConnectionPreferencesFormBaseActions.js').then(m => m.ConnectionPreferencesFormBaseActions), | ||
| ); | ||
|
|
||
| export type ConnectionFormContainerProps = { | ||
| formState: IFormState<IConnectionPreferencesFormState>; | ||
| }; |
There was a problem hiding this comment.
There are a couple of newly introduced identifiers that still use the generic "ConnectionForm" naming (ConnectionFormBaseActionsLoader, ConnectionFormContainerProps) even though this is the ConnectionPreferences form. Renaming them to ConnectionPreferences... variants will avoid confusion when navigating/searching the codebase.
| export const ConnectionPreferencesForm = observer<ConnectionPreferencesFormProps>(function ConnectionPreferencesForm({ formState, onCancel }) { | ||
| const connectionPreferencesFormServicee = useService(ConnectionPreferencesFormService); | ||
| const notificationService = useService(NotificationService); | ||
|
|
There was a problem hiding this comment.
Local variable connectionPreferencesFormServicee has a typo (double "e"). This makes the code harder to read/search and is easy to fix by renaming it to connectionPreferencesFormService (and updating references below).
| if (this.formState.mode === 'edit' && this.formState.state) { | ||
| const key = createConnectionParam(this.formState.state.projectId, this.formState.state.connectionId); | ||
|
|
||
| // probably should implement a separate method as we can load only public accessible connection info here (not implemeted on the backend yet) |
There was a problem hiding this comment.
Typo in comment: "implemeted" should be "implemented".
| // probably should implement a separate method as we can load only public accessible connection info here (not implemeted on the backend yet) | |
| // probably should implement a separate method as we can load only public accessible connection info here (not implemented on the backend yet) |
| } | ||
|
|
||
| protected override async loader(): Promise<void> { | ||
| if (this.formState.mode === 'edit' && this.formState.state) { |
There was a problem hiding this comment.
this form should always be in the edit mode by design so you probably don't need this check
| serviceCollection | ||
| .addSingleton(Bootstrap, LocaleService) | ||
| .addSingleton(Bootstrap, proxy(ConnectionPreferencesBootstrap)) | ||
| .addSingleton(Bootstrap, proxy(ConnectionPreferencesInfoTabService)) |
There was a problem hiding this comment.
Since it's a bootstrap ConnectionPreferencesInfoTabService, probably you need to change the Service suffix to Bootstrap
There was a problem hiding this comment.
We dont use Bootstrap suffix for tab services across the codebase, do you think we need to change that?
closes 8197