Fix OE single click and expand groups by default (#1096)

This commit is contained in:
Karl Burtram
2018-04-06 15:15:41 -07:00
committed by GitHub
parent 3990719054
commit 2182658301
4 changed files with 29 additions and 10 deletions

View File

@@ -29,6 +29,8 @@ import { Button } from 'sql/base/browser/ui/button/button';
import { attachButtonStyler } from 'sql/common/theme/styler';
import Event, { Emitter } from 'vs/base/common/event';
import { TreeNode, TreeItemCollapsibleState } from 'sql/parts/objectExplorer/common/treeNode';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { SERVER_GROUP_CONFIG, SERVER_GROUP_AUTOEXPAND_CONFIG } from 'sql/parts/objectExplorer/serverGroupDialog/serverGroup.contribution';
const $ = builder.$;
@@ -52,6 +54,7 @@ export class ServerTreeView {
@IThemeService private _themeService: IThemeService,
@IErrorMessageService private _errorMessageService: IErrorMessageService,
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService,
@IConfigurationService private _configurationService: IConfigurationService
) {
this._activeConnectionsFilterAction = this._instantiationService.createInstance(
ActiveConnectionsFilterAction,
@@ -109,12 +112,10 @@ export class ServerTreeView {
// Refresh Tree when these events are emitted
this._toDispose.push(this._connectionManagementService.onAddConnectionProfile((newProfile: IConnectionProfile) => {
self.handleAddConnectionProfile(newProfile);
})
);
}));
this._toDispose.push(this._connectionManagementService.onDeleteConnectionProfile(() => {
self.refreshTree();
})
);
}));
this._toDispose.push(this._connectionManagementService.onDisconnect((connectionParams) => {
if (self.isObjectExplorerConnectionUri(connectionParams.connectionUri)) {
self.deleteObjectExplorerNodeAndRefreshTree(connectionParams.connectionProfile);
@@ -124,7 +125,7 @@ export class ServerTreeView {
if (this._objectExplorerService && this._objectExplorerService.onUpdateObjectExplorerNodes) {
this._toDispose.push(this._objectExplorerService.onUpdateObjectExplorerNodes(args => {
if (args.errorMessage) {
this.showError(args.errorMessage);
self.showError(args.errorMessage);
}
if (args.connection) {
self.onObjectExplorerSessionCreated(args.connection);
@@ -133,9 +134,15 @@ export class ServerTreeView {
}
return new Promise<void>((resolve, reject) => {
self.refreshTree();
let root = <ConnectionProfileGroup>this._tree.getInput();
let root = <ConnectionProfileGroup>self._tree.getInput();
let expandGroups: boolean = self._configurationService.getValue(SERVER_GROUP_CONFIG)[SERVER_GROUP_AUTOEXPAND_CONFIG];
if (expandGroups) {
self._tree.expandAll(ConnectionProfileGroup.getSubgroups(root));
}
if (root && !root.hasValidConnections) {
this._treeSelectionHandler.onTreeActionStateChange(true);
self._treeSelectionHandler.onTreeActionStateChange(true);
resolve();
} else {
resolve();