fix editing workspace inputbox not working (#13858)

This commit is contained in:
Kim Santiago
2020-12-21 11:29:22 -08:00
committed by GitHub
parent 57446faa1e
commit bc1fc8527c
2 changed files with 18 additions and 23 deletions

View File

@@ -13,8 +13,6 @@ import { fileExist } from '../common/utils';
import { IconPathHelper } from '../common/iconHelper';
export class OpenExistingDialog extends DialogBase {
public _projectFile: string = '';
public _workspaceFile: string = '';
public _targetTypeRadioCardGroup: azdata.RadioCardGroupComponent | undefined;
public _filePathTextBox: azdata.InputBoxComponent | undefined;
public formBuilder: azdata.FormBuilder | undefined;
@@ -37,13 +35,13 @@ export class OpenExistingDialog extends DialogBase {
try {
// the selected location should be an existing directory
if (this._targetTypeRadioCardGroup?.selectedCardId === constants.Project) {
await this.validateFile(this._projectFile, constants.Project.toLowerCase());
await this.validateFile(this._filePathTextBox!.value!, constants.Project.toLowerCase());
if (this.workspaceInputBox!.enabled) {
await this.validateNewWorkspace(false);
}
} else if (this._targetTypeRadioCardGroup?.selectedCardId === constants.Workspace) {
await this.validateFile(this._workspaceFile, constants.Workspace.toLowerCase());
await this.validateFile(this._filePathTextBox!.value!, constants.Workspace.toLowerCase());
}
return true;
@@ -64,11 +62,11 @@ export class OpenExistingDialog extends DialogBase {
async onComplete(): Promise<void> {
try {
if (this._targetTypeRadioCardGroup?.selectedCardId === constants.Workspace) {
await this.workspaceService.enterWorkspace(vscode.Uri.file(this._workspaceFile));
await this.workspaceService.enterWorkspace(vscode.Uri.file(this._filePathTextBox!.value!));
} else {
const validateWorkspace = await this.workspaceService.validateWorkspace();
if (validateWorkspace) {
await this.workspaceService.addProjectsToWorkspace([vscode.Uri.file(this._projectFile)], vscode.Uri.file(this.workspaceInputBox!.value!));
await this.workspaceService.addProjectsToWorkspace([vscode.Uri.file(this._filePathTextBox!.value!)], vscode.Uri.file(this.workspaceInputBox!.value!));
}
}
}
@@ -111,9 +109,8 @@ export class OpenExistingDialog extends DialogBase {
width: constants.DefaultInputWidth
}).component();
this.register(this._filePathTextBox.onTextChanged(() => {
this._projectFile = this._filePathTextBox!.value!;
this._filePathTextBox!.updateProperty('title', this._projectFile);
this.updateWorkspaceInputbox(path.dirname(this._projectFile), path.basename(this._projectFile, path.extname(this._projectFile)));
this._filePathTextBox!.updateProperty('title', this._filePathTextBox!.value!);
this.updateWorkspaceInputbox(path.dirname(this._filePathTextBox!.value!), path.basename(this._filePathTextBox!.value!, path.extname(this._filePathTextBox!.value!)));
}));
const browseFolderButton = view.modelBuilder.button().withProperties<azdata.ButtonProperties>({
@@ -180,7 +177,6 @@ export class OpenExistingDialog extends DialogBase {
const workspaceFilePath = fileUris[0].fsPath;
this._filePathTextBox!.value = workspaceFilePath;
this._workspaceFile = workspaceFilePath;
}
public async projectBrowse(): Promise<void> {
@@ -205,6 +201,5 @@ export class OpenExistingDialog extends DialogBase {
const projectFilePath = fileUris[0].fsPath;
this._filePathTextBox!.value = projectFilePath;
this._projectFile = projectFilePath;
}
}