diff --git a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/WebConnectionConfig.java b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/WebConnectionConfig.java index 053c39a435..ba0030f7c7 100644 --- a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/WebConnectionConfig.java +++ b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/WebConnectionConfig.java @@ -57,6 +57,7 @@ public class WebConnectionConfig { private boolean sharedCredentials; private Map mainPropertyValues; private Map providerProperties; + private Map externalParameters; private List networkHandlersConfig; private DBPDriverConfigurationType configurationType; private String selectedSecretId; @@ -103,6 +104,7 @@ public class WebConnectionConfig { String configType = JSONUtils.getString(params, "configurationType"); configurationType = configType == null ? null : DBPDriverConfigurationType.valueOf(configType); + externalParameters = JSONUtils.getObjectOrNull(params, "externalParameters"); networkHandlersConfig = new ArrayList<>(); for (Map nhc : JSONUtils.getObjectList(params, "networkHandlersConfig")) { @@ -248,4 +250,8 @@ public class WebConnectionConfig { public String getDefaultSchemaName() { return defaultSchemaName; } + + public Map getExternalParameters() { + return externalParameters; + } } diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/model/WebDatabaseDriverInfo.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/model/WebDatabaseDriverInfo.java index 0f836b072c..fc798da397 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/model/WebDatabaseDriverInfo.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/model/WebDatabaseDriverInfo.java @@ -18,10 +18,7 @@ package io.cloudbeaver.model; import io.cloudbeaver.DBWebException; import io.cloudbeaver.WebServiceUtils; -import io.cloudbeaver.model.app.WebAppConfiguration; import io.cloudbeaver.model.session.WebSession; -import io.cloudbeaver.model.utils.ConfigurationUtils; -import io.cloudbeaver.server.WebAppUtils; import org.jkiss.dbeaver.DBException; import org.jkiss.dbeaver.Log; import org.jkiss.dbeaver.model.DBConstants; @@ -39,8 +36,6 @@ import org.jkiss.utils.CommonUtils; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.Map; -import java.util.Optional; -import java.util.stream.Stream; /** * Web driver configuration @@ -257,29 +252,14 @@ public class WebDatabaseDriverInfo { @Property public WebPropertyInfo[] getProviderProperties() { - WebPropertyInfo[] additionalWebProperty = Optional.of(WebAppUtils.getWebApplication()) - .filter(app -> app.getAppConfiguration().isSecretManagerEnabled()) - .map(app -> app.getConnectionController().getExternalInfo(webSession)) - .orElse(new WebPropertyInfo[0]); - - WebPropertyInfo[] providerProperties = Arrays.stream(driver.getProviderPropertyDescriptors()) + return Arrays.stream(driver.getProviderPropertyDescriptors()) .map(p -> new WebPropertyInfo(webSession, p, null)) .toArray(WebPropertyInfo[]::new); - - return Stream.concat( - Arrays.stream(additionalWebProperty), - Arrays.stream(providerProperties) - ).toArray(WebPropertyInfo[]::new); } @Property public boolean isEnabled() { - WebAppConfiguration config = WebAppUtils.getWebApplication().getAppConfiguration(); - return ConfigurationUtils.isDriverEnabled( - driver, - config.getEnabledDrivers(), - config.getDisabledDrivers() - ); + return WebServiceUtils.isDriverEnabled(driver); } @Property diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java index 3f61db48b9..5ba9d33d82 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java @@ -21,11 +21,9 @@ import io.cloudbeaver.WebObjectId; import io.cloudbeaver.model.WebConnectionConfig; import io.cloudbeaver.model.WebConnectionInfo; import io.cloudbeaver.model.WebNetworkHandlerConfigInput; -import io.cloudbeaver.model.WebPropertyInfo; import io.cloudbeaver.model.session.WebSession; import org.jkiss.code.NotNull; import org.jkiss.code.Nullable; -import org.jkiss.dbeaver.DBException; import org.jkiss.dbeaver.model.DBPDataSourceContainer; import org.jkiss.dbeaver.model.app.DBPDataSourceRegistry; import org.jkiss.dbeaver.registry.DataSourceDescriptor; @@ -98,5 +96,4 @@ public interface ConnectionController { void validateConnection(DBPDataSourceContainer dataSourceContainer) throws DBWebException; - WebPropertyInfo[] getExternalInfo(WebSession webSession); } diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionControllerCE.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionControllerCE.java index be2fa613cc..f99e311c1e 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionControllerCE.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionControllerCE.java @@ -20,7 +20,6 @@ import io.cloudbeaver.*; import io.cloudbeaver.model.WebConnectionConfig; import io.cloudbeaver.model.WebConnectionInfo; import io.cloudbeaver.model.WebNetworkHandlerConfigInput; -import io.cloudbeaver.model.WebPropertyInfo; import io.cloudbeaver.model.session.WebSession; import io.cloudbeaver.utils.ServletAppUtils; import io.cloudbeaver.utils.WebDataSourceUtils; @@ -482,10 +481,6 @@ public class ConnectionControllerCE implements ConnectionController { public void validateConnection(DBPDataSourceContainer dataSourceContainer) throws DBWebException { } - public WebPropertyInfo[] getExternalInfo(WebSession session) { - return null; - } - private void validateDriverLibrariesPresence(@NotNull DBPDataSourceContainer container) throws DBWebException { if (!DBWorkbench.isDistributed() && container.getDriver().getDriverLoader(container).needsExternalDependencies()) { diff --git a/webapp/packages/core-connections/src/index.ts b/webapp/packages/core-connections/src/index.ts index 1875aeeed0..2b10645eb9 100644 --- a/webapp/packages/core-connections/src/index.ts +++ b/webapp/packages/core-connections/src/index.ts @@ -62,5 +62,6 @@ export * from './NetworkHandlerResource.js'; export * from './useConnectionInfo.js'; export * from './useDBDriver.js'; export * from './USER_NAME_PROPERTY_ID.js'; +export * from './parseConnectionKey.js'; export { manifest as coreConnectionsManifest } from './manifest.js'; diff --git a/webapp/packages/core-utils/src/emptyConstants.ts b/webapp/packages/core-utils/src/emptyConstants.ts index edc9b3ffa5..9f409ea777 100644 --- a/webapp/packages/core-utils/src/emptyConstants.ts +++ b/webapp/packages/core-utils/src/emptyConstants.ts @@ -1,10 +1,12 @@ /* * CloudBeaver - Cloud Database Manager - * Copyright (C) 2020-2024 DBeaver Corp and others + * Copyright (C) 2020-2025 DBeaver Corp and others * * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +export type EmptyObject = Record; + export const EMPTY_ARRAY: ReadonlyArray = Object.freeze([]); -export const EMPTY_OBJECT: Readonly> = Object.freeze({}); +export const EMPTY_OBJECT: Readonly = Object.freeze({}); diff --git a/webapp/packages/plugin-connections/src/ConnectionForm/ConnectionFormService.ts b/webapp/packages/plugin-connections/src/ConnectionForm/ConnectionFormService.ts index 01cf587966..38ddad94ef 100644 --- a/webapp/packages/plugin-connections/src/ConnectionForm/ConnectionFormService.ts +++ b/webapp/packages/plugin-connections/src/ConnectionForm/ConnectionFormService.ts @@ -8,17 +8,23 @@ import { injectable } from '@cloudbeaver/core-di'; import { NotificationService } from '@cloudbeaver/core-events'; import { LocalizationService } from '@cloudbeaver/core-localization'; -import { FormBaseService } from '@cloudbeaver/core-ui'; +import { FormBaseService, type IFormState } from '@cloudbeaver/core-ui'; import type { IConnectionFormProps, IConnectionFormState } from './IConnectionFormState.js'; -import { importLazyComponent } from '@cloudbeaver/core-blocks'; +import { importLazyComponent, PlaceholderContainer } from '@cloudbeaver/core-blocks'; const ConnectionFormBaseActionsLoader = importLazyComponent(() => import('./ConnectionFormBaseActions.js').then(m => m.ConnectionFormBaseActions)); +export type ProviderPropertiesContainerFormProps = { + formState: IFormState; +}; + @injectable(() => [LocalizationService, NotificationService]) export class ConnectionFormService extends FormBaseService { + readonly providerPropertiesContainer: PlaceholderContainer; + constructor(localizationService: LocalizationService, notificationService: NotificationService) { super(localizationService, notificationService, 'Connection form'); - + this.providerPropertiesContainer = new PlaceholderContainer(); this.actionsContainer.add(ConnectionFormBaseActionsLoader); } } diff --git a/webapp/packages/plugin-connections/src/ConnectionForm/Options/Options.tsx b/webapp/packages/plugin-connections/src/ConnectionForm/Options/Options.tsx index ffaa447d9c..96e0a4a4ae 100644 --- a/webapp/packages/plugin-connections/src/ConnectionForm/Options/Options.tsx +++ b/webapp/packages/plugin-connections/src/ConnectionForm/Options/Options.tsx @@ -342,14 +342,7 @@ export const Options: TabContainerPanelComponent = observe )} )} - {driver?.providerProperties && ( - - )} + {driver?.providerProperties && } diff --git a/webapp/packages/plugin-connections/src/ConnectionForm/Options/ProviderPropertiesForm.tsx b/webapp/packages/plugin-connections/src/ConnectionForm/Options/ProviderPropertiesForm.tsx index 388af34588..cd97fbda2e 100644 --- a/webapp/packages/plugin-connections/src/ConnectionForm/Options/ProviderPropertiesForm.tsx +++ b/webapp/packages/plugin-connections/src/ConnectionForm/Options/ProviderPropertiesForm.tsx @@ -13,24 +13,31 @@ import { Group, GroupTitle, ObjectPropertyInfoForm, + Placeholder, useObjectPropertyCategories, useTranslate, } from '@cloudbeaver/core-blocks'; import { type DriverPropertyInfoFragment, getObjectPropertyType } from '@cloudbeaver/core-sdk'; -import type { IConnectionFormOptionsState } from './IConnectionFormOptionsState.js'; +import type { IFormState } from '@cloudbeaver/core-ui'; +import type { IConnectionFormState } from '../IConnectionFormState.js'; +import { getConnectionFormOptionsPart } from './getConnectionFormOptionsPart.js'; +import { useService } from '@cloudbeaver/core-di'; +import { ConnectionFormService } from '../ConnectionFormService.js'; type DriverPropertyInfo = DriverPropertyInfoFragment; interface Props { - config: IConnectionFormOptionsState; + formState: IFormState; properties: DriverPropertyInfo[]; - disabled?: boolean; readonly?: boolean; } -export const ProviderPropertiesForm = observer(function ProviderPropertiesForm({ config, properties, disabled, readonly }) { +export const ProviderPropertiesForm = observer(function ProviderPropertiesForm({ properties, readonly, formState }) { const translate = useTranslate(); + const config = getConnectionFormOptionsPart(formState).state; + const disabled = formState.isDisabled; const supportedProperties = properties.filter(property => property.supportedConfigurationTypes?.some(type => type === config.configurationType)); + const connectionFormService = useService(ConnectionFormService); const { categories, isUncategorizedExists } = useObjectPropertyCategories(supportedProperties); @@ -43,6 +50,7 @@ export const ProviderPropertiesForm = observer(function ProviderPropertie return ( + {isUncategorizedExists && ( <> {translate('ui_settings')}