mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-22 01:25:38 -05:00
Add more areas to strict null (#7243)
* add more areas to strict null * fix compile errors * fix tests * fix checks * address PR comments
This commit is contained in:
@@ -110,7 +110,7 @@ export interface IConnectionManagementService {
|
||||
|
||||
onIntelliSenseCacheComplete(handle: number, connectionUri: string): void;
|
||||
|
||||
onConnectionChangedNotification(handle: number, changedConnInfo: azdata.ChangedConnectionInfo);
|
||||
onConnectionChangedNotification(handle: number, changedConnInfo: azdata.ChangedConnectionInfo): void;
|
||||
|
||||
getConnectionGroups(providers?: string[]): ConnectionProfileGroup[];
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import * as Constants from 'sql/platform/connection/common/constants';
|
||||
*/
|
||||
export class ConnectionProfile extends ProviderConnectionInfo implements interfaces.IConnectionProfile {
|
||||
|
||||
public parent: ConnectionProfileGroup = null;
|
||||
public parent?: ConnectionProfileGroup;
|
||||
private _id: string;
|
||||
public savePassword: boolean;
|
||||
private _groupName: string;
|
||||
@@ -88,7 +88,7 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
|
||||
this._id = generateUuid();
|
||||
}
|
||||
|
||||
public getParent(): ConnectionProfileGroup {
|
||||
public getParent(): ConnectionProfileGroup | undefined {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
@@ -103,11 +103,11 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
|
||||
this._id = value;
|
||||
}
|
||||
|
||||
public get azureTenantId(): string {
|
||||
public get azureTenantId(): string | undefined {
|
||||
return this.options['azureTenantId'];
|
||||
}
|
||||
|
||||
public set azureTenantId(value: string) {
|
||||
public set azureTenantId(value: string | undefined) {
|
||||
this.options['azureTenantId'] = value;
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
|
||||
databaseName: this.databaseName,
|
||||
authenticationType: this.authenticationType,
|
||||
getOptionsKey: this.getOptionsKey,
|
||||
matches: undefined,
|
||||
matches: this.matches,
|
||||
groupId: this.groupId,
|
||||
groupFullName: this.groupFullName,
|
||||
password: this.password,
|
||||
@@ -244,22 +244,24 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
|
||||
|
||||
public static convertToProfileStore(
|
||||
capabilitiesService: ICapabilitiesService,
|
||||
connectionProfile: interfaces.IConnectionProfile): interfaces.IConnectionProfileStore {
|
||||
connectionProfile: interfaces.IConnectionProfile): interfaces.IConnectionProfileStore | undefined {
|
||||
if (connectionProfile) {
|
||||
let connectionInfo = ConnectionProfile.fromIConnectionProfile(capabilitiesService, connectionProfile);
|
||||
let profile: interfaces.IConnectionProfileStore = {
|
||||
options: {},
|
||||
groupId: connectionProfile.groupId,
|
||||
providerName: connectionInfo.providerName,
|
||||
savePassword: connectionInfo.savePassword,
|
||||
id: connectionInfo.id
|
||||
};
|
||||
if (connectionInfo) {
|
||||
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;
|
||||
} else {
|
||||
return undefined;
|
||||
return profile;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Disposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
export interface IConnectionProfileGroup {
|
||||
id: string;
|
||||
parentId: string;
|
||||
parentId?: string;
|
||||
name: string;
|
||||
color: string;
|
||||
description: string;
|
||||
@@ -18,7 +18,7 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
||||
|
||||
public children: ConnectionProfileGroup[];
|
||||
public connections: ConnectionProfile[];
|
||||
public parentId: string;
|
||||
public parentId?: string;
|
||||
private _isRenamed: boolean;
|
||||
public constructor(
|
||||
public name: string,
|
||||
@@ -53,8 +53,8 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public get fullName(): string {
|
||||
let fullName: string = (this.id === 'root') ? undefined : this.name;
|
||||
public get fullName(): string | undefined {
|
||||
let fullName: string | undefined = (this.id === 'root') ? undefined : this.name;
|
||||
if (this.parent) {
|
||||
let parentFullName = this.parent.fullName;
|
||||
if (parentFullName) {
|
||||
@@ -156,7 +156,7 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
||||
|
||||
public isAncestorOf(node: ConnectionProfileGroup | ConnectionProfile): boolean {
|
||||
let isAncestor = false;
|
||||
let currentNode = node;
|
||||
let currentNode: ConnectionProfileGroup | ConnectionProfile | undefined = node;
|
||||
while (currentNode) {
|
||||
if (currentNode.parent && currentNode.parent.id === this.id) {
|
||||
isAncestor = true;
|
||||
@@ -195,7 +195,7 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
||||
}
|
||||
|
||||
public static getConnectionsInGroup(group: ConnectionProfileGroup): ConnectionProfile[] {
|
||||
let connections = [];
|
||||
let connections: ConnectionProfile[] = [];
|
||||
if (group && group.connections) {
|
||||
group.connections.forEach((con) => connections.push(con));
|
||||
}
|
||||
@@ -208,7 +208,7 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
||||
}
|
||||
|
||||
public static getSubgroups(group: ConnectionProfileGroup): ConnectionProfileGroup[] {
|
||||
let subgroups = [];
|
||||
let subgroups: ConnectionProfileGroup[] = [];
|
||||
if (group && group.children) {
|
||||
group.children.forEach((grp) => subgroups.push(grp));
|
||||
group.children.forEach((subgroup) => {
|
||||
|
||||
@@ -104,27 +104,27 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
}
|
||||
|
||||
public get connectionName(): string {
|
||||
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.connectionName);
|
||||
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.connectionName)!;
|
||||
}
|
||||
|
||||
public get serverName(): string {
|
||||
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.serverName);
|
||||
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.serverName)!;
|
||||
}
|
||||
|
||||
public get databaseName(): string {
|
||||
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.databaseName);
|
||||
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.databaseName)!;
|
||||
}
|
||||
|
||||
public get userName(): string {
|
||||
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.userName);
|
||||
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.userName)!;
|
||||
}
|
||||
|
||||
public get password(): string {
|
||||
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.password);
|
||||
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.password)!;
|
||||
}
|
||||
|
||||
public get authenticationType(): string {
|
||||
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.authType);
|
||||
return this.getSpecialTypeOptionValue(ConnectionOptionSpecialType.authType)!;
|
||||
}
|
||||
|
||||
public set connectionName(value: string) {
|
||||
@@ -206,7 +206,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
return isPasswordRequired;
|
||||
}
|
||||
|
||||
private getSpecialTypeOptionValue(type: string): string {
|
||||
private getSpecialTypeOptionValue(type: string): string | undefined {
|
||||
let name = this.getSpecialTypeOptionName(type);
|
||||
if (name) {
|
||||
return this.options[name];
|
||||
@@ -243,7 +243,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
|
||||
let idValues: string[] = [];
|
||||
for (let index = 0; index < idNames.length; index++) {
|
||||
let value = this.options[idNames[index]];
|
||||
let value = this.options[idNames[index]!];
|
||||
value = value ? value : '';
|
||||
idValues.push(`${idNames[index]}${ProviderConnectionInfo.nameValueSeparator}${value}`);
|
||||
}
|
||||
@@ -266,7 +266,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
return providerId;
|
||||
}
|
||||
|
||||
public getSpecialTypeOptionName(type: string): string {
|
||||
public getSpecialTypeOptionName(type: string): string | undefined {
|
||||
if (this._serverCapabilities) {
|
||||
let optionMetadata = this._serverCapabilities.connectionOptions.find(o => o.specialValueType === type);
|
||||
return !!optionMetadata ? optionMetadata.name : undefined;
|
||||
|
||||
Reference in New Issue
Block a user