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 <aaskhan@microsoft.com>
This commit is contained in:
Aasim Khan
2020-05-05 20:13:16 -07:00
committed by GitHub
parent 9a7810cbee
commit 2ca6e7ae64

View File

@@ -38,14 +38,25 @@ 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 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"));