mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-29 09:35:38 -05:00
Renable Strict TSLint (#5018)
* removes more builder references * remove builder from profiler * formatting * fix profiler dailog * remove builder from oatuhdialog * remove the rest of builder references * formatting * add more strict null checks to base * enable strict tslint rules * fix formatting * fix compile error * fix the rest of the hygeny issues and add pipeline step * fix pipeline files
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import { ConnectionProfileGroup, IConnectionProfileGroup } from 'sql/platform/connection/common/connectionProfileGroup';
|
||||
@@ -69,7 +68,7 @@ export class ConnectionConfig implements IConnectionConfig {
|
||||
let newProfile = ConnectionProfile.convertToProfileStore(this._capabilitiesService, connectionProfile);
|
||||
|
||||
// Remove the profile if already set
|
||||
var sameProfileInList = profiles.find(value => {
|
||||
let sameProfileInList = profiles.find(value => {
|
||||
let providerConnectionProfile = ConnectionProfile.createFromStoredProfile(value, this._capabilitiesService);
|
||||
return providerConnectionProfile.matches(connectionProfile);
|
||||
});
|
||||
@@ -100,7 +99,6 @@ export class ConnectionConfig implements IConnectionConfig {
|
||||
|
||||
/**
|
||||
*Returns group id
|
||||
* @param groupName
|
||||
*/
|
||||
public addGroupFromProfile(profile: IConnectionProfile): Promise<string> {
|
||||
if (profile.groupId && profile.groupId !== Utils.defaultGroupId) {
|
||||
@@ -116,7 +114,6 @@ export class ConnectionConfig implements IConnectionConfig {
|
||||
|
||||
/**
|
||||
*Returns group id
|
||||
* @param groupName
|
||||
*/
|
||||
public addGroup(profileGroup: IConnectionProfileGroup): Promise<string> {
|
||||
if (profileGroup.id) {
|
||||
@@ -159,13 +156,12 @@ export class ConnectionConfig implements IConnectionConfig {
|
||||
|
||||
/**
|
||||
* Replace duplicate ids with new ones. Sets id for the profiles without id
|
||||
* @param profiles
|
||||
*/
|
||||
private fixConnectionIds(profiles: IConnectionProfileStore[]): boolean {
|
||||
let idsCache: { [label: string]: boolean } = {};
|
||||
let changed: boolean = false;
|
||||
for (var index = 0; index < profiles.length; index++) {
|
||||
var profile = profiles[index];
|
||||
for (let index = 0; index < profiles.length; index++) {
|
||||
let profile = profiles[index];
|
||||
if (!profile.id) {
|
||||
profile.id = generateUuid();
|
||||
changed = true;
|
||||
|
||||
@@ -3,17 +3,14 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as interfaces from 'sql/platform/connection/common/interfaces';
|
||||
|
||||
/**
|
||||
* Sets sensible defaults for key connection properties, especially
|
||||
* if connection to Azure
|
||||
*
|
||||
* @export connectionInfo/fixupConnectionCredentials
|
||||
* @param {interfaces.IConnectionCredentials} connCreds connection to be fixed up
|
||||
* @returns {interfaces.IConnectionCredentials} the updated connection
|
||||
* @param connCreds connection to be fixed up
|
||||
* @returns the updated connection
|
||||
*/
|
||||
export function fixupConnectionCredentials(connCreds: interfaces.IConnectionProfile): interfaces.IConnectionProfile {
|
||||
if (!connCreds.serverName) {
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import * as azdata from 'azdata';
|
||||
@@ -221,18 +219,15 @@ export interface IConnectionManagementService {
|
||||
* Sends a notification that the language flavor for a given URI has changed.
|
||||
* For SQL, this would be the specific SQL implementation being used.
|
||||
*
|
||||
* @param {string} uri the URI of the resource whose language has changed
|
||||
* @param {string} language the base language
|
||||
* @param {string} flavor the specific language flavor that's been set
|
||||
*
|
||||
* @memberof IConnectionManagementService
|
||||
* @param uri the URI of the resource whose language has changed
|
||||
* @param language the base language
|
||||
* @param flavor the specific language flavor that's been set
|
||||
*/
|
||||
doChangeLanguageFlavor(uri: string, language: string, flavor: string): void;
|
||||
|
||||
/**
|
||||
* Ensures that a default language flavor is set for a URI, if none has already been defined.
|
||||
* @param {string} uri document identifier
|
||||
* @memberof ConnectionManagementService
|
||||
* @param uri document identifier
|
||||
*/
|
||||
ensureDefaultLanguageFlavor(uri: string): void;
|
||||
|
||||
@@ -243,22 +238,22 @@ export interface IConnectionManagementService {
|
||||
|
||||
/**
|
||||
* Get a copy of the connection profile with its passwords removed
|
||||
* @param {IConnectionProfile} profile The connection profile to remove passwords from
|
||||
* @returns {IConnectionProfile} A copy of the connection profile with passwords removed
|
||||
* @param profile The connection profile to remove passwords from
|
||||
* @returns A copy of the connection profile with passwords removed
|
||||
*/
|
||||
removeConnectionProfileCredentials(profile: IConnectionProfile): IConnectionProfile;
|
||||
|
||||
/**
|
||||
* Get the credentials for a connected connection profile, as they would appear in the options dictionary
|
||||
* @param {string} profileId The id of the connection profile to get the password for
|
||||
* @returns {{ [name: string]: string }} A dictionary containing the credentials as they would be included
|
||||
* @param profileId The id of the connection profile to get the password for
|
||||
* @returns A dictionary containing the credentials as they would be included
|
||||
* in the connection profile's options dictionary, or undefined if the profile is not connected
|
||||
*/
|
||||
getActiveConnectionCredentials(profileId: string): { [name: string]: string };
|
||||
|
||||
/**
|
||||
* Get the ServerInfo for a connected connection profile
|
||||
* @param {string} profileId The id of the connection profile to get the password for
|
||||
* @param profileId The id of the connection profile to get the password for
|
||||
* @returns ServerInfo
|
||||
*/
|
||||
getServerInfo(profileId: string): azdata.ServerInfo;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import * as WorkbenchUtils from 'sql/workbench/common/sqlWorkbenchUtils';
|
||||
@@ -703,8 +702,6 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
/**
|
||||
* Returns a formatted URI in case the database field is empty for the original
|
||||
* URI, which happens when the connected database is master or the default database
|
||||
* @param uri
|
||||
* @param connectionProfile
|
||||
*/
|
||||
public getFormattedUri(uri: string, connectionProfile: IConnectionProfile): string {
|
||||
if (this._connectionStatusManager.isDefaultTypeUri(uri)) {
|
||||
@@ -718,11 +715,10 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
* Sends a notification that the language flavor for a given URI has changed.
|
||||
* For SQL, this would be the specific SQL implementation being used.
|
||||
*
|
||||
* @param {string} uri the URI of the resource whose language has changed
|
||||
* @param {string} language the base language
|
||||
* @param {string} flavor the specific language flavor that's been set
|
||||
* @param uri the URI of the resource whose language has changed
|
||||
* @param language the base language
|
||||
* @param flavor the specific language flavor that's been set
|
||||
* @throws {Error} if the provider is not in the list of registered providers
|
||||
* @memberof ConnectionManagementService
|
||||
*/
|
||||
public doChangeLanguageFlavor(uri: string, language: string, provider: string): void {
|
||||
if (this._providers.has(provider)) {
|
||||
@@ -738,8 +734,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
|
||||
/**
|
||||
* Ensures that a default language flavor is set for a URI, if none has already been defined.
|
||||
* @param {string} uri document identifier
|
||||
* @memberof ConnectionManagementService
|
||||
* @param uri document identifier
|
||||
*/
|
||||
public ensureDefaultLanguageFlavor(uri: string): void {
|
||||
if (!this.getProviderIdFromUri(uri)) {
|
||||
@@ -973,7 +968,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
// If the URI is connected, disconnect it and the editor
|
||||
if (self.isConnected(owner.uri)) {
|
||||
var connection = self.getConnectionProfile(owner.uri);
|
||||
let connection = self.getConnectionProfile(owner.uri);
|
||||
owner.onDisconnect();
|
||||
resolve(self.doDisconnect(owner.uri, connection));
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { ConnectionManagementInfo } from 'sql/platform/connection/common/connectionManagementInfo';
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
@@ -16,7 +15,7 @@ export class ConnectionStatusManager {
|
||||
|
||||
private _connections: { [id: string]: ConnectionManagementInfo };
|
||||
|
||||
constructor( @ICapabilitiesService private _capabilitiesService: ICapabilitiesService) {
|
||||
constructor(@ICapabilitiesService private _capabilitiesService: ICapabilitiesService) {
|
||||
this._connections = {};
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as Constants from 'sql/platform/connection/common/constants';
|
||||
import * as ConnInfo from 'sql/platform/connection/common/connectionInfo';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
@@ -24,7 +22,6 @@ const MAX_CONNECTIONS_DEFAULT = 25;
|
||||
* Manages the connections list including saved profiles and the most recently used connections
|
||||
*
|
||||
* @export
|
||||
* @class ConnectionStore
|
||||
*/
|
||||
export class ConnectionStore {
|
||||
private _memento: any;
|
||||
@@ -65,10 +62,9 @@ export class ConnectionStore {
|
||||
/**
|
||||
* Creates a formatted credential usable for uniquely identifying a SQL Connection.
|
||||
* This string can be decoded but is not optimized for this.
|
||||
* @static
|
||||
* @param {IConnectionProfile} connectionProfile connection profile - require
|
||||
* @param {string} itemType type of the item (MRU or Profile) - optional
|
||||
* @returns {string} formatted string with server, DB and username
|
||||
* @param connectionProfile connection profile - require
|
||||
* @param itemType type of the item (MRU or Profile) - optional
|
||||
* @returns formatted string with server, DB and username
|
||||
*/
|
||||
public formatCredentialId(connectionProfile: IConnectionProfile, itemType?: string): string {
|
||||
let connectionProfileInstance: ConnectionProfile = ConnectionProfile.fromIConnectionProfile(
|
||||
@@ -120,9 +116,9 @@ export class ConnectionStore {
|
||||
}
|
||||
resolve({ profile: credentialsItem, savedCred: !!savedCred });
|
||||
},
|
||||
reason => {
|
||||
reject(reason);
|
||||
});
|
||||
reason => {
|
||||
reject(reason);
|
||||
});
|
||||
} else {
|
||||
// No need to look up the password
|
||||
resolve({ profile: credentialsItem, savedCred: credentialsItem.savePassword });
|
||||
@@ -134,9 +130,9 @@ export class ConnectionStore {
|
||||
* Saves a connection profile to the user settings.
|
||||
* Password values are stored to a separate credential store if the "savePassword" option is true
|
||||
*
|
||||
* @param {IConnectionProfile} profile the profile to save
|
||||
* @param {forceWritePlaintextPassword} whether the plaintext password should be written to the settings file
|
||||
* @returns {Promise<IConnectionProfile>} a Promise that returns the original profile, for help in chaining calls
|
||||
* @param profile the profile to save
|
||||
* @param whether the plaintext password should be written to the settings file
|
||||
* @returns a Promise that returns the original profile, for help in chaining calls
|
||||
*/
|
||||
public saveProfile(profile: IConnectionProfile, forceWritePlaintextPassword?: boolean): Promise<IConnectionProfile> {
|
||||
const self = this;
|
||||
@@ -172,8 +168,8 @@ export class ConnectionStore {
|
||||
/**
|
||||
* Saves a connection profile group to the user settings.
|
||||
*
|
||||
* @param {IConnectionProfileGroup} profile the profile group to save
|
||||
* @returns {Promise<string>} a Promise that returns the id of connection group
|
||||
* @param profile the profile group to save
|
||||
* @returns a Promise that returns the id of connection group
|
||||
*/
|
||||
public saveProfileGroup(profile: IConnectionProfileGroup): Promise<string> {
|
||||
const self = this;
|
||||
@@ -205,7 +201,7 @@ export class ConnectionStore {
|
||||
* Gets the list of recently used connections. These will not include the password - a separate call to
|
||||
* {addSavedPassword} is needed to fill that before connecting
|
||||
*
|
||||
* @returns {azdata.ConnectionInfo} the array of connections, empty if none are found
|
||||
* @returns the array of connections, empty if none are found
|
||||
*/
|
||||
public getRecentlyUsedConnections(providers?: string[]): ConnectionProfile[] {
|
||||
let configValues: IConnectionProfile[] = this._memento[Constants.recentConnections];
|
||||
@@ -245,7 +241,7 @@ export class ConnectionStore {
|
||||
* Gets the list of active connections. These will not include the password - a separate call to
|
||||
* {addSavedPassword} is needed to fill that before connecting
|
||||
*
|
||||
* @returns {azdata.ConnectionInfo} the array of connections, empty if none are found
|
||||
* @returns the array of connections, empty if none are found
|
||||
*/
|
||||
public getActiveConnections(): ConnectionProfile[] {
|
||||
let configValues: IConnectionProfile[] = this._memento[Constants.activeConnections];
|
||||
@@ -272,9 +268,9 @@ export class ConnectionStore {
|
||||
* Connection is only added if there are no other connections with the same connection ID in the list.
|
||||
* Password values are stored to a separate credential store if the "savePassword" option is true
|
||||
*
|
||||
* @param {IConnectionCredentials} conn the connection to add
|
||||
* @param {boolean} addToMru Whether to add this connection to the MRU
|
||||
* @returns {Promise<void>} a Promise that returns when the connection was saved
|
||||
* @param conn the connection to add
|
||||
* @param addToMru Whether to add this connection to the MRU
|
||||
* @returns a Promise that returns when the connection was saved
|
||||
*/
|
||||
public async addActiveConnection(conn: IConnectionProfile, addToMru: boolean): Promise<void> {
|
||||
if (addToMru) {
|
||||
@@ -459,7 +455,7 @@ export class ConnectionStore {
|
||||
this.addGroupFullNameToMap(group.id, connectionGroup.fullName);
|
||||
if (connections) {
|
||||
let connectionsForGroup = connections.filter(conn => conn.groupId === connectionGroup.id);
|
||||
var conns = [];
|
||||
let conns = [];
|
||||
connectionsForGroup.forEach((conn) => {
|
||||
conn.groupFullName = connectionGroup.fullName;
|
||||
conns.push(conn);
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { IConnectionProfileGroup, ConnectionProfileGroup } from 'sql/platform/connection/common/connectionProfileGroup';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
@@ -13,7 +11,6 @@ import { ConnectionProfile } from 'sql/platform/connection/common/connectionProf
|
||||
* Interface for a configuration file that stores connection profiles.
|
||||
*
|
||||
* @export
|
||||
* @interface IConnectionConfig
|
||||
*/
|
||||
export interface IConnectionConfig {
|
||||
addConnection(profile: IConnectionProfile): Promise<IConnectionProfile>;
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { isString } from 'vs/base/common/types';
|
||||
|
||||
@@ -228,7 +226,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
idNames.sort();
|
||||
|
||||
let idValues: string[] = [];
|
||||
for (var index = 0; index < idNames.length; index++) {
|
||||
for (let index = 0; index < idNames.length; index++) {
|
||||
let value = this.options[idNames[index]];
|
||||
value = value ? value : '';
|
||||
idValues.push(`${idNames[index]}${ProviderConnectionInfo.nameValueSeparator}${value}`);
|
||||
|
||||
Reference in New Issue
Block a user