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

@@ -52,6 +52,7 @@ export class ConnectionWidget {
[Constants.mssqlProviderName]: [new AuthenticationType(Constants.integrated, false), new AuthenticationType(Constants.sqlLogin, true)]
};
private _saveProfile: boolean;
private _databaseDropdownExpanded: boolean = false;
private _defaultDatabaseName: string = localize('defaultDatabaseOption', '<Default>');
private _loadingDatabaseName: string = localize('loadingDatabaseOption', 'Loading...');
public DefaultServerGroup: IConnectionProfileGroup = {
@@ -244,11 +245,12 @@ export class ConnectionWidget {
}));
this._toDispose.push(this._databaseNameInputBox.onFocus(() => {
this._databaseDropdownExpanded = true;
if (this.serverName) {
this._databaseNameInputBox.values = [this._loadingDatabaseName];
this._callbacks.onFetchDatabases(this.serverName, this.authenticationType, this.userName, this._password).then(databases => {
if (databases) {
this._databaseNameInputBox.values = databases;
this._databaseNameInputBox.values = databases.sort((a, b) => a.localeCompare(b));
} else {
this._databaseNameInputBox.values = [this._defaultDatabaseName];
}
@@ -267,6 +269,7 @@ export class ConnectionWidget {
this._databaseNameInputBox.value = s;
}
}));
}
private onGroupSelected(selectedGroup: string) {
@@ -540,6 +543,18 @@ export class ConnectionWidget {
const authType = this._authTypeMap[this._providerName];
return authType ? authType.find(authType => this.getAuthTypeDisplayName(authType.name) === displayName) : undefined;
}
public closeDatabaseDropdown(): void {
this._databaseNameInputBox.blur();
}
public get databaseDropdownExpanded(): boolean {
return this._databaseDropdownExpanded;
}
public set databaseDropdownExpanded(val: boolean) {
this._databaseDropdownExpanded = val;
}
}
class AuthenticationType {