Skip to content

Commit

Permalink
Pipe through argument
Browse files Browse the repository at this point in the history
  • Loading branch information
corivera committed Sep 11, 2023
1 parent 75b11bb commit 85a1203
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/sql/workbench/api/common/extHostWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class ExtHostWindow implements ExtHostWindowShape {
this._proxy = _mainContext.getProxy(SqlMainContext.MainThreadWindow);
}

$openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: azdata.window.FileFilters[]): Promise<string | undefined> {
return this._proxy.$openServerFileBrowserDialog(connectionUri, targetPath, fileFilters);
$openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: azdata.window.FileFilters[], showFoldersOnly?: boolean): Promise<string | undefined> {
return this._proxy.$openServerFileBrowserDialog(connectionUri, targetPath, fileFilters, showFoldersOnly);
}
}
4 changes: 2 additions & 2 deletions src/sql/workbench/api/common/sqlExtHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,8 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
openCustomErrorDialog(options: sqlExtHostTypes.IErrorDialogOptions): Thenable<string | undefined> {
return extHostModelViewDialog.openCustomErrorDialog(options);
},
openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: azdata.window.FileFilters[]): Thenable<string | undefined> {
return extHostWindow.$openServerFileBrowserDialog(connectionUri, targetPath, fileFilters);
openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: azdata.window.FileFilters[], showFoldersOnly?: boolean): Thenable<string | undefined> {
return extHostWindow.$openServerFileBrowserDialog(connectionUri, targetPath, fileFilters, showFoldersOnly);
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/sql/workbench/api/common/sqlExtHost.protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ export interface ExtHostWorkspaceShape {
}

export interface ExtHostWindowShape {
$openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: azdata.window.FileFilters[]): Promise<string | undefined>;
$openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: azdata.window.FileFilters[], showFoldersOnly?: boolean): Promise<string | undefined>;
}

export interface MainThreadWorkspaceShape {
Expand All @@ -843,7 +843,7 @@ export interface MainThreadWorkspaceShape {
}

export interface MainThreadWindowShape {
$openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: azdata.window.FileFilters[]): Promise<string | undefined>;
$openServerFileBrowserDialog(connectionUri: string, targetPath: string, fileFilters: azdata.window.FileFilters[], showFoldersOnly?: boolean): Promise<string | undefined>;
}

export interface MainThreadBackgroundTaskManagementShape extends IDisposable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class FileBrowserDialog extends Modal {
expandPath: string,
fileFilters: [{ label: string, filters: string[] }],
fileValidationServiceType: string,
showFoldersOnly?: boolean
showFoldersOnly: boolean
): void {
this._viewModel.initialize(ownerUri, expandPath, fileFilters, fileValidationServiceType, showFoldersOnly);
this._viewModel.openFileBrowser(0, false).catch(err => onUnexpectedError(err));
Expand All @@ -130,7 +130,7 @@ export class FileBrowserDialog extends Modal {

/* enter key */
protected override onAccept() {
if (this._okButton.enabled === true) {
if (this._okButton.enabled) {
this.ok();
}
}
Expand All @@ -141,7 +141,7 @@ export class FileBrowserDialog extends Modal {
}

private enableOkButton() {
if (strings.isFalsyOrWhitespace(this._selectedFilePath) || this._isFolderSelected === true) {
if (strings.isFalsyOrWhitespace(this._selectedFilePath) || (this._isFolderSelected && !this._viewModel.showFoldersOnly)) {
this._okButton.enabled = false;
} else {
this._okButton.enabled = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export class FileBrowserViewModel {
this._fileBrowserService.onPathValidate(args => onPathValidateCallback(args));
}

public get showFoldersOnly(): boolean {
return this._showFoldersOnly;
}

public initialize(ownerUri: string,
expandPath: string,
fileFilters: [{ label: string, filters: string[] }],
Expand Down

0 comments on commit 85a1203

Please sign in to comment.