Skip to content

Commit

Permalink
Change Cancel button label to Back for inner dialogs. (#24537)
Browse files Browse the repository at this point in the history
  • Loading branch information
corivera authored and siyangMicrosoft committed Oct 12, 2023
1 parent c39e377 commit 31e88b1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const allFiles = localize('objectManagement.allFiles', "All Files");
export const labelSelectFolder = localize('objectManagement.labelSelectFolder', "Select Folder");
export const DataFileLabel = localize('objectManagement.dataFileLabel', "Data");
export const LogFileLabel = localize('objectManagement.logFileLabel', "Log");
export const BackButtonLabel = localize('objectManagement.backButtonLabel', "Back");

export function ExplicitPermissionsTableLabelSelected(name: string): string { return localize('objectManagement.explicitPermissionsTableLabelSelected', "Explicit permissions for: {0}", name); }
export function EffectivePermissionsTableLabelSelected(name: string): string { return localize('objectManagement.effectivePermissionsTableLabelSelected', "Effective permissions for: {0}", name); }
Expand Down
6 changes: 5 additions & 1 deletion extensions/mssql/src/objectManagement/ui/findObjectDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,18 @@ export class FindObjectDialog extends DialogBase<FindObjectDialogResult> {
constructor(private readonly objectManagementService: mssql.IObjectManagementService, private readonly options: FindObjectDialogOptions) {
super(options.title, 'FindObjectDialog');
this.dialogObject.okButton.label = localizedConstants.SelectText;
this.dialogObject.okButton.enabled = false;

// Relabel Cancel button to Back, since clicking cancel on an inner dialog makes it seem like it would close the whole dialog overall
this.dialogObject.cancelButton.label = localizedConstants.BackButtonLabel;

this.result = {
selectedObjects: []
};
this.selectedObjectTypes = options.selectAllObjectTypes ? [...options.objectTypes] : [];
}

protected override async initialize(): Promise<void> {
this.dialogObject.okButton.enabled = false;
this.objectTypesTable = this.createTableList<ObjectTypeInfo>(localizedConstants.ObjectTypesText,
[localizedConstants.ObjectTypeText],
this.options.objectTypes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export class ObjectSelectionMethodDialog extends DialogBase<ObjectSelectionMetho
schema: undefined,
objectTypes: []
};

// Relabel Cancel button to Back, since clicking cancel on an inner dialog makes it seem like it would close the whole dialog overall
this.dialogObject.cancelButton.label = localizedConstants.BackButtonLabel;
}

protected override async initialize(): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class FileBrowserDialog extends Modal {
@ILogService logService: ILogService,
@ITextResourcePropertiesService textResourcePropertiesService: ITextResourcePropertiesService
) {
super(title, TelemetryKeys.ModalDialogName.FileBrowser, telemetryService, layoutService, clipboardService, themeService, logService, textResourcePropertiesService, contextKeyService, { dialogStyle: 'flyout', hasTitleIcon: false, hasBackButton: true, hasSpinner: true });
super(title, TelemetryKeys.ModalDialogName.FileBrowser, telemetryService, layoutService, clipboardService, themeService, logService, textResourcePropertiesService, contextKeyService, { dialogStyle: 'flyout', hasTitleIcon: false, hasBackButton: false, hasSpinner: true });
this._viewModel = this._instantiationService.createInstance(FileBrowserViewModel);
this._viewModel.onAddFileTree(args => this.handleOnAddFileTree(args.rootNode, args.selectedNode, args.expandedNodes).catch(err => onUnexpectedError(err)));
this._viewModel.onPathValidate(args => this.handleOnValidate(args.succeeded, args.message));
Expand All @@ -77,13 +77,6 @@ export class FileBrowserDialog extends Modal {
super.render();
attachModalDialogStyler(this, this._themeService);

if (this.backButton) {

this.backButton.onDidClick(() => {
this.close();
});
}

this._treeContainer = DOM.append(this._body, DOM.$('.tree-view'));

let tableContainer: HTMLElement = DOM.append(DOM.append(this._body, DOM.$('.option-section')), DOM.$('table.file-table-content'));
Expand All @@ -106,7 +99,8 @@ export class FileBrowserDialog extends Modal {

this._okButton = this.addFooterButton(localize('fileBrowser.ok', "OK"), () => this.ok());
this._okButton.enabled = false;
this.addFooterButton(localize('fileBrowser.discard', "Discard"), () => this.close(), 'right', true);
// Add a back button to the footer rather than use the built-in back button in the upper left of the dialog
this.addFooterButton(localize('fileBrowser.back', "Back"), () => this.close(), 'right', true);

this.registerListeners();
this.updateTheme();
Expand Down

0 comments on commit 31e88b1

Please sign in to comment.