mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-30 17:23:29 -05:00
Load all data workspace projects directly from workspace (#15921)
* Load all projects directly from workspace * fixes * Remove relativity and fix tests * fix compile * PR comments * remove unused * distro
This commit is contained in:
@@ -34,6 +34,9 @@ export class NewProjectDialog extends DialogBase {
|
||||
}
|
||||
|
||||
async validate(): Promise<boolean> {
|
||||
if (await this.workspaceService.validateWorkspace() === false) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
// the selected location should be an existing directory
|
||||
const parentDirectoryExists = await directoryExist(this.model.location);
|
||||
@@ -49,11 +52,6 @@ export class NewProjectDialog extends DialogBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.workspaceInputBox!.enabled) {
|
||||
const sameFolderAsNewProject = path.join(this.model.location, this.model.name) === path.dirname(this.workspaceInputBox!.value!);
|
||||
await this.validateNewWorkspace(sameFolderAsNewProject);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (err) {
|
||||
@@ -64,15 +62,12 @@ export class NewProjectDialog extends DialogBase {
|
||||
|
||||
override async onComplete(): Promise<void> {
|
||||
try {
|
||||
const validateWorkspace = await this.workspaceService.validateWorkspace();
|
||||
|
||||
TelemetryReporter.createActionEvent(TelemetryViews.NewProjectDialog, TelemetryActions.NewProjectDialogCompleted)
|
||||
.withAdditionalProperties({ projectFileExtension: this.model.projectFileExtension, projectTemplateId: this.model.projectTypeId, workspaceValidationPassed: validateWorkspace.toString() })
|
||||
.withAdditionalProperties({ projectFileExtension: this.model.projectFileExtension, projectTemplateId: this.model.projectTypeId })
|
||||
.send();
|
||||
|
||||
if (validateWorkspace) {
|
||||
await this.workspaceService.createProject(this.model.name, vscode.Uri.file(this.model.location), this.model.projectTypeId, vscode.Uri.file(this.workspaceInputBox!.value!));
|
||||
}
|
||||
await this.workspaceService.createProject(this.model.name, vscode.Uri.file(this.model.location), this.model.projectTypeId);
|
||||
}
|
||||
catch (err) {
|
||||
|
||||
@@ -129,8 +124,6 @@ export class NewProjectDialog extends DialogBase {
|
||||
this.register(projectNameTextBox.onTextChanged(() => {
|
||||
this.model.name = projectNameTextBox.value!;
|
||||
projectNameTextBox.updateProperty('title', projectNameTextBox.value);
|
||||
|
||||
this.updateWorkspaceInputbox(path.join(this.model.location, this.model.name), this.model.name);
|
||||
}));
|
||||
|
||||
const locationTextBox = view.modelBuilder.inputBox().withProperties<azdataType.InputBoxProperties>({
|
||||
@@ -143,7 +136,6 @@ export class NewProjectDialog extends DialogBase {
|
||||
this.register(locationTextBox.onTextChanged(() => {
|
||||
this.model.location = locationTextBox.value!;
|
||||
locationTextBox.updateProperty('title', locationTextBox.value);
|
||||
this.updateWorkspaceInputbox(path.join(this.model.location, this.model.name), this.model.name);
|
||||
}));
|
||||
|
||||
const browseFolderButton = view.modelBuilder.button().withProperties<azdataType.ButtonProperties>({
|
||||
@@ -165,12 +157,8 @@ export class NewProjectDialog extends DialogBase {
|
||||
const selectedFolder = folderUris[0].fsPath;
|
||||
locationTextBox.value = selectedFolder;
|
||||
this.model.location = selectedFolder;
|
||||
|
||||
this.updateWorkspaceInputbox(path.join(this.model.location, this.model.name), this.model.name);
|
||||
}));
|
||||
|
||||
this.createWorkspaceContainer(view);
|
||||
|
||||
const form = view.modelBuilder.formContainer().withFormItems([
|
||||
{
|
||||
title: constants.TypeTitle,
|
||||
@@ -185,9 +173,7 @@ export class NewProjectDialog extends DialogBase {
|
||||
title: constants.ProjectLocationTitle,
|
||||
required: true,
|
||||
component: this.createHorizontalContainer(view, [locationTextBox, browseFolderButton])
|
||||
},
|
||||
this.workspaceDescriptionFormComponent!,
|
||||
this.workspaceInputFormComponent!
|
||||
}
|
||||
]).component();
|
||||
await view.initializeModel(form);
|
||||
this.initDialogComplete?.resolve();
|
||||
|
||||
Reference in New Issue
Block a user