mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 01:25:37 -05:00
Correctly route notebook serialization requests to SQL Tools Service. (#20874)
This commit is contained in:
@@ -48,6 +48,7 @@ import { getChartMaxRowCount, notifyMaxRowCountExceeded } from 'sql/workbench/co
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
|
||||
import { IExecutionPlanService } from 'sql/workbench/services/executionPlan/common/interfaces';
|
||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
|
||||
@Component({
|
||||
selector: GridOutputComponent.SELECTOR,
|
||||
@@ -487,8 +488,20 @@ export class DataResourceDataProvider implements IGridDataProvider {
|
||||
// interface than the query execution service's saveResults handlers. Here, we take the
|
||||
// format-specific request params (eg, includeHeaders for CSV) and merge the format-agnostic
|
||||
// request params for the serialization request (eg, saveFormat, filePath).
|
||||
let provider = this.cellModel.notebookModel.context?.providerName;
|
||||
if (!provider) {
|
||||
// If no connection currently exists, then pick the first connection provider for the current kernel.
|
||||
// If there's still no provider, then fallback to the default MSSQL one.
|
||||
let connProviders = this.cellModel.notebookModel.getApplicableConnectionProviderIds(this.cellModel.notebookModel.selectedKernelDisplayName);
|
||||
if (connProviders?.length > 0) {
|
||||
provider = connProviders[0];
|
||||
} else {
|
||||
provider = mssqlProviderName;
|
||||
}
|
||||
}
|
||||
let formatSpecificParams = serializer.getBasicSaveParameters(format);
|
||||
let formatAgnosticParams = <Partial<SerializeDataParams>>{
|
||||
serializationProviderId: provider,
|
||||
saveFormat: format,
|
||||
filePath: filePath.fsPath,
|
||||
columns: columns,
|
||||
|
||||
@@ -79,7 +79,7 @@ suite('Data Resource Data Provider', function () {
|
||||
fileDialogService = new TestFileDialogService(pathService);
|
||||
notificationService = new TestNotificationService();
|
||||
serializationService = new SerializationService(undefined, undefined); //_connectionService _capabilitiesService
|
||||
serializationService.registerProvider('testProviderId', new TestSerializationProvider());
|
||||
serializationService.registerProvider('MSSQL', new TestSerializationProvider());
|
||||
serializer = new ResultSerializer(
|
||||
undefined, // IQueryManagementService
|
||||
undefined, // IConfigurationService
|
||||
|
||||
Reference in New Issue
Block a user