Change the wizard setup (#8845)

This commit is contained in:
Amir Omidi
2020-01-08 12:01:40 -08:00
committed by GitHub
parent 2d2376a2a6
commit 8a0824c1c6
2 changed files with 7 additions and 9 deletions

View File

@@ -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 = <ImportDataModel>{};
let model = {} as ImportDataModel;
let profile = p ? <azdata.IConnectionProfile>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<number, ImportPage> = new Map<number, ImportPage>();
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"));