mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Revert changes in mainThreadConnectionManagement (#21802)
This commit is contained in:
@@ -10,7 +10,6 @@ import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/br
|
|||||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||||
import * as TaskUtilities from 'sql/workbench/browser/taskUtilities';
|
import * as TaskUtilities from 'sql/workbench/browser/taskUtilities';
|
||||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||||
import { convertToRpcConnectionProfile } from 'sql/platform/connection/common/utils';
|
|
||||||
import { Disposable, DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
|
import { Disposable, DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
|
||||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||||
import { generateUuid } from 'vs/base/common/uuid';
|
import { generateUuid } from 'vs/base/common/uuid';
|
||||||
@@ -93,7 +92,7 @@ export class MainThreadConnectionManagement extends Disposable implements MainTh
|
|||||||
}
|
}
|
||||||
|
|
||||||
public $getConnections(activeConnectionsOnly?: boolean): Thenable<azdata.connection.ConnectionProfile[]> {
|
public $getConnections(activeConnectionsOnly?: boolean): Thenable<azdata.connection.ConnectionProfile[]> {
|
||||||
return Promise.resolve(this._connectionManagementService.getConnections(activeConnectionsOnly).map(profile => convertToRpcConnectionProfile(profile, true, this._connectionManagementService.removeConnectionProfileCredentials)));
|
return Promise.resolve(this._connectionManagementService.getConnections(activeConnectionsOnly).map(profile => this.convertToConnectionProfile(profile)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public $getConnection(uri: string): Thenable<azdata.connection.ConnectionProfile> {
|
public $getConnection(uri: string): Thenable<azdata.connection.ConnectionProfile> {
|
||||||
@@ -102,7 +101,22 @@ export class MainThreadConnectionManagement extends Disposable implements MainTh
|
|||||||
return Promise.resolve(undefined);
|
return Promise.resolve(undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
let connection = convertToRpcConnectionProfile(profile);
|
let connection: azdata.connection.ConnectionProfile = {
|
||||||
|
providerId: profile.providerName,
|
||||||
|
connectionId: profile.id,
|
||||||
|
connectionName: profile.connectionName,
|
||||||
|
serverName: profile.serverName,
|
||||||
|
databaseName: profile.databaseName,
|
||||||
|
userName: profile.userName,
|
||||||
|
password: profile.password,
|
||||||
|
authenticationType: profile.authenticationType,
|
||||||
|
savePassword: profile.savePassword,
|
||||||
|
groupFullName: profile.groupFullName,
|
||||||
|
groupId: profile.groupId,
|
||||||
|
saveProfile: profile.savePassword,
|
||||||
|
azureTenantId: profile.azureTenantId,
|
||||||
|
options: profile.options
|
||||||
|
};
|
||||||
return Promise.resolve(connection);
|
return Promise.resolve(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +129,7 @@ export class MainThreadConnectionManagement extends Disposable implements MainTh
|
|||||||
}
|
}
|
||||||
|
|
||||||
public $getCurrentConnectionProfile(): Thenable<azdata.connection.ConnectionProfile> {
|
public $getCurrentConnectionProfile(): Thenable<azdata.connection.ConnectionProfile> {
|
||||||
return Promise.resolve(convertToRpcConnectionProfile(TaskUtilities.getCurrentGlobalConnection(this._objectExplorerService, this._connectionManagementService, this._workbenchEditorService, true,), true, this._connectionManagementService.removeConnectionProfileCredentials));
|
return Promise.resolve(this.convertToConnectionProfile(TaskUtilities.getCurrentGlobalConnection(this._objectExplorerService, this._connectionManagementService, this._workbenchEditorService, true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public $getCredentials(connectionId: string): Thenable<{ [name: string]: string }> {
|
public $getCredentials(connectionId: string): Thenable<{ [name: string]: string }> {
|
||||||
@@ -201,6 +215,30 @@ export class MainThreadConnectionManagement extends Disposable implements MainTh
|
|||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private convertToConnectionProfile(profile: IConnectionProfile): azdata.connection.ConnectionProfile {
|
||||||
|
if (!profile) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
profile = this._connectionManagementService.removeConnectionProfileCredentials(profile);
|
||||||
|
let connection: azdata.connection.ConnectionProfile = {
|
||||||
|
providerId: profile.providerName,
|
||||||
|
connectionId: profile.id,
|
||||||
|
options: deepClone(profile.options),
|
||||||
|
connectionName: profile.connectionName,
|
||||||
|
serverName: profile.serverName,
|
||||||
|
databaseName: profile.databaseName,
|
||||||
|
userName: profile.userName,
|
||||||
|
password: profile.password,
|
||||||
|
authenticationType: profile.authenticationType,
|
||||||
|
savePassword: profile.savePassword,
|
||||||
|
groupFullName: profile.groupFullName,
|
||||||
|
groupId: profile.groupId,
|
||||||
|
saveProfile: profile.saveProfile
|
||||||
|
};
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
|
||||||
public $connect(connectionProfile: IConnectionProfile, saveConnection: boolean = true, showDashboard: boolean = true): Thenable<azdata.ConnectionResult> {
|
public $connect(connectionProfile: IConnectionProfile, saveConnection: boolean = true, showDashboard: boolean = true): Thenable<azdata.ConnectionResult> {
|
||||||
let profile = new ConnectionProfile(this._capabilitiesService, connectionProfile);
|
let profile = new ConnectionProfile(this._capabilitiesService, connectionProfile);
|
||||||
profile.id = generateUuid();
|
profile.id = generateUuid();
|
||||||
|
|||||||
Reference in New Issue
Block a user