Support Save As CSV/JSON/Excel/XML from Notebooks (#6627)

Updated existing serialization code so it actually supports serialization. Still needs work to replace the saveAs function when a QueryProvider doesn't support save as, but want to handle in separate PR.
Removed separate MainThread/ExtHostSerializationProvider code as the DataProtocol code is the right place to put this code
Plumbed support through the gridOutputComponent to use the new serialize method in the serialization provider
Refactored the resultSerializer so majority of code can be shared between both implementations (for example file save dialog -> save -> show file on completion)

* Update to latest SQLToolsService release
This commit is contained in:
Kevin Cunnane
2019-08-09 11:37:53 -07:00
committed by GitHub
parent b589abbea5
commit fb7ece006d
20 changed files with 482 additions and 253 deletions

View File

@@ -504,6 +504,15 @@ export abstract class ExtHostDataProtocolShape {
*/
$schemaCompareCancel(handle: number, operationId: string): Thenable<azdata.ResultStatus> { throw ni(); }
/**
* Serialization start request
*/
$startSerialization(handle: number, requestParams: azdata.SerializeDataStartRequestParams): Thenable<azdata.SerializeDataResult> { throw ni(); }
/**
* Serialization continuation request
*/
$continueSerialization(handle: number, requestParams: azdata.SerializeDataContinueRequestParams): Thenable<azdata.SerializeDataResult> { throw ni(); }
}
/**
@@ -533,13 +542,6 @@ export abstract class ExtHostCredentialManagementShape {
$deleteCredential(credentialId: string): Thenable<boolean> { throw ni(); }
}
/**
* Serialization provider extension host class.
*/
export abstract class ExtHostSerializationProviderShape {
$saveAs(saveFormat: string, savePath: string, results: string, appendToFile: boolean): Thenable<azdata.SaveResultRequestResult> { throw ni(); }
}
export interface MainThreadAccountManagementShape extends IDisposable {
$registerAccountProvider(providerMetadata: azdata.AccountProviderMetadata, handle: number): Thenable<any>;
$unregisterAccountProvider(handle: number): Thenable<any>;
@@ -575,6 +577,7 @@ export interface MainThreadDataProtocolShape extends IDisposable {
$registerAgentServicesProvider(providerId: string, handle: number): Promise<any>;
$registerDacFxServicesProvider(providerId: string, handle: number): Promise<any>;
$registerSchemaCompareServicesProvider(providerId: string, handle: number): Promise<any>;
$registerSerializationProvider(providerId: string, handle: number): Promise<any>;
$unregisterProvider(handle: number): Promise<any>;
$onConnectionComplete(handle: number, connectionInfoSummary: azdata.ConnectionInfoSummary): void;
$onIntelliSenseCacheComplete(handle: number, connectionUri: string): void;
@@ -625,11 +628,6 @@ export interface MainThreadCredentialManagementShape extends IDisposable {
$unregisterCredentialProvider(handle: number): Promise<any>;
}
export interface MainThreadSerializationProviderShape extends IDisposable {
$registerSerializationProvider(handle: number): Promise<any>;
$unregisterSerializationProvider(handle: number): Promise<any>;
}
function ni() { return new Error('Not implemented'); }
// --- proxy identifiers
@@ -642,7 +640,6 @@ export const SqlMainContext = {
MainThreadDataProtocol: createMainId<MainThreadDataProtocolShape>('MainThreadDataProtocol'),
MainThreadObjectExplorer: createMainId<MainThreadObjectExplorerShape>('MainThreadObjectExplorer'),
MainThreadBackgroundTaskManagement: createMainId<MainThreadBackgroundTaskManagementShape>('MainThreadBackgroundTaskManagement'),
MainThreadSerializationProvider: createMainId<MainThreadSerializationProviderShape>('MainThreadSerializationProvider'),
MainThreadResourceProvider: createMainId<MainThreadResourceProviderShape>('MainThreadResourceProvider'),
MainThreadModalDialog: createMainId<MainThreadModalDialogShape>('MainThreadModalDialog'),
MainThreadTasks: createMainId<MainThreadTasksShape>('MainThreadTasks'),
@@ -662,7 +659,6 @@ export const SqlExtHostContext = {
ExtHostCredentialManagement: createExtId<ExtHostCredentialManagementShape>('ExtHostCredentialManagement'),
ExtHostDataProtocol: createExtId<ExtHostDataProtocolShape>('ExtHostDataProtocol'),
ExtHostObjectExplorer: createExtId<ExtHostObjectExplorerShape>('ExtHostObjectExplorer'),
ExtHostSerializationProvider: createExtId<ExtHostSerializationProviderShape>('ExtHostSerializationProvider'),
ExtHostResourceProvider: createExtId<ExtHostResourceProviderShape>('ExtHostResourceProvider'),
ExtHostModalDialogs: createExtId<ExtHostModalDialogsShape>('ExtHostModalDialogs'),
ExtHostTasks: createExtId<ExtHostTasksShape>('ExtHostTasks'),