mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-04 01:25:38 -05:00
Add more folders to strict compile (#8954)
* add more folders to strictire compile, add more strict compile options * update ci * remove unnecessary assertion
This commit is contained in:
@@ -10,62 +10,56 @@ import { StopWatch } from 'vs/base/common/stopwatch';
|
||||
/**
|
||||
* Information for a document's connection. Exported for testing purposes.
|
||||
*/
|
||||
export class ConnectionManagementInfo {
|
||||
export interface ConnectionManagementInfo {
|
||||
/**
|
||||
* Connection GUID returned from the service host
|
||||
*/
|
||||
public connectionId: string;
|
||||
connectionId?: string;
|
||||
|
||||
|
||||
public providerId: string;
|
||||
providerId: string;
|
||||
|
||||
/**
|
||||
* Credentials used to connect
|
||||
*/
|
||||
public connectionProfile: ConnectionProfile;
|
||||
connectionProfile: ConnectionProfile;
|
||||
|
||||
/**
|
||||
* Callback for when a connection notification is received.
|
||||
*/
|
||||
public connectHandler: (result: boolean, errorMessage?: string, errorCode?: number, callStack?: string) => void;
|
||||
|
||||
/**
|
||||
* Information about the SQL Server instance.
|
||||
*/
|
||||
//public serverInfo: ConnectionContracts.ServerInfo;
|
||||
connectHandler?: (result: boolean, errorMessage?: string, errorCode?: number, callStack?: string) => void;
|
||||
|
||||
/**
|
||||
* Timer for tracking extension connection time.
|
||||
*/
|
||||
public extensionTimer: StopWatch;
|
||||
extensionTimer: StopWatch;
|
||||
|
||||
/**
|
||||
* Timer for tracking service connection time.
|
||||
*/
|
||||
public serviceTimer: StopWatch;
|
||||
serviceTimer: StopWatch;
|
||||
|
||||
/**
|
||||
* Timer for tracking intelliSense activation time.
|
||||
*/
|
||||
public intelliSenseTimer: StopWatch;
|
||||
intelliSenseTimer: StopWatch;
|
||||
|
||||
/**
|
||||
* Whether the connection is in the process of connecting.
|
||||
*/
|
||||
public connecting: boolean;
|
||||
connecting: boolean;
|
||||
|
||||
/**
|
||||
* Whether the connection should be deleted after connection is complete.
|
||||
*/
|
||||
public deleted: boolean;
|
||||
deleted?: boolean;
|
||||
|
||||
/**
|
||||
* Information about the connected server.
|
||||
*/
|
||||
serverInfo: azdata.ServerInfo;
|
||||
serverInfo?: azdata.ServerInfo;
|
||||
|
||||
/**
|
||||
* Owner uri assigned to the connection
|
||||
*/
|
||||
public ownerUri: string;
|
||||
ownerUri: string;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
|
||||
private _id: string;
|
||||
public savePassword: boolean;
|
||||
private _groupName?: string;
|
||||
public groupId: string;
|
||||
public groupId?: string;
|
||||
public saveProfile: boolean;
|
||||
|
||||
public isDisconnecting: boolean = false;
|
||||
@@ -256,7 +256,7 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
|
||||
let connectionInfo = ConnectionProfile.fromIConnectionProfile(capabilitiesService, connectionProfile);
|
||||
let profile: interfaces.IConnectionProfileStore = {
|
||||
options: {},
|
||||
groupId: connectionProfile.groupId,
|
||||
groupId: connectionProfile.groupId!,
|
||||
providerName: connectionInfo.providerName,
|
||||
savePassword: connectionInfo.savePassword,
|
||||
id: connectionInfo.id
|
||||
|
||||
@@ -19,10 +19,10 @@ export interface IConnectionProfileGroup {
|
||||
|
||||
export class ConnectionProfileGroup extends Disposable implements IConnectionProfileGroup {
|
||||
|
||||
public children: ConnectionProfileGroup[];
|
||||
public connections: ConnectionProfile[];
|
||||
public children: ConnectionProfileGroup[] = [];
|
||||
public connections: ConnectionProfile[] = [];
|
||||
public parentId?: string;
|
||||
private _isRenamed: boolean;
|
||||
private _isRenamed = false;
|
||||
public constructor(
|
||||
public name: string,
|
||||
public parent: ConnectionProfileGroup | undefined,
|
||||
@@ -42,7 +42,7 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
||||
|
||||
public toObject(): IConnectionProfileGroup {
|
||||
let subgroups = undefined;
|
||||
if (this.children) {
|
||||
if (this.children.length > 0) {
|
||||
subgroups = [];
|
||||
this.children.forEach((group) => {
|
||||
subgroups.push(group.toObject());
|
||||
@@ -129,9 +129,6 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
||||
}
|
||||
|
||||
public addConnections(connections: ConnectionProfile[]): void {
|
||||
if (!this.connections) {
|
||||
this.connections = [];
|
||||
}
|
||||
connections.forEach((conn) => {
|
||||
this.connections = this.connections.filter((curConn) => { return curConn.id !== conn.id; });
|
||||
conn.parent = this;
|
||||
@@ -142,9 +139,6 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
||||
}
|
||||
|
||||
public addGroups(groups: ConnectionProfileGroup[]): void {
|
||||
if (!this.children) {
|
||||
this.children = [];
|
||||
}
|
||||
groups.forEach((group) => {
|
||||
this.children = this.children.filter((grp) => { return group.id !== grp.id; });
|
||||
group.parent = this;
|
||||
|
||||
@@ -77,15 +77,16 @@ export class ConnectionStatusManager {
|
||||
this._logService.info(`Adding connection ${id}`);
|
||||
// Always create a copy and save that in the list
|
||||
let connectionProfile = new ConnectionProfile(this._capabilitiesService, connection);
|
||||
let connectionInfo: ConnectionManagementInfo = new ConnectionManagementInfo();
|
||||
connectionInfo.providerId = connection.providerName;
|
||||
connectionInfo.extensionTimer = StopWatch.create();
|
||||
connectionInfo.intelliSenseTimer = StopWatch.create();
|
||||
connectionInfo.connectionProfile = connectionProfile;
|
||||
connectionInfo.connecting = true;
|
||||
let connectionInfo: ConnectionManagementInfo = {
|
||||
providerId: connection.providerName,
|
||||
extensionTimer: StopWatch.create(),
|
||||
intelliSenseTimer: StopWatch.create(),
|
||||
connectionProfile: connectionProfile,
|
||||
connecting: true,
|
||||
serviceTimer: StopWatch.create(),
|
||||
ownerUri: id
|
||||
};
|
||||
this._connections[id] = connectionInfo;
|
||||
connectionInfo.serviceTimer = StopWatch.create();
|
||||
connectionInfo.ownerUri = id;
|
||||
this._logService.info(`Successfully added connection ${id}`);
|
||||
return connectionInfo;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export interface IConnectionProfile extends azdata.IConnectionProfile {
|
||||
}
|
||||
|
||||
export interface IConnectionProfileStore {
|
||||
options: {};
|
||||
options: { [key: string]: any };
|
||||
groupId: string;
|
||||
providerName: string;
|
||||
savePassword: boolean;
|
||||
|
||||
@@ -19,9 +19,9 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
|
||||
options: { [name: string]: any } = {};
|
||||
|
||||
private _providerName: string;
|
||||
private _onCapabilitiesRegisteredDisposable: IDisposable;
|
||||
protected _serverCapabilities: ConnectionProviderProperties;
|
||||
private _providerName?: string;
|
||||
private _onCapabilitiesRegisteredDisposable?: IDisposable;
|
||||
protected _serverCapabilities?: ConnectionProviderProperties;
|
||||
private static readonly SqlAuthentication = 'SqlLogin';
|
||||
public static readonly ProviderPropertyName = 'providerName';
|
||||
|
||||
@@ -66,7 +66,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
}
|
||||
|
||||
public get providerName(): string {
|
||||
return this._providerName;
|
||||
return this._providerName!; // this needs to be rewritten at some point
|
||||
}
|
||||
|
||||
public set providerName(name: string) {
|
||||
@@ -100,7 +100,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
return instance;
|
||||
}
|
||||
|
||||
public get serverCapabilities(): ConnectionProviderProperties {
|
||||
public get serverCapabilities(): ConnectionProviderProperties | undefined {
|
||||
return this._serverCapabilities;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
* Returns true if the capabilities and options are loaded correctly
|
||||
*/
|
||||
public get isConnectionOptionsValid(): boolean {
|
||||
return this.serverCapabilities && this.title.indexOf('undefined') < 0;
|
||||
return !!this.serverCapabilities && this.title.indexOf('undefined') < 0;
|
||||
}
|
||||
|
||||
public isPasswordRequired(): boolean {
|
||||
@@ -284,7 +284,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
}
|
||||
|
||||
public get authenticationTypeDisplayName(): string {
|
||||
let optionMetadata = find(this._serverCapabilities.connectionOptions, o => o.specialValueType === ConnectionOptionSpecialType.authType);
|
||||
let optionMetadata = this._serverCapabilities ? find(this._serverCapabilities.connectionOptions, o => o.specialValueType === ConnectionOptionSpecialType.authType) : undefined;
|
||||
let authType = this.authenticationType;
|
||||
let displayName: string = authType;
|
||||
|
||||
@@ -298,8 +298,8 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public getProviderOptions(): azdata.ConnectionOption[] {
|
||||
return this._serverCapabilities.connectionOptions;
|
||||
public getProviderOptions(): azdata.ConnectionOption[] | undefined {
|
||||
return this._serverCapabilities?.connectionOptions;
|
||||
}
|
||||
|
||||
public static get idSeparator(): string {
|
||||
@@ -317,19 +317,21 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
parts.push(this.databaseName);
|
||||
parts.push(this.authenticationTypeDisplayName);
|
||||
|
||||
this._serverCapabilities.connectionOptions.forEach(element => {
|
||||
if (element.specialValueType !== ConnectionOptionSpecialType.serverName &&
|
||||
element.specialValueType !== ConnectionOptionSpecialType.databaseName &&
|
||||
element.specialValueType !== ConnectionOptionSpecialType.authType &&
|
||||
element.specialValueType !== ConnectionOptionSpecialType.password &&
|
||||
element.specialValueType !== ConnectionOptionSpecialType.connectionName &&
|
||||
element.isIdentity && element.valueType === ServiceOptionType.string) {
|
||||
let value = this.getOptionValue(element.name);
|
||||
if (value) {
|
||||
parts.push(value);
|
||||
if (this._serverCapabilities) {
|
||||
this._serverCapabilities.connectionOptions.forEach(element => {
|
||||
if (element.specialValueType !== ConnectionOptionSpecialType.serverName &&
|
||||
element.specialValueType !== ConnectionOptionSpecialType.databaseName &&
|
||||
element.specialValueType !== ConnectionOptionSpecialType.authType &&
|
||||
element.specialValueType !== ConnectionOptionSpecialType.password &&
|
||||
element.specialValueType !== ConnectionOptionSpecialType.connectionName &&
|
||||
element.isIdentity && element.valueType === ServiceOptionType.string) {
|
||||
let value = this.getOptionValue(element.name);
|
||||
if (value) {
|
||||
parts.push(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user