mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-29 17:23:25 -05:00
Fix queryDocument.connect (#20682)
* Fix queryEditor.connect * Remove decorator * undo * fix test * Use connectionProfile for comparison * remove unused * Remove helper method
This commit is contained in:
@@ -40,20 +40,27 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
|
||||
|
||||
public constructor(
|
||||
capabilitiesService: ICapabilitiesService,
|
||||
model: string | azdata.IConnectionProfile | undefined) {
|
||||
model: string | azdata.IConnectionProfile | azdata.connection.ConnectionProfile | undefined) {
|
||||
super(capabilitiesService, model);
|
||||
if (model && !isString(model)) {
|
||||
this.groupId = model.groupId;
|
||||
this.groupFullName = model.groupFullName;
|
||||
this.savePassword = model.savePassword;
|
||||
this.saveProfile = model.saveProfile;
|
||||
this._id = model.id;
|
||||
|
||||
this.azureTenantId = model.azureTenantId;
|
||||
this.azureAccount = model.azureAccount;
|
||||
this.azureResourceId = model.azureResourceId;
|
||||
this.azurePortalEndpoint = model.azurePortalEndpoint;
|
||||
if (this.capabilitiesService && model.providerName) {
|
||||
let capabilities = this.capabilitiesService.getCapabilities(model.providerName);
|
||||
|
||||
// Special case setting properties to support both IConnectionProfile and azdata.connection.ConnectionProfile
|
||||
// It's not great that we have multiple definitions in azdata, but we can't break that right now so just
|
||||
// support both at least for the time being
|
||||
const isIConnectionProfile = 'id' in model;
|
||||
this._id = isIConnectionProfile ? model.id : model.connectionId;
|
||||
// TODO: @chgagnon - Should we add these properties to azdata.connection.ConnectionProfile?
|
||||
this.azureAccount = isIConnectionProfile ? model.azureAccount : '';
|
||||
this.azureResourceId = isIConnectionProfile ? model.azureResourceId : '';
|
||||
this.azurePortalEndpoint = isIConnectionProfile ? model.azurePortalEndpoint : '';
|
||||
if (this.capabilitiesService && this.providerName) {
|
||||
let capabilities = this.capabilitiesService.getCapabilities(this.providerName);
|
||||
if (capabilities && capabilities.connection && capabilities.connection.connectionOptions) {
|
||||
const options = capabilities.connection.connectionOptions;
|
||||
let appNameOption = options.find(option => option.specialValueType === interfaces.ConnectionOptionSpecialType.appName);
|
||||
|
||||
@@ -24,12 +24,12 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
|
||||
public constructor(
|
||||
protected capabilitiesService: ICapabilitiesService,
|
||||
model: string | azdata.IConnectionProfile | undefined
|
||||
model: string | azdata.IConnectionProfile | azdata.connection.ConnectionProfile | undefined
|
||||
) {
|
||||
super();
|
||||
// we can't really do a whole lot if we don't have a provider
|
||||
if (isString(model) || (model && model.providerName)) {
|
||||
this.providerName = isString(model) ? model : model.providerName;
|
||||
if (model) {
|
||||
this.providerName = isString(model) ? model : 'providerName' in model ? model.providerName : model.providerId;
|
||||
|
||||
if (!isString(model)) {
|
||||
if (model.options && this.serverCapabilities) {
|
||||
@@ -56,7 +56,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
*
|
||||
* This handles the case where someone hasn't passed in a valid property bag, but doesn't cause errors when
|
||||
*/
|
||||
private updateSpecialValueType(typeName: SettableProperty, model: azdata.IConnectionProfile): void {
|
||||
private updateSpecialValueType(typeName: SettableProperty, model: azdata.IConnectionProfile | azdata.connection.ConnectionProfile): void {
|
||||
if (!this[typeName]) {
|
||||
this[typeName] = model[typeName]!;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user