mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
fix restart ADS warning showing twice for create project from db (#17214)
This commit is contained in:
@@ -1128,31 +1128,27 @@ export class ProjectsController {
|
|||||||
|
|
||||||
public async createProjectFromDatabaseCallback(model: ImportDataModel) {
|
public async createProjectFromDatabaseCallback(model: ImportDataModel) {
|
||||||
try {
|
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 workspaceApi = utils.getDataWorkspaceExtensionApi();
|
||||||
|
workspaceApi.showProjectsView();
|
||||||
const validateWorkspace = await workspaceApi.validateWorkspace();
|
await workspaceApi.addProjectsToWorkspace([vscode.Uri.file(newProjFilePath)]);
|
||||||
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)]);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -372,9 +372,6 @@ export class CreateProjectFromDatabaseDialog {
|
|||||||
|
|
||||||
async validate(): Promise<boolean> {
|
async validate(): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
if (await getDataWorkspaceExtensionApi().validateWorkspace() === false) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// the selected location should be an existing directory
|
// the selected location should be an existing directory
|
||||||
const parentDirectoryExists = await exists(this.projectLocationTextBox!.value!);
|
const parentDirectoryExists = await exists(this.projectLocationTextBox!.value!);
|
||||||
if (!parentDirectoryExists) {
|
if (!parentDirectoryExists) {
|
||||||
@@ -388,6 +385,11 @@ export class CreateProjectFromDatabaseDialog {
|
|||||||
this.showErrorMessage(constants.ProjectDirectoryAlreadyExistError(this.projectNameTextBox!.value!, this.projectLocationTextBox!.value!));
|
this.showErrorMessage(constants.ProjectDirectoryAlreadyExistError(this.projectNameTextBox!.value!, this.projectLocationTextBox!.value!));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (await getDataWorkspaceExtensionApi().validateWorkspace() === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.showErrorMessage(err?.message ? err.message : err);
|
this.showErrorMessage(err?.message ? err.message : err);
|
||||||
|
|||||||
Reference in New Issue
Block a user