Connection Dialog: Database dropdown followup issues fix (#662)

* databases now sorted order in dropdown

* fixed bug ESC bug for conn dialog

* pressing ESC now only closes dropdown instead of conn dialog

* changed dropdown arrow to look similar to other arrows

* align dropdown tree and spacing for all dropdowns

* fixed bug where pressing esc would close conn dialog after option is chosen
This commit is contained in:
Aditya Bist
2018-02-13 12:38:51 -08:00
committed by GitHub
parent 4b51d9b386
commit 040549d264
10 changed files with 84 additions and 18 deletions

View File

@@ -54,6 +54,8 @@ export interface IConnectionComponentController {
handleOnConnecting(): void;
handleResetConnection(): void;
focusOnOpen(): void;
closeDatabaseDropdown(): void;
databaseDropdownExpanded: boolean;
}
export class ConnectionDialogService implements IConnectionDialogService {
@@ -149,16 +151,21 @@ export class ConnectionDialogService implements IConnectionDialogService {
}
private handleOnCancel(params: INewConnectionParams): void {
if (params && params.input && params.connectionType === ConnectionType.editor) {
this._connectionManagementService.cancelEditorConnection(params.input);
if (this.uiController.databaseDropdownExpanded) {
this.uiController.closeDatabaseDropdown();
} else {
this._connectionManagementService.cancelConnection(this._model);
if (params && params.input && params.connectionType === ConnectionType.editor) {
this._connectionManagementService.cancelEditorConnection(params.input);
} else {
this._connectionManagementService.cancelConnection(this._model);
}
if (params && params.input && params.input.onConnectReject) {
params.input.onConnectReject();
}
this._connectionDialog.resetConnection();
this._connecting = false;
}
if (params && params.input && params.input.onConnectReject) {
params.input.onConnectReject();
}
this._connectionDialog.resetConnection();
this._connecting = false;
this.uiController.databaseDropdownExpanded = false;
}
private handleDefaultOnConnect(params: INewConnectionParams, connection: IConnectionProfile): Thenable<void> {
@@ -326,7 +333,10 @@ export class ConnectionDialogService implements IConnectionDialogService {
let container = withElementById(this._partService.getWorkbenchElementId()).getHTMLElement().parentElement;
this._container = container;
this._connectionDialog = this._instantiationService.createInstance(ConnectionDialogWidget, this._providerTypes, this._providerNameToDisplayNameMap[this._model.providerName]);
this._connectionDialog.onCancel(() => this.handleOnCancel(this._connectionDialog.newConnectionParams));
this._connectionDialog.onCancel(() => {
this._connectionDialog.databaseDropdownExpanded = this.uiController.databaseDropdownExpanded;
this.handleOnCancel(this._connectionDialog.newConnectionParams);
});
this._connectionDialog.onConnect((profile) => this.handleOnConnect(this._connectionDialog.newConnectionParams, profile));
this._connectionDialog.onShowUiComponent((input) => this.handleShowUiComponent(input));
this._connectionDialog.onInitDialog(() => this.handleInitDialog());