mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 09:35:36 -05:00
Clean up dialog event hide reasons (#14566)
* Clean up dialog event hide reasons * Remove done
This commit is contained in:
@@ -22,7 +22,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
import { Button } from 'sql/base/browser/ui/button/button';
|
||||
import { Modal } from 'sql/workbench/browser/modal/modal';
|
||||
import { HideReason, Modal } from 'sql/workbench/browser/modal/modal';
|
||||
import { AccountViewModel } from 'sql/platform/accounts/common/accountViewModel';
|
||||
import { AddAccountAction } from 'sql/platform/accounts/common/accountActions';
|
||||
import { AccountListRenderer, AccountListDelegate } from 'sql/workbench/services/accountManagement/browser/accountListRenderer';
|
||||
@@ -272,12 +272,12 @@ export class AccountDialog extends Modal {
|
||||
|
||||
/* Overwrite enter key behavior */
|
||||
protected onAccept() {
|
||||
this.close();
|
||||
this.close('ok');
|
||||
}
|
||||
|
||||
public close() {
|
||||
public close(hideReason: HideReason = 'close') {
|
||||
this._onCloseEmitter.fire();
|
||||
this.hide();
|
||||
this.hide(hideReason);
|
||||
}
|
||||
|
||||
public open() {
|
||||
|
||||
@@ -142,7 +142,7 @@ export class AutoOAuthDialog extends Modal {
|
||||
this._copyAndOpenButton!.enabled = true;
|
||||
this._onCloseEvent.fire();
|
||||
this.spinner = false;
|
||||
this.hide();
|
||||
this.hide('close');
|
||||
}
|
||||
|
||||
public open(title: string, message: string, userCode: string, uri: string) {
|
||||
|
||||
@@ -201,7 +201,7 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
private handleOnCancel(params: INewConnectionParams): void {
|
||||
if (this.ignoreNextConnect) {
|
||||
this._connectionDialog.resetConnection();
|
||||
this._connectionDialog.close();
|
||||
this._connectionDialog.close('cancel');
|
||||
this.ignoreNextConnect = false;
|
||||
this._dialogDeferredPromise.resolve(undefined);
|
||||
return;
|
||||
@@ -229,7 +229,7 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
private async handleDefaultOnConnect(params: INewConnectionParams, connection: IConnectionProfile): Promise<void> {
|
||||
if (this.ignoreNextConnect) {
|
||||
this._connectionDialog.resetConnection();
|
||||
this._connectionDialog.close();
|
||||
this._connectionDialog.close('ok');
|
||||
this.ignoreNextConnect = false;
|
||||
this._connecting = false;
|
||||
this._dialogDeferredPromise.resolve(connection);
|
||||
@@ -253,7 +253,7 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
const connectionResult = await this._connectionManagementService.connectAndSaveProfile(connection, uri, options, params && params.input);
|
||||
this._connecting = false;
|
||||
if (connectionResult && connectionResult.connected) {
|
||||
this._connectionDialog.close();
|
||||
this._connectionDialog.close('ok');
|
||||
if (this._dialogDeferredPromise) {
|
||||
this._dialogDeferredPromise.resolve(connectionResult.connectionProfile);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import 'vs/css!./media/connectionDialog';
|
||||
import { Button } from 'sql/base/browser/ui/button/button';
|
||||
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
|
||||
import { Modal } from 'sql/workbench/browser/modal/modal';
|
||||
import { HideReason, Modal } from 'sql/workbench/browser/modal/modal';
|
||||
import { IConnectionManagementService, INewConnectionParams } from 'sql/platform/connection/common/connectionManagement';
|
||||
import * as DialogHelper from 'sql/workbench/browser/modal/dialogHelper';
|
||||
import { TreeCreationUtils } from 'sql/workbench/services/objectExplorer/browser/treeCreationUtils';
|
||||
@@ -360,13 +360,13 @@ export class ConnectionDialogWidget extends Modal {
|
||||
const wasConnecting = this._connecting;
|
||||
this._onCancel.fire();
|
||||
if (!this._databaseDropdownExpanded && !wasConnecting) {
|
||||
this.close();
|
||||
this.close('cancel');
|
||||
}
|
||||
}
|
||||
|
||||
public close() {
|
||||
public close(hideReason: HideReason = 'close') {
|
||||
this.resetConnection();
|
||||
this.hide();
|
||||
this.hide(hideReason);
|
||||
}
|
||||
|
||||
private createRecentConnectionList(): void {
|
||||
|
||||
@@ -44,7 +44,7 @@ export class CustomDialogService {
|
||||
}
|
||||
|
||||
public closeWizard(wizard: Wizard): void {
|
||||
this._wizardModals.get(wizard)?.cancel();
|
||||
this._wizardModals.get(wizard)?.close();
|
||||
}
|
||||
|
||||
public getWizardModal(wizard: Wizard): WizardModal | undefined {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./media/dialogModal';
|
||||
import { Modal, IModalOptions } from 'sql/workbench/browser/modal/modal';
|
||||
import { Modal, IModalOptions, HideReason } from 'sql/workbench/browser/modal/modal';
|
||||
import { Dialog, DialogButton } from 'sql/workbench/services/dialog/common/dialogTypes';
|
||||
import { DialogPane } from 'sql/workbench/services/dialog/browser/dialogPane';
|
||||
|
||||
@@ -138,7 +138,7 @@ export class DialogModal extends Modal {
|
||||
if (await this._dialog.validateClose()) {
|
||||
this._onDone.fire();
|
||||
this.dispose();
|
||||
this.hide('close');
|
||||
this.hide('ok');
|
||||
}
|
||||
clearTimeout(buttonSpinnerHandler);
|
||||
this._doneButton.element.classList.remove('validating');
|
||||
@@ -146,10 +146,14 @@ export class DialogModal extends Modal {
|
||||
}
|
||||
}
|
||||
|
||||
public cancel(): void {
|
||||
public close(): void {
|
||||
this.cancel('close');
|
||||
}
|
||||
|
||||
public cancel(hideReason: HideReason = 'cancel'): void {
|
||||
this._onCancel.fire();
|
||||
this.dispose();
|
||||
this.hide('cancel');
|
||||
this.hide(hideReason);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./media/dialogModal';
|
||||
import { Modal, IModalOptions } from 'sql/workbench/browser/modal/modal';
|
||||
import { Modal, IModalOptions, HideReason } from 'sql/workbench/browser/modal/modal';
|
||||
import { Wizard, DialogButton, WizardPage } from 'sql/workbench/services/dialog/common/dialogTypes';
|
||||
import { DialogPane } from 'sql/workbench/services/dialog/browser/dialogPane';
|
||||
import { bootstrapAngular } from 'sql/workbench/services/bootstrap/browser/bootstrapService';
|
||||
@@ -274,15 +274,18 @@ export class WizardModal extends Modal {
|
||||
}
|
||||
this._onDone.fire();
|
||||
this.dispose();
|
||||
this.hide('done');
|
||||
this.hide('ok');
|
||||
}
|
||||
}
|
||||
|
||||
public cancel(): void {
|
||||
public close(): void {
|
||||
this.cancel('close');
|
||||
}
|
||||
public cancel(hideReason: HideReason = 'cancel'): void {
|
||||
const currentPage = this._wizard.pages[this._wizard.currentPage];
|
||||
this._onCancel.fire();
|
||||
this.dispose();
|
||||
this.hide('cancel', currentPage.pageName ?? this._wizard.currentPage.toString());
|
||||
this.hide(hideReason, currentPage.pageName ?? this._wizard.currentPage.toString());
|
||||
}
|
||||
|
||||
private async validateNavigation(newPage: number): Promise<boolean> {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import 'vs/css!./media/errorMessageDialog';
|
||||
import { Button } from 'sql/base/browser/ui/button/button';
|
||||
import { Modal } from 'sql/workbench/browser/modal/modal';
|
||||
import { HideReason, Modal } from 'sql/workbench/browser/modal/modal';
|
||||
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
|
||||
|
||||
import Severity from 'vs/base/common/severity';
|
||||
@@ -137,11 +137,11 @@ export class ErrorMessageDialog extends Modal {
|
||||
|
||||
public ok(): void {
|
||||
this._onOk.fire();
|
||||
this.close();
|
||||
this.close('ok');
|
||||
}
|
||||
|
||||
public close() {
|
||||
this.hide();
|
||||
public close(hideReason: HideReason = 'close') {
|
||||
this.hide(hideReason);
|
||||
}
|
||||
|
||||
public open(severity: Severity, headerTitle: string, message: string, messageDetails?: string, actions?: IAction[]) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Button } from 'sql/base/browser/ui/button/button';
|
||||
import { InputBox, OnLoseFocusParams } from 'sql/base/browser/ui/inputBox/inputBox';
|
||||
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
|
||||
import * as DialogHelper from 'sql/workbench/browser/modal/dialogHelper';
|
||||
import { Modal } from 'sql/workbench/browser/modal/modal';
|
||||
import { HideReason, Modal } from 'sql/workbench/browser/modal/modal';
|
||||
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
|
||||
import { FileNode } from 'sql/workbench/services/fileBrowser/common/fileNode';
|
||||
import { FileBrowserTreeView } from 'sql/workbench/services/fileBrowser/browser/fileBrowserTreeView';
|
||||
@@ -185,7 +185,7 @@ export class FileBrowserDialog extends Modal {
|
||||
|
||||
private ok() {
|
||||
this._onOk.fire(this._selectedFilePath);
|
||||
this.close();
|
||||
this.close('ok');
|
||||
}
|
||||
|
||||
private handleOnValidate(succeeded: boolean, errorMessage: string) {
|
||||
@@ -197,12 +197,12 @@ export class FileBrowserDialog extends Modal {
|
||||
}
|
||||
}
|
||||
|
||||
private close(): void {
|
||||
private close(hideReason: HideReason = 'close'): void {
|
||||
if (this._fileBrowserTreeView) {
|
||||
this._fileBrowserTreeView.dispose();
|
||||
}
|
||||
this._onOk.dispose();
|
||||
this.hide();
|
||||
this.hide(hideReason);
|
||||
this._viewModel.closeFileBrowser().catch(err => onUnexpectedError(err));
|
||||
}
|
||||
|
||||
|
||||
@@ -414,7 +414,7 @@ export class InsightsDialogView extends Modal {
|
||||
|
||||
|
||||
public close() {
|
||||
this.hide();
|
||||
this.hide('close');
|
||||
dispose(this._taskButtonDisposables);
|
||||
this._taskButtonDisposables = [];
|
||||
}
|
||||
|
||||
@@ -265,11 +265,11 @@ export class FirewallRuleDialog extends Modal {
|
||||
|
||||
public cancel() {
|
||||
this._onCancel.fire();
|
||||
this.close();
|
||||
this.hide('cancel');
|
||||
}
|
||||
|
||||
public close() {
|
||||
this.hide();
|
||||
this.hide('close');
|
||||
}
|
||||
|
||||
public createFirewallRule() {
|
||||
|
||||
@@ -29,7 +29,7 @@ import { CheckboxSelectColumn } from 'sql/base/browser/ui/table/plugins/checkbox
|
||||
import { Table } from 'sql/base/browser/ui/table/table';
|
||||
import { TableDataView } from 'sql/base/browser/ui/table/tableDataView';
|
||||
import * as DialogHelper from 'sql/workbench/browser/modal/dialogHelper';
|
||||
import { Modal } from 'sql/workbench/browser/modal/modal';
|
||||
import { HideReason, Modal } from 'sql/workbench/browser/modal/modal';
|
||||
import { attachTableStyler, attachInputBoxStyler, attachSelectBoxStyler, attachEditableDropdownStyler, attachCheckboxStyler } from 'sql/platform/theme/common/styler';
|
||||
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
|
||||
import { RestoreViewModel, RestoreOptionParam, SouceDatabaseNamesParam } from 'sql/workbench/services/restore/browser/restoreViewModel';
|
||||
@@ -688,12 +688,12 @@ export class RestoreDialog extends Modal {
|
||||
|
||||
public cancel() {
|
||||
this._onCancel.fire();
|
||||
this.close();
|
||||
this.close('cancel');
|
||||
}
|
||||
|
||||
public close() {
|
||||
public close(hideReason: HideReason = 'close') {
|
||||
this.resetDialog();
|
||||
this.hide();
|
||||
this.hide(hideReason);
|
||||
this._onCloseEvent.fire();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import { localize } from 'vs/nls';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
import { Button } from 'sql/base/browser/ui/button/button';
|
||||
import { Modal } from 'sql/workbench/browser/modal/modal';
|
||||
import { HideReason, Modal } from 'sql/workbench/browser/modal/modal';
|
||||
import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox';
|
||||
import { ServerGroupViewModel } from 'sql/workbench/services/serverGroup/common/serverGroupViewModel';
|
||||
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
|
||||
@@ -360,11 +360,11 @@ export class ServerGroupDialog extends Modal {
|
||||
|
||||
public cancel() {
|
||||
this._onCancel.fire();
|
||||
this.close();
|
||||
this.close('cancel');
|
||||
}
|
||||
|
||||
public close() {
|
||||
this.hide();
|
||||
public close(hideReason: HideReason = 'close') {
|
||||
this.hide(hideReason);
|
||||
this.withRenderedDialog.groupNameInputBox.hideMessage();
|
||||
this._onCloseEvent.fire();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user