mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 09:35:36 -05:00
Layering of everything else but query (#5085)
* layer profiler and edit data * relayering everything but query * fix css import * readd qp * fix script src * fix hygiene
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ITree, IDataSource } from 'vs/base/parts/tree/browser/tree';
|
||||
import { IModelViewTreeViewDataProvider, ITreeComponentItem } from 'sql/workbench/common/views';
|
||||
import { TreeItemCollapsibleState } from 'vs/workbench/common/views';
|
||||
|
||||
/**
|
||||
* Implements the DataSource(that returns a parent/children of an element) for the recent connection tree
|
||||
*/
|
||||
export class TreeComponentDataSource implements IDataSource {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
constructor(
|
||||
private _dataProvider: IModelViewTreeViewDataProvider) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the unique identifier of the given element.
|
||||
* No more than one element may use a given identifier.
|
||||
*/
|
||||
public getId(tree: ITree, node: ITreeComponentItem): string {
|
||||
return node.handle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean value indicating whether the element has children.
|
||||
*/
|
||||
public hasChildren(tree: ITree, node: ITreeComponentItem): boolean {
|
||||
return this._dataProvider !== undefined && node.collapsibleState !== TreeItemCollapsibleState.None;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the element's children as an array in a promise.
|
||||
*/
|
||||
public getChildren(tree: ITree, node: ITreeComponentItem): Promise<any> {
|
||||
if (this._dataProvider) {
|
||||
if (node && node.handle === '0') {
|
||||
return this._dataProvider.getChildren(undefined);
|
||||
} else {
|
||||
return this._dataProvider.getChildren(node);
|
||||
}
|
||||
}
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
public getParent(tree: ITree, node: any): Promise<any> {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
public shouldAutoexpand(tree: ITree, node: ITreeComponentItem): boolean {
|
||||
return node.collapsibleState === TreeItemCollapsibleState.Expanded;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user