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

This commit is contained in:
Cory Rivera
2023-09-28 18:02:25 -07:00
committed by GitHub
parent 731dc6318f
commit 94cdaf9d57
4 changed files with 12 additions and 10 deletions

View File

@@ -56,6 +56,7 @@ export const allFiles = localize('objectManagement.allFiles', "All Files");
export const labelSelectFolder = localize('objectManagement.labelSelectFolder', "Select Folder"); export const labelSelectFolder = localize('objectManagement.labelSelectFolder', "Select Folder");
export const DataFileLabel = localize('objectManagement.dataFileLabel', "Data"); export const DataFileLabel = localize('objectManagement.dataFileLabel', "Data");
export const LogFileLabel = localize('objectManagement.logFileLabel', "Log"); 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 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); } export function EffectivePermissionsTableLabelSelected(name: string): string { return localize('objectManagement.effectivePermissionsTableLabelSelected', "Effective permissions for: {0}", name); }

View File

@@ -47,6 +47,11 @@ export class FindObjectDialog extends DialogBase<FindObjectDialogResult> {
constructor(private readonly objectManagementService: mssql.IObjectManagementService, private readonly options: FindObjectDialogOptions) { constructor(private readonly objectManagementService: mssql.IObjectManagementService, private readonly options: FindObjectDialogOptions) {
super(options.title, 'FindObjectDialog'); super(options.title, 'FindObjectDialog');
this.dialogObject.okButton.label = localizedConstants.SelectText; 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 = { this.result = {
selectedObjects: [] selectedObjects: []
}; };
@@ -54,7 +59,6 @@ export class FindObjectDialog extends DialogBase<FindObjectDialogResult> {
} }
protected override async initialize(): Promise<void> { protected override async initialize(): Promise<void> {
this.dialogObject.okButton.enabled = false;
this.objectTypesTable = this.createTableList<ObjectTypeInfo>(localizedConstants.ObjectTypesText, this.objectTypesTable = this.createTableList<ObjectTypeInfo>(localizedConstants.ObjectTypesText,
[localizedConstants.ObjectTypeText], [localizedConstants.ObjectTypeText],
this.options.objectTypes, this.options.objectTypes,

View File

@@ -40,6 +40,9 @@ export class ObjectSelectionMethodDialog extends DialogBase<ObjectSelectionMetho
schema: undefined, schema: undefined,
objectTypes: [] 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> { protected override async initialize(): Promise<void> {

View File

@@ -60,7 +60,7 @@ export class FileBrowserDialog extends Modal {
@ILogService logService: ILogService, @ILogService logService: ILogService,
@ITextResourcePropertiesService textResourcePropertiesService: ITextResourcePropertiesService @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 = this._instantiationService.createInstance(FileBrowserViewModel);
this._viewModel.onAddFileTree(args => this.handleOnAddFileTree(args.rootNode, args.selectedNode, args.expandedNodes).catch(err => onUnexpectedError(err))); 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)); this._viewModel.onPathValidate(args => this.handleOnValidate(args.succeeded, args.message));
@@ -77,13 +77,6 @@ export class FileBrowserDialog extends Modal {
super.render(); super.render();
attachModalDialogStyler(this, this._themeService); attachModalDialogStyler(this, this._themeService);
if (this.backButton) {
this.backButton.onDidClick(() => {
this.close();
});
}
this._treeContainer = DOM.append(this._body, DOM.$('.tree-view')); 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')); let tableContainer: HTMLElement = DOM.append(DOM.append(this._body, DOM.$('.option-section')), DOM.$('table.file-table-content'));
@@ -106,7 +99,8 @@ export class FileBrowserDialog extends Modal {
this._okButton = this.addFooterButton(localize('fileBrowser.ok', "OK"), () => this.ok()); this._okButton = this.addFooterButton(localize('fileBrowser.ok', "OK"), () => this.ok());
this._okButton.enabled = false; 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.registerListeners();
this.updateTheme(); this.updateTheme();