mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-27 17:23:21 -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:
@@ -5,13 +5,14 @@
|
||||
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
|
||||
export interface IConnectionProfileGroup {
|
||||
id: string;
|
||||
parentId?: string;
|
||||
name: string;
|
||||
color: string;
|
||||
description: string;
|
||||
color?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export class ConnectionProfileGroup extends Disposable implements IConnectionProfileGroup {
|
||||
@@ -22,10 +23,10 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
||||
private _isRenamed: boolean;
|
||||
public constructor(
|
||||
public name: string,
|
||||
public parent: ConnectionProfileGroup,
|
||||
public parent: ConnectionProfileGroup | undefined,
|
||||
public id: string,
|
||||
public color: string,
|
||||
public description: string
|
||||
public color?: string,
|
||||
public description?: string
|
||||
) {
|
||||
super();
|
||||
this.parentId = parent ? parent.id : undefined;
|
||||
@@ -150,7 +151,7 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
||||
});
|
||||
}
|
||||
|
||||
public getParent(): ConnectionProfileGroup {
|
||||
public getParent(): ConnectionProfileGroup | undefined {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
@@ -167,7 +168,7 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
||||
return isAncestor;
|
||||
}
|
||||
|
||||
public static getGroupFullNameParts(groupFullName: string): string[] {
|
||||
public static getGroupFullNameParts(groupFullName?: string): string[] {
|
||||
groupFullName = groupFullName ? groupFullName : '';
|
||||
let groupNames: string[] = groupFullName.split(ConnectionProfileGroup.GroupNameSeparator);
|
||||
groupNames = groupNames.filter(g => !!g);
|
||||
@@ -185,13 +186,19 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
||||
name === ConnectionProfileGroup.GroupNameSeparator);
|
||||
}
|
||||
|
||||
public static sameGroupName(name1: string, name2: string): boolean {
|
||||
let sameGroupName: boolean =
|
||||
(!name1 && !name2) ||
|
||||
name1.toUpperCase() === name2.toUpperCase() ||
|
||||
(ConnectionProfileGroup.isRoot(name1) && ConnectionProfileGroup.isRoot(name2));
|
||||
|
||||
return sameGroupName;
|
||||
public static sameGroupName(name1?: string, name2?: string): boolean {
|
||||
const isName1Undefined = isUndefinedOrNull(name1);
|
||||
const isName2Undefined = isUndefinedOrNull(name2);
|
||||
if (isName1Undefined && isName2Undefined) {
|
||||
return true;
|
||||
}
|
||||
if ((isName1Undefined && !isName2Undefined) || !isName1Undefined && isName2Undefined) {
|
||||
return false;
|
||||
}
|
||||
if (name1!.toUpperCase() === name2!.toUpperCase()) {
|
||||
return true;
|
||||
}
|
||||
return ConnectionProfileGroup.isRoot(name1!) && ConnectionProfileGroup.isRoot(name2!);
|
||||
}
|
||||
|
||||
public static getConnectionsInGroup(group: ConnectionProfileGroup): ConnectionProfile[] {
|
||||
|
||||
Reference in New Issue
Block a user