mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
CB-4067 fixes form ssl saving and driver properties
This commit is contained in:
@@ -57,7 +57,6 @@ export const ConnectionForm = observer<ConnectionFormProps>(function ConnectionF
|
||||
if (formState.mode === 'create') {
|
||||
notificationService.notify(
|
||||
{
|
||||
// TODO add message
|
||||
title: 'connections_connection_create_success',
|
||||
message: info?.name,
|
||||
},
|
||||
@@ -66,7 +65,6 @@ export const ConnectionForm = observer<ConnectionFormProps>(function ConnectionF
|
||||
} else {
|
||||
notificationService.notify(
|
||||
{
|
||||
// TODO add message
|
||||
title: 'connections_connection_update_success',
|
||||
message: info?.name,
|
||||
},
|
||||
|
||||
+15
-2
@@ -181,6 +181,9 @@ export class ConnectionFormOptionsPart extends FormPart<IConnectionFormOptionsSt
|
||||
config.autocommit = info.autocommit;
|
||||
config.readOnly = info.readOnly;
|
||||
|
||||
// so driver properties tab has initial values
|
||||
config.properties = info.properties;
|
||||
|
||||
if (info.authProperties && config.credentials) {
|
||||
for (const property of info.authProperties) {
|
||||
if (!property.features.includes('password')) {
|
||||
@@ -395,6 +398,16 @@ export class ConnectionFormOptionsPart extends FormPart<IConnectionFormOptionsSt
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormStateRefactored>>,
|
||||
): Promise<void> {
|
||||
const status = contexts.getContext(formStatusContext);
|
||||
const state: IConnectionFormOptionsState = {
|
||||
...this.state,
|
||||
// merges properties from DriverPropertiesPart
|
||||
properties: {
|
||||
...this.state.properties,
|
||||
...this.formState.state.config.properties,
|
||||
},
|
||||
// merges network handlers from SSHPart and SSLPart
|
||||
networkHandlersConfig: [...(this.state.networkHandlersConfig ?? []), ...(this.formState.state.config.networkHandlersConfig ?? [])],
|
||||
};
|
||||
|
||||
if (!this.formState.state.projectId) {
|
||||
status.error('connections_connection_create_fail');
|
||||
@@ -408,14 +421,14 @@ export class ConnectionFormOptionsPart extends FormPart<IConnectionFormOptionsSt
|
||||
this.state,
|
||||
);
|
||||
} else {
|
||||
const connection = await this.connectionInfoResource.create(this.formState.state.projectId, this.state);
|
||||
const connection = await this.connectionInfoResource.create(this.formState.state.projectId, state);
|
||||
this.state.connectionId = connection.id;
|
||||
this.formState.state.config.connectionId = connection.id;
|
||||
this.formState.setMode(FormMode.Edit);
|
||||
}
|
||||
} else {
|
||||
// TODO message this in ConnectionForm.tsx
|
||||
const info = await this.connectionInfoResource.test(this.formState.state.projectId, this.state);
|
||||
const info = await this.connectionInfoResource.test(this.formState.state.projectId, state);
|
||||
status.info('Connection is established');
|
||||
status.info('Client version: ' + info.clientVersion);
|
||||
status.info('Server version: ' + info.serverVersion);
|
||||
|
||||
@@ -105,7 +105,6 @@ export class ConnectionFormSSHPart extends FormPart<void, IConnectionFormStateRe
|
||||
|
||||
handlerConfig = getTrimmedSSHConfig(handlerConfig);
|
||||
config.networkHandlersConfig.push(handlerConfig);
|
||||
this.formState.state.config.networkHandlersConfig = config.networkHandlersConfig;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ export class ConnectionFormSSLPart extends FormPart<void, IConnectionFormStateRe
|
||||
}
|
||||
|
||||
protected override async loader(): Promise<void> {
|
||||
if (!this.isChanged || !this.formState.state.config.driverId) {
|
||||
if (!this.formState.state.config.driverId) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,6 @@ export class ConnectionFormSSLPart extends FormPart<void, IConnectionFormStateRe
|
||||
|
||||
trimSSLConfig(handlerConfig);
|
||||
config.networkHandlersConfig.push(handlerConfig);
|
||||
this.formState.state.config.networkHandlersConfig = config.networkHandlersConfig;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user