From 2ca6e7ae64d60eebb9c606697c381f94d5e7db27 Mon Sep 17 00:00:00 2001 From: Aasim Khan Date: Tue, 5 May 2020 20:13:16 -0700 Subject: [PATCH] Removed PG connections and the refresh button from the import wizard. (#10248) * - Removed PG connections in the new connection wizard - If a PG database is active sending an error - Removed refresh button #6611 * Added back the refresh * -Using getConnection only once. * -Fixed the error message -Fixed the bugs mentioned in the PR Co-authored-by: Aasim Khan --- .../import/src/wizard/flatFileWizard.ts | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/extensions/import/src/wizard/flatFileWizard.ts b/extensions/import/src/wizard/flatFileWizard.ts index b86820a9d8..4462debd8c 100644 --- a/extensions/import/src/wizard/flatFileWizard.ts +++ b/extensions/import/src/wizard/flatFileWizard.ts @@ -38,14 +38,25 @@ export class FlatFileWizard { let pages: Map = new Map(); - let connectionId = (await azdata.connection.getCurrentConnection())?.connectionId ?? - (await azdata.connection.openConnectionDialog())?.connectionId; + let currentConnection = await azdata.connection.getCurrentConnection(); - if (!connectionId) { - vscode.window.showErrorMessage(localize('import.needConnection', "Please connect to a server before using this wizard.")); - return; + let connectionId: string; + + if (!currentConnection) { + connectionId = (await azdata.connection.openConnectionDialog(['MSSQL'])).connectionId; + if (!connectionId) { + vscode.window.showErrorMessage(localize('import.needConnection', "Please connect to a server before using this wizard.")); + return; + } + } else { + if (currentConnection.providerId !== 'MSSQL') { + vscode.window.showErrorMessage(localize('import.needSQLConnection', "SQL Server Import extension does not support this type of connection")); + return; + } + connectionId = currentConnection.connectionId; } + model.serverId = connectionId; this.wizard = azdata.window.createWizard(localize('flatFileImport.wizardName', "Import flat file wizard"));