Add ability to scroll horizontally in the server table (#9308)

* add to scroll horizontally in the server table

* respect workbench tree settings for connections
This commit is contained in:
Aditya Bist
2020-03-18 12:20:07 -07:00
committed by GitHub
parent ae1f3df490
commit a884f6a39d
2 changed files with 8 additions and 3 deletions

View File

@@ -37,6 +37,7 @@ import { isHidden } from 'sql/base/browser/dom';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { startsWith } from 'vs/base/common/strings';
import { SERVER_GROUP_CONFIG } from 'sql/workbench/services/serverGroup/common/interfaces';
import { horizontalScrollingKey } from 'vs/platform/list/browser/listService';
/**
* ServerTreeview implements the dynamic tree view.
@@ -140,7 +141,9 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
this._connectionManagementService.showConnectionDialog();
}));
}
this._tree = this._register(TreeCreationUtils.createRegisteredServersTree(container, this._instantiationService));
const horizontalScrollEnabled: boolean = this._configurationService.getValue(horizontalScrollingKey) || false;
this._tree = this._register(TreeCreationUtils.createRegisteredServersTree(container, this._instantiationService, horizontalScrollEnabled));
//this._tree.setInput(undefined);
this._register(this._tree.onDidChangeSelection((event) => this.onSelected(event)));
this._register(this._tree.onDidBlur(() => this._onSelectionOrFocusChange.fire()));

View File

@@ -14,6 +14,7 @@ import { DefaultFilter, DefaultAccessibilityProvider, DefaultController } from '
import { IController } from 'vs/base/parts/tree/browser/tree';
import { ServerTreeDragAndDrop, RecentConnectionsDragAndDrop } from 'sql/workbench/services/objectExplorer/browser/dragAndDropController';
import { RecentConnectionDataSource } from 'sql/workbench/services/objectExplorer/browser/recentConnectionDataSource';
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
export class TreeCreationUtils {
/**
@@ -39,7 +40,7 @@ export class TreeCreationUtils {
/**
* Create a Servers viewlet tree
*/
public static createRegisteredServersTree(treeContainer: HTMLElement, instantiationService: IInstantiationService): Tree {
public static createRegisteredServersTree(treeContainer: HTMLElement, instantiationService: IInstantiationService, horizontalScrollMode: boolean = false): Tree {
const dataSource = instantiationService.createInstance(ServerTreeDataSource);
const actionProvider = instantiationService.createInstance(ServerTreeActionProvider);
@@ -54,7 +55,8 @@ export class TreeCreationUtils {
{
indentPixels: 10,
twistiePixels: 20,
ariaLabel: nls.localize('treeCreation.regTreeAriaLabel', "Servers")
ariaLabel: nls.localize('treeCreation.regTreeAriaLabel', "Servers"),
horizontalScrollMode: horizontalScrollMode ? ScrollbarVisibility.Auto : ScrollbarVisibility.Hidden
});
}
}