Files
azuredatastudio/src/sql/workbench/api/node/extHostConnectionManagement.ts
Yurong He 3ddc5e7846 Added Unified connection support (#3785)
* Added Unified connection support

* Use generic way to do expandNode.
Cleanup the ported code and removed unreference code. Added as needed later.
Resolved PR comments.

* Minor fixes and removed timer for all expanders for now. If any providers can't response, the tree node will spin and wait. We may improve later.

* Change handSessionClose to not thenable.
Added a node to OE to show error message instead of reject. So we could show partial expanded result if get any.
Resolve PR comments

* Minor fixes of PR comments
2019-01-29 14:37:14 -08:00

59 lines
2.3 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { ExtHostConnectionManagementShape, SqlMainContext, MainThreadConnectionManagementShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
import { generateUuid } from 'vs/base/common/uuid';
import * as sqlops from 'sqlops';
export class ExtHostConnectionManagement extends ExtHostConnectionManagementShape {
private _proxy: MainThreadConnectionManagementShape;
constructor(
mainContext: IMainContext
) {
super();
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadConnectionManagement);
}
public $getActiveConnections(): Thenable<sqlops.connection.Connection[]> {
return this._proxy.$getActiveConnections();
}
public $getCurrentConnection(): Thenable<sqlops.connection.Connection> {
return this._proxy.$getCurrentConnection();
}
public $getCredentials(connectionId: string): Thenable<{ [name: string]: string }> {
return this._proxy.$getCredentials(connectionId);
}
public $getServerInfo(connectionId: string): Thenable<sqlops.ServerInfo> {
return this._proxy.$getServerInfo(connectionId);
}
public $openConnectionDialog(providers?: string[], initialConnectionProfile?: sqlops.IConnectionProfile, connectionCompletionOptions?: sqlops.IConnectionCompletionOptions): Thenable<sqlops.connection.Connection> {
return this._proxy.$openConnectionDialog(providers, initialConnectionProfile, connectionCompletionOptions);
}
public $listDatabases(connectionId: string): Thenable<string[]> {
return this._proxy.$listDatabases(connectionId);
}
public $getConnectionString(connectionId: string, includePassword: boolean): Thenable<string> {
return this._proxy.$getConnectionString(connectionId, includePassword);
}
public $getUriForConnection(connectionId: string): Thenable<string> {
return this._proxy.$getUriForConnection(connectionId);
}
public $connect(connectionProfile: sqlops.IConnectionProfile): Thenable<sqlops.ConnectionResult> {
return this._proxy.$connect(connectionProfile);
}
}