mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 09:35:39 -05:00
Add OE node refresh API method (#2578)
* Initial working commit for refreshing OE node via API * Add test and fix up code * Run tsfmt * Fix test
This commit is contained in:
committed by
Karl Burtram
parent
36f7c283b8
commit
05040425df
@@ -72,6 +72,8 @@ export interface IObjectExplorerService {
|
||||
getActiveConnectionNodes(): TreeNode[];
|
||||
|
||||
getTreeNode(connectionId: string, nodePath: string): Thenable<TreeNode>;
|
||||
|
||||
refreshNodeInView(connectionId: string, nodePath: string): Thenable<TreeNode>;
|
||||
}
|
||||
|
||||
interface SessionStatus {
|
||||
@@ -476,6 +478,20 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
return Object.values(this._activeObjectExplorerNodes);
|
||||
}
|
||||
|
||||
public async refreshNodeInView(connectionId: string, nodePath: string): Promise<TreeNode> {
|
||||
// Get the tree node and call refresh from the provider
|
||||
let treeNode = await this.getTreeNode(connectionId, nodePath);
|
||||
await this.refreshTreeNode(treeNode.getSession(), treeNode);
|
||||
|
||||
// Get the new tree node, refresh it in the view, and expand it if needed
|
||||
treeNode = await this.getTreeNode(connectionId, nodePath);
|
||||
await this._serverTreeView.refreshElement(treeNode);
|
||||
if (treeNode.children.length > 0) {
|
||||
await treeNode.setExpandedState(TreeItemCollapsibleState.Expanded);
|
||||
}
|
||||
return treeNode;
|
||||
}
|
||||
|
||||
private async setNodeExpandedState(treeNode: TreeNode, expandedState: TreeItemCollapsibleState): Promise<void> {
|
||||
treeNode = await this.getUpdatedTreeNode(treeNode);
|
||||
let expandNode = this.getTreeItem(treeNode);
|
||||
|
||||
Reference in New Issue
Block a user