mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-28 17:23:19 -05:00
Strict null on some query and connection (#7300)
* wip * make connection work with strict-nulls * change comments * fix tests; remove unneeded type forcing * address feedback * adjust the logic of query editor * clean up typing
This commit is contained in:
@@ -25,7 +25,7 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
|
||||
public parent?: ConnectionProfileGroup;
|
||||
private _id: string;
|
||||
public savePassword: boolean;
|
||||
private _groupName: string;
|
||||
private _groupName?: string;
|
||||
public groupId: string;
|
||||
public saveProfile: boolean;
|
||||
|
||||
@@ -119,11 +119,11 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
|
||||
this.options['registeredServerDescription'] = value;
|
||||
}
|
||||
|
||||
public get groupFullName(): string {
|
||||
public get groupFullName(): string | undefined {
|
||||
return this._groupName;
|
||||
}
|
||||
|
||||
public set groupFullName(value: string) {
|
||||
public set groupFullName(value: string | undefined) {
|
||||
this._groupName = value;
|
||||
}
|
||||
|
||||
@@ -214,15 +214,12 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
|
||||
return !profile.databaseName || profile.databaseName.trim() === '';
|
||||
}
|
||||
|
||||
public static fromIConnectionProfile(capabilitiesService: ICapabilitiesService, profile: azdata.IConnectionProfile) {
|
||||
if (profile) {
|
||||
if (profile instanceof ConnectionProfile) {
|
||||
return profile;
|
||||
} else {
|
||||
return new ConnectionProfile(capabilitiesService, profile);
|
||||
}
|
||||
public static fromIConnectionProfile(capabilitiesService: ICapabilitiesService, profile: azdata.IConnectionProfile): ConnectionProfile {
|
||||
if (profile instanceof ConnectionProfile) {
|
||||
return profile;
|
||||
} else {
|
||||
return new ConnectionProfile(capabilitiesService, profile);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public static createFromStoredProfile(profile: interfaces.IConnectionProfileStore, capabilitiesService: ICapabilitiesService): ConnectionProfile {
|
||||
@@ -244,24 +241,18 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
|
||||
|
||||
public static convertToProfileStore(
|
||||
capabilitiesService: ICapabilitiesService,
|
||||
connectionProfile: interfaces.IConnectionProfile): interfaces.IConnectionProfileStore | undefined {
|
||||
if (connectionProfile) {
|
||||
let connectionInfo = ConnectionProfile.fromIConnectionProfile(capabilitiesService, connectionProfile);
|
||||
if (connectionInfo) {
|
||||
let profile: interfaces.IConnectionProfileStore = {
|
||||
options: {},
|
||||
groupId: connectionProfile.groupId,
|
||||
providerName: connectionInfo.providerName,
|
||||
savePassword: connectionInfo.savePassword,
|
||||
id: connectionInfo.id
|
||||
};
|
||||
connectionProfile: interfaces.IConnectionProfile): interfaces.IConnectionProfileStore {
|
||||
let connectionInfo = ConnectionProfile.fromIConnectionProfile(capabilitiesService, connectionProfile);
|
||||
let profile: interfaces.IConnectionProfileStore = {
|
||||
options: {},
|
||||
groupId: connectionProfile.groupId,
|
||||
providerName: connectionInfo.providerName,
|
||||
savePassword: connectionInfo.savePassword,
|
||||
id: connectionInfo.id
|
||||
};
|
||||
|
||||
profile.options = connectionInfo.options;
|
||||
profile.options = connectionInfo.options;
|
||||
|
||||
return profile;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
return profile;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user