Clean up dialog event hide reasons (#14566)

* Clean up dialog event hide reasons

* Remove done
This commit is contained in:
Charles Gagnon
2021-03-05 08:54:35 -08:00
committed by GitHub
parent 21019f7452
commit d2faf9075d
21 changed files with 67 additions and 58 deletions

View File

@@ -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);
}

View File

@@ -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 {