Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Cancel button label to Back for inner dialogs. #24537

Merged
merged 3 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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