mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-24 01:25:37 -05:00
Merge from vscode fcf3346a8e9f5ee1e00674461d9e2c2292a14ee3 (#12295)
* Merge from vscode fcf3346a8e9f5ee1e00674461d9e2c2292a14ee3 * Fix test build break * Update distro * Fix build errors * Update distro * Update REH build file * Update build task names for REL * Fix product build yaml * Fix product REH task name * Fix type in task name * Update linux build step * Update windows build tasks * Turn off server publish * Disable REH * Fix typo * Bump distro * Update vscode tests * Bump distro * Fix type in disto * Bump distro * Turn off docker build * Remove docker step from release Co-authored-by: ADS Merger <andresse@microsoft.com> Co-authored-by: Karl Burtram <karlb@microsoft.com>
This commit is contained in:
@@ -12,7 +12,6 @@ import * as Utils from 'sql/platform/connection/common/utils';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import * as nls from 'vs/nls';
|
||||
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { find, firstIndex } from 'vs/base/common/arrays';
|
||||
import { deepClone } from 'vs/base/common/objects';
|
||||
|
||||
const GROUPS_CONFIG_KEY = 'datasource.connectionGroups';
|
||||
@@ -45,7 +44,7 @@ export class ConnectionConfig {
|
||||
|
||||
if (userValue) {
|
||||
if (workspaceValue) {
|
||||
userValue = userValue.filter(x => find(workspaceValue, f => this.isSameGroupName(f, x)) === undefined);
|
||||
userValue = userValue.filter(x => workspaceValue.find(f => this.isSameGroupName(f, x)) === undefined);
|
||||
allGroups = allGroups.concat(workspaceValue);
|
||||
}
|
||||
allGroups = allGroups.concat(userValue);
|
||||
@@ -73,12 +72,12 @@ export class ConnectionConfig {
|
||||
let newProfile = ConnectionProfile.convertToProfileStore(this._capabilitiesService, connectionProfile);
|
||||
|
||||
// Remove the profile if already set
|
||||
let sameProfileInList = find(profiles, value => {
|
||||
let sameProfileInList = profiles.find(value => {
|
||||
let providerConnectionProfile = ConnectionProfile.createFromStoredProfile(value, this._capabilitiesService);
|
||||
return matcher(providerConnectionProfile, connectionProfile);
|
||||
});
|
||||
if (sameProfileInList) {
|
||||
let profileIndex = firstIndex(profiles, value => value === sameProfileInList);
|
||||
let profileIndex = profiles.findIndex(value => value === sameProfileInList);
|
||||
newProfile.id = sameProfileInList.id;
|
||||
connectionProfile.id = sameProfileInList.id;
|
||||
profiles[profileIndex] = newProfile;
|
||||
@@ -125,7 +124,7 @@ export class ConnectionConfig {
|
||||
return Promise.resolve(profileGroup.id);
|
||||
} else {
|
||||
let groups = deepClone(this.configurationService.inspect<IConnectionProfileGroup[]>(GROUPS_CONFIG_KEY).userValue);
|
||||
let sameNameGroup = groups ? find(groups, group => group.name === profileGroup.name) : undefined;
|
||||
let sameNameGroup = groups ? groups.find(group => group.name === profileGroup.name) : undefined;
|
||||
if (sameNameGroup) {
|
||||
let errMessage: string = nls.localize('invalidServerName', "A server group with the same name already exists.");
|
||||
return Promise.reject(errMessage);
|
||||
@@ -282,7 +281,7 @@ export class ConnectionConfig {
|
||||
*/
|
||||
public canChangeConnectionConfig(profile: ConnectionProfile, newGroupID: string): boolean {
|
||||
let profiles = this.getIConnectionProfileStores(true);
|
||||
let existingProfile = find(profiles, p =>
|
||||
let existingProfile = profiles.find(p =>
|
||||
p.providerName === profile.providerName &&
|
||||
p.options.authenticationType === profile.options.authenticationType &&
|
||||
p.options.database === profile.options.database &&
|
||||
@@ -338,7 +337,7 @@ export class ConnectionConfig {
|
||||
|
||||
public editGroup(source: ConnectionProfileGroup): Promise<void> {
|
||||
let groups = deepClone(this.configurationService.inspect<IConnectionProfileGroup[]>(GROUPS_CONFIG_KEY).userValue);
|
||||
let sameNameGroup = groups ? find(groups, group => group.name === source.name && group.id !== source.id) : undefined;
|
||||
let sameNameGroup = groups ? groups.find(group => group.name === source.name && group.id !== source.id) : undefined;
|
||||
if (sameNameGroup) {
|
||||
let errMessage: string = nls.localize('invalidServerName', "A server group with the same name already exists.");
|
||||
return Promise.reject(errMessage);
|
||||
@@ -379,7 +378,7 @@ export class ConnectionConfig {
|
||||
color: color,
|
||||
description: description
|
||||
} as IConnectionProfileGroup;
|
||||
let found = find(groupTree, group => this.isSameGroupName(group, newGroup));
|
||||
let found = groupTree.find(group => this.isSameGroupName(group, newGroup));
|
||||
if (found) {
|
||||
if (index === groupNames.length - 1) {
|
||||
newGroupId = found.id;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { ConnectionProfile } from 'sql/platform/connection/common/connectionProf
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
|
||||
export interface INewConnectionProfileGroup {
|
||||
id?: string;
|
||||
@@ -108,7 +107,7 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
||||
* Returns true if all connections in the tree have valid options using the correct capabilities
|
||||
*/
|
||||
public get hasValidConnections(): boolean {
|
||||
let invalidConnections = find(this._childConnections, c => !c.isConnectionOptionsValid);
|
||||
let invalidConnections = this._childConnections.find(c => !c.isConnectionOptionsValid);
|
||||
if (invalidConnections !== undefined) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
@@ -16,7 +16,6 @@ import * as azdata from 'azdata';
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
import { firstIndex, find } from 'vs/base/common/arrays';
|
||||
|
||||
export class ConnectionStatusManager {
|
||||
|
||||
@@ -39,7 +38,7 @@ export class ConnectionStatusManager {
|
||||
}
|
||||
|
||||
public findConnectionByProfileId(profileId: string): ConnectionManagementInfo | undefined {
|
||||
return find(values(this._connections), connection => connection.connectionProfile.id === profileId);
|
||||
return values(this._connections).find(connection => connection.connectionProfile.id === profileId);
|
||||
}
|
||||
|
||||
public findConnectionProfile(connectionProfile: IConnectionProfile): ConnectionManagementInfo | undefined {
|
||||
@@ -231,10 +230,10 @@ export class ConnectionStatusManager {
|
||||
public getActiveConnectionProfiles(providers?: string[]): ConnectionProfile[] {
|
||||
let profiles = values(this._connections).map((connectionInfo: ConnectionManagementInfo) => connectionInfo.connectionProfile);
|
||||
// Remove duplicate profiles that may be listed multiple times under different URIs by filtering for profiles that don't have the same ID as an earlier profile in the list
|
||||
profiles = profiles.filter((profile, index) => firstIndex(profiles, otherProfile => otherProfile.id === profile.id) === index);
|
||||
profiles = profiles.filter((profile, index) => profiles.findIndex(otherProfile => otherProfile.id === profile.id) === index);
|
||||
|
||||
if (providers) {
|
||||
profiles = profiles.filter(f => find(providers, x => x === f.providerName));
|
||||
profiles = profiles.filter(f => providers.find(x => x === f.providerName));
|
||||
}
|
||||
return profiles;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { IConnectionProfile, ProfileMatcher } from 'sql/platform/connection/comm
|
||||
import { ICredentialsService } from 'sql/platform/credentials/common/credentialsService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
|
||||
const MAX_CONNECTIONS_DEFAULT = 25;
|
||||
|
||||
@@ -148,7 +147,7 @@ export class ConnectionStore {
|
||||
public getRecentlyUsedConnections(providers?: string[]): ConnectionProfile[] {
|
||||
let mru = this.mru.slice();
|
||||
if (providers && providers.length > 0) {
|
||||
mru = mru.filter(c => find(providers, x => x === c.providerName));
|
||||
mru = mru.filter(c => providers.find(x => x === c.providerName));
|
||||
}
|
||||
return this.convertConfigValuesToConnectionProfiles(mru);
|
||||
}
|
||||
@@ -275,7 +274,7 @@ export class ConnectionStore {
|
||||
if (!withoutConnections) {
|
||||
profilesInConfiguration = this.connectionConfig.getConnections(true);
|
||||
if (providers && providers.length > 0) {
|
||||
profilesInConfiguration = profilesInConfiguration.filter(x => find(providers, p => p === x.providerName));
|
||||
profilesInConfiguration = profilesInConfiguration.filter(x => providers.find(p => p === x.providerName));
|
||||
}
|
||||
}
|
||||
const groups = this.connectionConfig.getAllGroups();
|
||||
@@ -313,7 +312,7 @@ export class ConnectionStore {
|
||||
|
||||
public getGroupFromId(groupId: string): IConnectionProfileGroup | undefined {
|
||||
const groups = this.connectionConfig.getAllGroups();
|
||||
return find(groups, group => group.id === groupId);
|
||||
return groups.find(group => group.id === groupId);
|
||||
}
|
||||
|
||||
private getMaxRecentConnectionsCount(): number {
|
||||
|
||||
@@ -10,7 +10,6 @@ import * as azdata from 'azdata';
|
||||
import * as Constants from 'sql/platform/connection/common/constants';
|
||||
import { ICapabilitiesService, ConnectionProviderProperties } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { ConnectionOptionSpecialType, ServiceOptionType } from 'sql/platform/connection/common/interfaces';
|
||||
|
||||
type SettableProperty = 'serverName' | 'authenticationType' | 'databaseName' | 'password' | 'connectionName' | 'userName';
|
||||
@@ -198,7 +197,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
return false;
|
||||
}
|
||||
|
||||
let optionMetadata = find(this._serverCapabilities.connectionOptions,
|
||||
let optionMetadata = this._serverCapabilities.connectionOptions.find(
|
||||
option => option.specialValueType === ConnectionOptionSpecialType.password)!; // i guess we are going to assume there is a password field
|
||||
let isPasswordRequired = optionMetadata.isRequired;
|
||||
if (this.providerName === Constants.mssqlProviderName) {
|
||||
@@ -269,7 +268,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
|
||||
public getSpecialTypeOptionName(type: string): string | undefined {
|
||||
if (this._serverCapabilities) {
|
||||
let optionMetadata = find(this._serverCapabilities.connectionOptions, o => o.specialValueType === type);
|
||||
let optionMetadata = this._serverCapabilities.connectionOptions.find(o => o.specialValueType === type);
|
||||
return !!optionMetadata ? optionMetadata.name : undefined;
|
||||
} else {
|
||||
return type.toString();
|
||||
@@ -284,7 +283,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
}
|
||||
|
||||
public get authenticationTypeDisplayName(): string {
|
||||
let optionMetadata = this._serverCapabilities ? find(this._serverCapabilities.connectionOptions, o => o.specialValueType === ConnectionOptionSpecialType.authType) : undefined;
|
||||
let optionMetadata = this._serverCapabilities ? this._serverCapabilities.connectionOptions.find(o => o.specialValueType === ConnectionOptionSpecialType.authType) : undefined;
|
||||
let authType = this.authenticationType;
|
||||
let displayName: string = authType;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user