optional database name option (#17538)

* optional database name option

* object explorer connection title

* revert unexpected change

* bug fixes
This commit is contained in:
Alan Ren
2021-10-29 16:37:35 -07:00
committed by GitHub
parent ce8f1156b1
commit b48f392ab2
5 changed files with 45 additions and 77 deletions

View File

@@ -160,9 +160,13 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
}
private getServerInfo() {
let databaseName = this.databaseName ? this.databaseName : '<default>';
let userName = this.userName ? this.userName : 'Windows Authentication';
return this.serverName + ', ' + databaseName + ' (' + userName + ')';
let title = this.serverName;
// Only show database name if the provider supports it.
if (this.serverCapabilities?.connectionOptions?.find(option => option.specialValueType === ConnectionOptionSpecialType.databaseName)) {
title += `, ${this.databaseName || '<default>'}`;
}
title += ` (${this.userName || this.authenticationType})`;
return title;
}
/**