From 8a0824c1c616c23e965623019a82cc0ca7112c59 Mon Sep 17 00:00:00 2001 From: Amir Omidi Date: Wed, 8 Jan 2020 12:01:40 -0800 Subject: [PATCH] Change the wizard setup (#8845) --- extensions/import/package.json | 2 +- extensions/import/src/wizard/flatFileWizard.ts | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/extensions/import/package.json b/extensions/import/package.json index 7b72954e81..7854d71faf 100644 --- a/extensions/import/package.json +++ b/extensions/import/package.json @@ -2,7 +2,7 @@ "name": "import", "displayName": "SQL Server Import", "description": "SQL Server Import for Azure Data Studio supports importing CSV or JSON files into SQL Server.", - "version": "0.12.0", + "version": "0.13.0", "publisher": "Microsoft", "preview": true, "engines": { diff --git a/extensions/import/src/wizard/flatFileWizard.ts b/extensions/import/src/wizard/flatFileWizard.ts index ddec621066..297c220ea4 100644 --- a/extensions/import/src/wizard/flatFileWizard.ts +++ b/extensions/import/src/wizard/flatFileWizard.ts @@ -2,8 +2,6 @@ * 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 * as vscode from 'vscode'; import * as nls from 'vscode-nls'; import * as azdata from 'azdata'; @@ -29,9 +27,9 @@ export class FlatFileWizard { } public async start(p: any, ...args: any[]) { - let model = {}; + let model = {} as ImportDataModel; - let profile = p ? p.connectionProfile : null; + let profile = p?.connectionProfile as azdata.IConnectionProfile; if (profile) { model.serverId = profile.id; model.database = profile.databaseName; @@ -39,15 +37,15 @@ export class FlatFileWizard { let pages: Map = new Map(); + let connectionId = (await azdata.connection.getCurrentConnection())?.connectionId ?? + (await azdata.connection.openConnectionDialog())?.connectionId; - let connections = await azdata.connection.getActiveConnections(); - if (!connections || connections.length === 0) { + if (!connectionId) { vscode.window.showErrorMessage(localize('import.needConnection', "Please connect to a server before using this wizard.")); return; } - let currentConnection = await azdata.connection.getCurrentConnection(); - model.serverId = currentConnection.connectionId; + model.serverId = connectionId; this.wizard = azdata.window.createWizard(localize('flatFileImport.wizardName', "Import flat file wizard")); let page1 = azdata.window.createWizardPage(localize('flatFileImport.page1Name', "Specify Input File"));