remove circular dependency between server group and connection management (#6916)

This commit is contained in:
Anthony Dresser
2019-08-23 14:53:54 -07:00
committed by GitHub
parent d6950fa4b7
commit 5b9a08359d
10 changed files with 30 additions and 71 deletions

View File

@@ -80,16 +80,6 @@ export interface IConnectionManagementService {
*/
showConnectionDialog(params?: INewConnectionParams, options?: IConnectionCompletionOptions, model?: IConnectionProfile, connectionResult?: IConnectionResult): Promise<void>;
/**
* Opens the add server group dialog
*/
showCreateServerGroupDialog(callbacks?: IServerGroupDialogCallbacks): Promise<void>;
/**
* Opens the edit server group dialog
*/
showEditServerGroupDialog(group: ConnectionProfileGroup): Promise<void>;
/**
* Load the password and opens a new connection
*/

View File

@@ -77,7 +77,6 @@ export class ConnectionManagementService extends Disposable implements IConnecti
private _connectionStore: ConnectionStore,
private _connectionStatusManager: ConnectionStatusManager,
@IConnectionDialogService private _connectionDialogService: IConnectionDialogService,
@IServerGroupController private _serverGroupController: IServerGroupController,
@IInstantiationService private _instantiationService: IInstantiationService,
@IEditorService private _editorService: IEditorService,
@ITelemetryService private _telemetryService: ITelemetryService,
@@ -202,34 +201,6 @@ export class ConnectionManagementService extends Disposable implements IConnecti
});
}
/**
* Opens the add server group dialog
*/
public showCreateServerGroupDialog(callbacks?: IServerGroupDialogCallbacks): Promise<void> {
let self = this;
return new Promise<void>((resolve, reject) => {
self._serverGroupController.showCreateGroupDialog(self, callbacks).then(() => {
resolve();
}, error => {
reject();
});
});
}
/**
* Opens the edit server group dialog
*/
public showEditServerGroupDialog(group: ConnectionProfileGroup): Promise<void> {
let self = this;
return new Promise<void>((resolve, reject) => {
self._serverGroupController.showEditGroupDialog(self, group).then(() => {
resolve();
}, error => {
reject();
});
});
}
/**
* Load the password for the profile
* @param connectionProfile Connection Profile

View File

@@ -149,7 +149,6 @@ suite('SQL ConnectionManagementService tests', () => {
connectionStore.object,
undefined,
connectionDialogService.object,
undefined, // IServerGroupController
undefined, // IInstantiationService
workbenchEditorService.object,
undefined, // ITelemetryService
@@ -946,7 +945,7 @@ suite('SQL ConnectionManagementService tests', () => {
connectionStoreMock.setup(x => x.getConnectionProfileGroups(TypeMoq.It.isAny(), undefined)).returns(() => {
return [group1];
});
const connectionManagementService = new ConnectionManagementService(connectionStoreMock.object, connectionStatusManagerMock.object, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
const connectionManagementService = new ConnectionManagementService(connectionStoreMock.object, connectionStatusManagerMock.object, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
// dupe connections have been seeded the numbers below already reflected the de-duped results

View File

@@ -5,7 +5,6 @@
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
import { ConnectionProfileGroup } from 'sql/platform/connection/common/connectionProfileGroup';
export interface IServerGroupDialogCallbacks {
@@ -15,6 +14,6 @@ export interface IServerGroupDialogCallbacks {
export const IServerGroupController = createDecorator<IServerGroupController>('serverGroupController');
export interface IServerGroupController {
_serviceBrand: any;
showCreateGroupDialog(connectionManagementService: IConnectionManagementService, callbacks?: IServerGroupDialogCallbacks): Promise<void>;
showEditGroupDialog(connectionManagementService: IConnectionManagementService, group: ConnectionProfileGroup): Promise<void>;
showCreateGroupDialog(callbacks?: IServerGroupDialogCallbacks): Promise<void>;
showEditGroupDialog(group: ConnectionProfileGroup): Promise<void>;
}