mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-22 09:35:37 -05:00
Merge from vscode e3c4990c67c40213af168300d1cfeb71d680f877 (#16569)
This commit is contained in:
@@ -89,7 +89,7 @@ export class ConnectionConfig {
|
||||
public addConnection(profile: IConnectionProfile, matcher: ProfileMatcher = ConnectionProfile.matchesProfile): Promise<IConnectionProfile> {
|
||||
if (profile.saveProfile) {
|
||||
return this.addGroupFromProfile(profile).then(groupId => {
|
||||
let profiles = deepClone(this.configurationService.inspect<IConnectionProfileStore[]>(CONNECTIONS_CONFIG_KEY).userValue);
|
||||
let profiles = deepClone(this.configurationService.inspect<IConnectionProfileStore[]>(CONNECTIONS_CONFIG_KEY).userValue as IConnectionProfileStore[]);
|
||||
if (!profiles) {
|
||||
profiles = [];
|
||||
}
|
||||
@@ -134,7 +134,7 @@ export class ConnectionConfig {
|
||||
if (profile.groupId && profile.groupId !== Utils.defaultGroupId) {
|
||||
return Promise.resolve(profile.groupId);
|
||||
} else {
|
||||
let groups = deepClone(this.configurationService.inspect<IConnectionProfileGroup[]>(GROUPS_CONFIG_KEY).userValue);
|
||||
let groups = deepClone(this.configurationService.inspect<IConnectionProfileGroup[]>(GROUPS_CONFIG_KEY).userValue as IConnectionProfileGroup[]);
|
||||
let result = this.saveGroup(groups!, profile.groupFullName, undefined, undefined);
|
||||
groups = result.groups;
|
||||
|
||||
@@ -149,7 +149,7 @@ export class ConnectionConfig {
|
||||
if (profileGroup.id) {
|
||||
return Promise.resolve(profileGroup.id);
|
||||
} else {
|
||||
let groups = deepClone(this.configurationService.inspect<IConnectionProfileGroup[]>(GROUPS_CONFIG_KEY).userValue);
|
||||
let groups = deepClone(this.configurationService.inspect<IConnectionProfileGroup[]>(GROUPS_CONFIG_KEY).userValue as IConnectionProfileGroup[]);
|
||||
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.");
|
||||
@@ -169,9 +169,9 @@ export class ConnectionConfig {
|
||||
if (configs) {
|
||||
let fromConfig: IConnectionProfileStore[] | undefined;
|
||||
if (configTarget === ConfigurationTarget.USER) {
|
||||
fromConfig = configs.userValue;
|
||||
fromConfig = configs.userValue as IConnectionProfileStore[];
|
||||
} else if (configTarget === ConfigurationTarget.WORKSPACE) {
|
||||
fromConfig = configs.workspaceValue || [];
|
||||
fromConfig = configs.workspaceValue as IConnectionProfileStore[] || [];
|
||||
}
|
||||
if (fromConfig) {
|
||||
profiles = deepClone(fromConfig);
|
||||
@@ -340,8 +340,8 @@ export class ConnectionConfig {
|
||||
* Moves the connection under the target group with the new ID.
|
||||
*/
|
||||
private changeGroupIdForConnectionInSettings(profile: ConnectionProfile, newGroupID: string, target: ConfigurationTarget = ConfigurationTarget.USER): Promise<void> {
|
||||
let profiles = deepClone(target === ConfigurationTarget.USER ? this.configurationService.inspect<IConnectionProfileStore[]>(CONNECTIONS_CONFIG_KEY).userValue :
|
||||
this.configurationService.inspect<IConnectionProfileStore[]>(CONNECTIONS_CONFIG_KEY).workspaceValue);
|
||||
let profiles = deepClone(target === ConfigurationTarget.USER ? this.configurationService.inspect<IConnectionProfileStore[]>(CONNECTIONS_CONFIG_KEY).userValue as IConnectionProfileStore[] :
|
||||
this.configurationService.inspect<IConnectionProfileStore[]>(CONNECTIONS_CONFIG_KEY).workspaceValue as IConnectionProfileStore[]);
|
||||
if (profiles) {
|
||||
if (profile.parent && profile.parent.id === UNSAVED_GROUP_ID) {
|
||||
profile.groupId = newGroupID;
|
||||
|
||||
Reference in New Issue
Block a user