Fix #6022 connection dialog broken (#6023)

Opening connection dialog was broken if you have a postgres connection
listed in the Connections view and the extension isn't installed.
The capabilities service breaks as it returns an undefined object.
Added handling, so now it does show as "loading..." forever
but doesn't crash
This commit is contained in:
Kevin Cunnane
2019-06-13 16:50:00 -07:00
committed by GitHub
parent a566fa9728
commit 6ff34d9894

View File

@@ -44,11 +44,14 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
this._id = model.id;
this.azureTenantId = model.azureTenantId;
if (this.capabilitiesService && model.providerName) {
const options = this.capabilitiesService.getCapabilities(model.providerName).connection.connectionOptions;
let appNameOption = options.find(option => option.specialValueType === ConnectionOptionSpecialType.appName);
if (appNameOption) {
let appNameKey = appNameOption.name;
this.options[appNameKey] = Constants.applicationName;
let capabilities = this.capabilitiesService.getCapabilities(model.providerName);
if (capabilities && capabilities.connection && capabilities.connection.connectionOptions) {
const options = capabilities.connection.connectionOptions;
let appNameOption = options.find(option => option.specialValueType === ConnectionOptionSpecialType.appName);
if (appNameOption) {
let appNameKey = appNameOption.name;
this.options[appNameKey] = Constants.applicationName;
}
}
}
} else {