fix restart ADS warning showing twice for create project from db (#17214)

This commit is contained in:
Kim Santiago
2021-10-01 14:53:36 -07:00
committed by GitHub
parent 107b0ae683
commit d5b43df6d6
2 changed files with 25 additions and 27 deletions

View File

@@ -1128,31 +1128,27 @@ export class ProjectsController {
public async createProjectFromDatabaseCallback(model: ImportDataModel) {
try {
const newProjFolderUri = model.filePath;
const newProjFilePath = await this.createNewProject({
newProjName: model.projName,
folderUri: vscode.Uri.file(newProjFolderUri),
projectTypeId: constants.emptySqlDatabaseProjectTypeId
});
model.filePath = path.dirname(newProjFilePath);
this.setFilePath(model);
const project = await Project.openProject(newProjFilePath);
await this.createProjectFromDatabaseApiCall(model); // Call ExtractAPI in DacFx Service
let fileFolderList: vscode.Uri[] = model.extractTarget === mssql.ExtractTarget.file ? [vscode.Uri.file(model.filePath)] : await this.generateList(model.filePath); // Create a list of all the files and directories to be added to project
await project.addToProject(fileFolderList); // Add generated file structure to the project
// add project to workspace
const workspaceApi = utils.getDataWorkspaceExtensionApi();
const validateWorkspace = await workspaceApi.validateWorkspace();
if (validateWorkspace) {
const newProjFolderUri = model.filePath;
const newProjFilePath = await this.createNewProject({
newProjName: model.projName,
folderUri: vscode.Uri.file(newProjFolderUri),
projectTypeId: constants.emptySqlDatabaseProjectTypeId
});
model.filePath = path.dirname(newProjFilePath);
this.setFilePath(model);
const project = await Project.openProject(newProjFilePath);
await this.createProjectFromDatabaseApiCall(model); // Call ExtractAPI in DacFx Service
let fileFolderList: vscode.Uri[] = model.extractTarget === mssql.ExtractTarget.file ? [vscode.Uri.file(model.filePath)] : await this.generateList(model.filePath); // Create a list of all the files and directories to be added to project
await project.addToProject(fileFolderList); // Add generated file structure to the project
// add project to workspace
workspaceApi.showProjectsView();
await workspaceApi.addProjectsToWorkspace([vscode.Uri.file(newProjFilePath)]);
}
workspaceApi.showProjectsView();
await workspaceApi.addProjectsToWorkspace([vscode.Uri.file(newProjFilePath)]);
} catch (err) {
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
}