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
This commit is contained in:
Yurong He
2019-01-29 14:37:14 -08:00
committed by GitHub
parent b439ea45ec
commit 3ddc5e7846
37 changed files with 3087 additions and 80 deletions

View File

@@ -15,7 +15,7 @@ import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilit
import { IQueryManagementService } from 'sql/platform/query/common/queryManagement';
import * as sqlops from 'sqlops';
import { IMetadataService } from 'sql/platform/metadata/common/metadataService';
import { IObjectExplorerService } from 'sql/parts/objectExplorer/common/objectExplorerService';
import { IObjectExplorerService, NodeExpandInfoWithProviderId } from 'sql/parts/objectExplorer/common/objectExplorerService';
import { IScriptingService } from 'sql/platform/scripting/common/scriptingService';
import { IAdminService } from 'sql/workbench/services/admin/common/adminService';
import { IJobManagementService } from 'sql/platform/jobManagement/common/interfaces';
@@ -231,6 +231,7 @@ export class MainThreadDataProtocol implements MainThreadDataProtocolShape {
public $registerObjectExplorerProvider(providerId: string, handle: number): TPromise<any> {
const self = this;
this._objectExplorerService.registerProvider(providerId, <sqlops.ObjectExplorerProvider>{
providerId: providerId,
createNewSession(connection: sqlops.ConnectionInfo): Thenable<sqlops.ObjectExplorerSessionResponse> {
return self._proxy.$createObjectExplorerSession(handle, connection);
},
@@ -251,6 +252,32 @@ export class MainThreadDataProtocol implements MainThreadDataProtocolShape {
return undefined;
}
public $registerObjectExplorerNodeProvider(providerId: string, supportedProviderId: string, group: string, handle: number): TPromise<any> {
const self = this;
this._objectExplorerService.registerNodeProvider(<sqlops.ObjectExplorerNodeProvider> {
supportedProviderId: supportedProviderId,
providerId: providerId,
group: group,
expandNode(nodeInfo: sqlops.ExpandNodeInfo): Thenable<boolean> {
return self._proxy.$expandObjectExplorerNode(handle, nodeInfo);
},
refreshNode(nodeInfo: sqlops.ExpandNodeInfo): Thenable<boolean> {
return self._proxy.$refreshObjectExplorerNode(handle, nodeInfo);
},
findNodes(findNodesInfo: sqlops.FindNodesInfo): Thenable<sqlops.ObjectExplorerFindNodesResponse> {
return self._proxy.$findNodes(handle, findNodesInfo);
},
handleSessionOpen(session: sqlops.ObjectExplorerSession): Thenable<boolean> {
return self._proxy.$createObjectExplorerNodeProviderSession(handle, session);
},
handleSessionClose(closeSessionInfo: sqlops.ObjectExplorerCloseSessionInfo): void {
return self._proxy.$handleSessionClose(handle, closeSessionInfo);
}
});
return undefined;
}
public $registerTaskServicesProvider(providerId: string, handle: number): TPromise<any> {
const self = this;
this._taskService.registerProvider(providerId, <sqlops.TaskServicesProvider>{
@@ -474,8 +501,9 @@ export class MainThreadDataProtocol implements MainThreadDataProtocolShape {
this._objectExplorerService.onSessionDisconnected(handle, sessionResponse);
}
public $onObjectExplorerNodeExpanded(handle: number, expandResponse: sqlops.ObjectExplorerExpandInfo): void {
this._objectExplorerService.onNodeExpanded(handle, expandResponse);
public $onObjectExplorerNodeExpanded(providerId: string, expandResponse: sqlops.ObjectExplorerExpandInfo): void {
let expandInfo: NodeExpandInfoWithProviderId = Object.assign({ providerId: providerId }, expandResponse);
this._objectExplorerService.onNodeExpanded(expandInfo);
}
//Tasks handlers