From 33d1d97fb76e37574843776554ef84ee2a0efa45 Mon Sep 17 00:00:00 2001 From: alex <48489896+devnaumov@users.noreply.github.com> Date: Tue, 17 Mar 2026 17:35:45 +0100 Subject: [PATCH] dbeaver/pro#8515 sync properties state (#4214) * dbeaver/pro#8515 sync properties state * dbeaver/pro#8515 fixed null to empty strings props conversion * dbeaver/pro#8515 do not send property if its in default value * Revert "dbeaver/pro#8515 fixed null to empty strings props conversion" This reverts commit 5c4f181edfd4f21b7774555d84c3ec0446266992. * dbeaver/pro#8515 fix firefox icon * dbeaver/pro#8515 change prop order * dbeaver/pro#8515 add comment --------- Co-authored-by: Dmitrii Barnukov Co-authored-by: Daria Marutkina <125263541+dariamarutkina@users.noreply.github.com> Co-authored-by: mr-anton-t <42037741+mr-anton-t@users.noreply.github.com> Co-authored-by: sergeyteleshev --- .../src/PropertiesTable/PropertyItem.tsx | 3 +- .../src/queries/fragments/DatabaseDriver.gql | 8 +---- .../ConnectionFormDriverPropertiesPart.ts | 32 +++++++++++++++++-- .../getConnectionFormDriverPropertiesPart.ts | 5 +-- 4 files changed, 34 insertions(+), 14 deletions(-) diff --git a/webapp/packages/core-blocks/src/PropertiesTable/PropertyItem.tsx b/webapp/packages/core-blocks/src/PropertiesTable/PropertyItem.tsx index d0d74e0690..92749ca49b 100644 --- a/webapp/packages/core-blocks/src/PropertiesTable/PropertyItem.tsx +++ b/webapp/packages/core-blocks/src/PropertiesTable/PropertyItem.tsx @@ -99,8 +99,8 @@ export const PropertyItem = observer(function PropertyItem({ )} @@ -108,7 +108,6 @@ export const PropertyItem = observer(function PropertyItem({ diff --git a/webapp/packages/core-sdk/src/queries/fragments/DatabaseDriver.gql b/webapp/packages/core-sdk/src/queries/fragments/DatabaseDriver.gql index be5b79b5a0..967662d498 100644 --- a/webapp/packages/core-sdk/src/queries/fragments/DatabaseDriver.gql +++ b/webapp/packages/core-sdk/src/queries/fragments/DatabaseDriver.gql @@ -36,13 +36,7 @@ fragment DatabaseDriver on DriverInfo { } driverProperties @include(if: $includeDriverProperties) { - id - displayName - description - category - dataType - defaultValue - validValues + ...DriverPropertyInfo } driverParameters @include(if: $includeDriverParameters) } diff --git a/webapp/packages/plugin-connections/src/ConnectionForm/DriverProperties/ConnectionFormDriverPropertiesPart.ts b/webapp/packages/plugin-connections/src/ConnectionForm/DriverProperties/ConnectionFormDriverPropertiesPart.ts index 0cb8928df1..149aa858e6 100644 --- a/webapp/packages/plugin-connections/src/ConnectionForm/DriverProperties/ConnectionFormDriverPropertiesPart.ts +++ b/webapp/packages/plugin-connections/src/ConnectionForm/DriverProperties/ConnectionFormDriverPropertiesPart.ts @@ -7,11 +7,12 @@ */ import { FormPart, type IFormState } from '@cloudbeaver/core-ui'; import type { IExecutionContextProvider } from '@cloudbeaver/core-executor'; -import { CONNECTION_PROPERTIES_SCHEMA, ConnectionInfoPropertiesResource } from '@cloudbeaver/core-connections'; +import { CONNECTION_PROPERTIES_SCHEMA, ConnectionInfoPropertiesResource, DBDriverResource } from '@cloudbeaver/core-connections'; import type { IConnectionFormState } from '../IConnectionFormState.js'; import { runInAction, toJS } from 'mobx'; import type { ConnectionFormOptionsPart } from '../Options/ConnectionFormOptionsPart.js'; import type { schema } from '@cloudbeaver/core-utils'; +import { getObjectPropertyOptionValue } from '@cloudbeaver/core-sdk'; type ConnectionProperties = schema.infer; @@ -23,6 +24,7 @@ export class ConnectionFormDriverPropertiesPart extends FormPart, private readonly connectionInfoPropertiesResource: ConnectionInfoPropertiesResource, + private readonly dbDriverResource: DBDriverResource, private readonly optionsPart: ConnectionFormOptionsPart, ) { super(formState, getDefaultState()); @@ -69,10 +71,10 @@ export class ConnectionFormDriverPropertiesPart extends FormPart>, ): Promise {} - protected override format( + protected override async format( data: IFormState, contexts: IExecutionContextProvider>, - ): void | Promise { + ): Promise { runInAction(() => { for (const key of Object.keys(this.state!)) { if (typeof this.state[key] === 'string') { @@ -80,5 +82,29 @@ export class ConnectionFormDriverPropertiesPart extends FormPart property.id === key); + if (property && value === getObjectPropertyOptionValue(property.defaultValue)) { + delete config[key]; + } + } + + return config; } } diff --git a/webapp/packages/plugin-connections/src/ConnectionForm/DriverProperties/getConnectionFormDriverPropertiesPart.ts b/webapp/packages/plugin-connections/src/ConnectionForm/DriverProperties/getConnectionFormDriverPropertiesPart.ts index 308aa4e6c4..0dcbd75601 100644 --- a/webapp/packages/plugin-connections/src/ConnectionForm/DriverProperties/getConnectionFormDriverPropertiesPart.ts +++ b/webapp/packages/plugin-connections/src/ConnectionForm/DriverProperties/getConnectionFormDriverPropertiesPart.ts @@ -8,7 +8,7 @@ import { createDataContext, DATA_CONTEXT_DI_PROVIDER } from '@cloudbeaver/core-data-context'; import type { IFormState } from '@cloudbeaver/core-ui'; import { ConnectionFormDriverPropertiesPart } from './ConnectionFormDriverPropertiesPart.js'; -import { ConnectionInfoPropertiesResource } from '@cloudbeaver/core-connections'; +import { ConnectionInfoPropertiesResource, DBDriverResource } from '@cloudbeaver/core-connections'; import type { IConnectionFormState } from '../IConnectionFormState.js'; import { getConnectionFormOptionsPart } from '../Options/getConnectionFormOptionsPart.js'; @@ -21,7 +21,8 @@ export function getConnectionFormDriverPropertiesPart(formState: IFormState