Change getCurrentConnection to return full ConnectionProfile (#6270)

This commit is contained in:
Charles Gagnon
2019-07-10 15:36:38 -07:00
committed by GitHub
parent 3abc102253
commit 758804e9cd
3 changed files with 7 additions and 8 deletions

View File

@@ -19,13 +19,7 @@ export class ExtHostConnectionManagement extends ExtHostConnectionManagementShap
}
public $getCurrentConnection(): Thenable<azdata.connection.ConnectionProfile> {
let connection: any = this._proxy.$getCurrentConnection();
connection.then((conn) => {
if (conn) {
conn.providerId = conn.providerName;
}
});
return connection;
return this._proxy.$getCurrentConnectionProfile();
}
public $getConnections(activeConnectionsOnly?: boolean): Thenable<azdata.connection.ConnectionProfile[]> {

View File

@@ -56,6 +56,10 @@ export class MainThreadConnectionManagement implements MainThreadConnectionManag
return Promise.resolve(this.convertConnection(TaskUtilities.getCurrentGlobalConnection(this._objectExplorerService, this._connectionManagementService, this._workbenchEditorService, true)));
}
public $getCurrentConnectionProfile(): Thenable<azdata.connection.ConnectionProfile> {
return Promise.resolve(this.convertToConnectionProfile(TaskUtilities.getCurrentGlobalConnection(this._objectExplorerService, this._connectionManagementService, this._workbenchEditorService, true)));
}
public $getCredentials(connectionId: string): Thenable<{ [name: string]: string }> {
return Promise.resolve(this._connectionManagementService.getActiveConnectionCredentials(connectionId));
}
@@ -120,7 +124,7 @@ export class MainThreadConnectionManagement implements MainThreadConnectionManag
let connection: azdata.connection.Connection = {
providerName: profile.providerName,
connectionId: profile.id,
options: profile.options
options: deepClone(profile.options)
};
return connection;
}

View File

@@ -609,6 +609,7 @@ export interface MainThreadConnectionManagementShape extends IDisposable {
$getConnections(activeConnectionsOnly?: boolean): Thenable<azdata.connection.ConnectionProfile[]>;
$getActiveConnections(): Thenable<azdata.connection.Connection[]>;
$getCurrentConnection(): Thenable<azdata.connection.Connection>;
$getCurrentConnectionProfile(): Thenable<azdata.connection.ConnectionProfile>;
$getCredentials(connectionId: string): Thenable<{ [name: string]: string }>;
$getServerInfo(connectedId: string): Thenable<azdata.ServerInfo>;
$openConnectionDialog(providers: string[], initialConnectionProfile?: azdata.IConnectionProfile, connectionCompletionOptions?: azdata.IConnectionCompletionOptions): Thenable<azdata.connection.Connection>;