Remove ApiWrapper from sql-database-projects (#11345)

* Remove ApiWrapper

* fix compile error

* Use .resolves

* Check error messages

* Check for not called

* FIx global beforeEach/afterEach
This commit is contained in:
Charles Gagnon
2020-07-15 14:02:33 -07:00
committed by GitHub
parent c7799168b0
commit f4a4127471
11 changed files with 753 additions and 867 deletions

View File

@@ -10,7 +10,6 @@ import * as utils from '../common/utils';
import { Project } from '../models/project';
import { SqlConnectionDataSource } from '../models/dataSources/sqlConnectionStringSource';
import { ApiWrapper } from '../common/apiWrapper';
import { IPublishSettings, IGenerateScriptSettings } from '../models/IPublishSettings';
interface DataSourceDropdownValue extends azdata.CategoryValue {
@@ -42,7 +41,7 @@ export class PublishDatabaseDialog {
public generateScript: ((proj: Project, profile: IGenerateScriptSettings) => any) | undefined;
public readPublishProfile: ((profileUri: vscode.Uri) => any) | undefined;
constructor(private apiWrapper: ApiWrapper, private project: Project) {
constructor(private project: Project) {
this.dialog = azdata.window.createModelViewDialog(constants.publishDialogName);
this.publishTab = azdata.window.createTab(constants.publishDialogName);
}
@@ -172,10 +171,10 @@ export class PublishDatabaseDialog {
};
if (dataSource.integratedSecurity) {
connId = (await this.apiWrapper.connectionConnect(connProfile, false, false)).connectionId;
connId = (await azdata.connection.connect(connProfile, false, false)).connectionId;
}
else {
connId = (await this.apiWrapper.openConnectionDialog(undefined, connProfile)).connectionId;
connId = (await azdata.connection.openConnectionDialog(undefined, connProfile)).connectionId;
}
}
else {
@@ -186,7 +185,7 @@ export class PublishDatabaseDialog {
connId = this.connection?.connectionId;
}
return await this.apiWrapper.getUriForConnection(connId);
return await azdata.connection.getUriForConnection(connId);
}
catch (err) {
throw new Error(constants.unableToCreatePublishConnection + ': ' + utils.getErrorMessage(err));
@@ -202,7 +201,7 @@ export class PublishDatabaseDialog {
sqlCmdVariables: sqlCmdVars
};
this.apiWrapper.closeDialog(this.dialog);
azdata.window.closeDialog(this.dialog);
await this.publish!(this.project, settings);
this.dispose();
@@ -216,7 +215,7 @@ export class PublishDatabaseDialog {
sqlCmdVariables: sqlCmdVars
};
this.apiWrapper.closeDialog(this.dialog);
azdata.window.closeDialog(this.dialog);
if (this.generateScript) {
await this.generateScript!(this.project, settings);
@@ -360,7 +359,7 @@ export class PublishDatabaseDialog {
}).component();
editConnectionButton.onDidClick(async () => {
this.connection = await this.apiWrapper.openConnectionDialog();
this.connection = await azdata.connection.openConnectionDialog();
// show connection name if there is one, otherwise show connection string
if (this.connection.options['connectionName']) {
@@ -401,7 +400,7 @@ export class PublishDatabaseDialog {
}).component();
loadProfileButton.onDidClick(async () => {
const fileUris = await this.apiWrapper.showOpenDialog(
const fileUris = await vscode.window.showOpenDialog(
{
canSelectFiles: true,
canSelectFolders: false,