Revert "Remove typings and replace missing methods with vscodes (#8217)" (#8240)

This reverts commit 22a427f934.
This commit is contained in:
Elliot Boschwitz
2019-11-06 11:33:55 -08:00
committed by GitHub
parent 3b1eaca58e
commit e801a04bcf
184 changed files with 43388 additions and 634 deletions

View File

@@ -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';
const GROUPS_CONFIG_KEY = 'datasource.connectionGroups';
const CONNECTIONS_CONFIG_KEY = 'datasource.connections';
@@ -44,7 +43,7 @@ export class ConnectionConfig {
if (user) {
if (workspace) {
user = user.filter(x => find(workspace, f => this.isSameGroupName(f, x)) === undefined);
user = user.filter(x => workspace.find(f => this.isSameGroupName(f, x)) === undefined);
allGroups = allGroups.concat(workspace);
}
allGroups = allGroups.concat(user);
@@ -72,12 +71,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 providerConnectionProfile.matches(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;
@@ -124,7 +123,7 @@ export class ConnectionConfig {
return Promise.resolve(profileGroup.id);
} else {
let groups = this.configurationService.inspect<IConnectionProfileGroup[]>(GROUPS_CONFIG_KEY).user;
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);
@@ -277,7 +276,7 @@ export class ConnectionConfig {
*/
public canChangeConnectionConfig(profile: ConnectionProfile, newGroupID: string): boolean {
let profiles = this.getConnections(true);
let existingProfile = find(profiles, p => p.getConnectionInfoId() === profile.getConnectionInfoId()
let existingProfile = profiles.find(p => p.getConnectionInfoId() === profile.getConnectionInfoId()
&& p.groupId === newGroupID);
return existingProfile === undefined;
}
@@ -329,7 +328,7 @@ export class ConnectionConfig {
public editGroup(source: ConnectionProfileGroup): Promise<void> {
let groups = this.configurationService.inspect<IConnectionProfileGroup[]>(GROUPS_CONFIG_KEY).user;
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);
@@ -370,7 +369,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;