Skip to content

Commit 6fbdf4a

Browse files
committed
Advised indexes and statistics
1 parent 732d7d1 commit 6fbdf4a

File tree

5 files changed

+447
-159
lines changed

5 files changed

+447
-159
lines changed

package.json

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@
184184
{
185185
"type": "tree",
186186
"id": "vscode-db2i.dove.node",
187-
"name": "Node Detail",
187+
"name": "Visual Explain Details",
188188
"when": "vscode-db2i:explainingNode == true"
189189
}
190190
],
@@ -460,16 +460,28 @@
460460
},
461461
{
462462
"command": "vscode-db2i.dove.close",
463-
"title": "Close detail",
463+
"title": "Close",
464464
"category": "Db2 for i",
465-
"icon": "$(close-all)"
465+
"icon": "$(close)"
466466
},
467467
{
468-
"command": "vscode-db2i.dove.nodeDetail",
469-
"title": "See detail",
468+
"command": "vscode-db2i.dove.displayDetails",
469+
"title": "Display details",
470470
"category": "Db2 for i",
471471
"icon": "$(info)"
472472
},
473+
{
474+
"command": "vscode-db2i.dove.closeDetails",
475+
"title": "Close",
476+
"category": "Db2 for i",
477+
"icon": "$(close)"
478+
},
479+
{
480+
"command": "vscode-db2i.dove.advisedIndexesAndStatistics",
481+
"title": "Advised Indexes and Statistics",
482+
"category": "Db2 for i",
483+
"icon": "$(lightbulb)"
484+
},
473485
{
474486
"command": "vscode-db2i.dove.editSettings",
475487
"title": "Settings",
@@ -545,9 +557,13 @@
545557
"when": "never"
546558
},
547559
{
548-
"command": "vscode-db2i.dove.nodeDetail",
560+
"command": "vscode-db2i.dove.displayDetails",
549561
"when": "never"
550562
},
563+
{
564+
"command": "vscode-db2i.dove.advisedIndexesAndStatistics",
565+
"when": "vscode-db2i:explaining == true"
566+
},
551567
{
552568
"command": "vscode-db2i.dove.editSettings",
553569
"when": "vscode-db2i:explaining == true"
@@ -629,20 +645,30 @@
629645
"group": "navigation",
630646
"when": "view == jobManager"
631647
},
648+
{
649+
"command": "vscode-db2i.dove.advisedIndexesAndStatistics",
650+
"group": "navigation@0",
651+
"when": "view == vscode-db2i.dove.nodes"
652+
},
632653
{
633654
"command": "vscode-db2i.dove.editSettings",
634-
"group": "navigation",
655+
"group": "navigation@1",
635656
"when": "view == vscode-db2i.dove.nodes"
636657
},
637658
{
638659
"command": "vscode-db2i.dove.export",
639-
"group": "navigation",
660+
"group": "navigation@2",
640661
"when": "view == vscode-db2i.dove.nodes"
641662
},
642663
{
643664
"command": "vscode-db2i.dove.close",
644-
"group": "navigation",
665+
"group": "navigation@3",
645666
"when": "view == vscode-db2i.dove.nodes"
667+
},
668+
{
669+
"command": "vscode-db2i.dove.closeDetails",
670+
"group": "navigation@1",
671+
"when": "view == vscode-db2i.dove.node"
646672
}
647673
],
648674
"view/item/context": [
@@ -772,7 +798,7 @@
772798
"group": "inline"
773799
},
774800
{
775-
"command": "vscode-db2i.dove.nodeDetail",
801+
"command": "vscode-db2i.dove.displayDetails",
776802
"when": "view == vscode-db2i.dove.nodes && viewItem == explainTreeItem",
777803
"group": "inline"
778804
}

src/views/results/explain/doveNodeView.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@ export class DoveNodeView implements TreeDataProvider<any> {
1414

1515
private treeView: TreeView<PropertyNode>;
1616

17+
private defaultTitle: string;
1718
constructor() {
1819
this.treeView = vscode.window.createTreeView(`vscode-db2i.dove.node`, { treeDataProvider: this, showCollapseAll: true });
20+
this.defaultTitle = this.treeView.title;
1921
}
2022

2123
public getTreeView(): TreeView<PropertyNode> {
2224
return this.treeView;
2325
}
2426

25-
setNode(currentNode: ExplainNode) {
27+
setNode(currentNode: ExplainNode, title?: string) {
28+
this.treeView.title = title || this.defaultTitle;
2629
this.propertyNodes = [];
2730
let currentSection: PropertySection = null;
2831
for (let property of currentNode.props) {

src/views/results/explain/doveResultsView.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ export class DoveResultsView implements TreeDataProvider<any> {
6969
return this.treeView;
7070
}
7171

72-
7372
setRootNode(topNode: ExplainNode): ExplainTreeItem {
7473
this.topNode = new ExplainTreeItem(topNode);
7574
this._onDidChangeTreeData.fire();
@@ -80,12 +79,15 @@ export class DoveResultsView implements TreeDataProvider<any> {
8079
this.treeView.reveal(this.topNode, { select: false });
8180
return this.topNode;
8281
}
82+
getRootNode(): ExplainTreeItem {
83+
return this.topNode;
84+
}
8385

84-
getRootExplainNode() {
86+
getRootExplainNode(): ExplainNode {
8587
return this.topNode.explainNode;
8688
}
8789

88-
close() {
90+
close(): void {
8991
commands.executeCommand(`setContext`, `vscode-db2i:explaining`, false);
9092
}
9193

@@ -106,18 +108,18 @@ export class DoveResultsView implements TreeDataProvider<any> {
106108
getParent?(element: any) {
107109
throw new Error("Method not implemented.");
108110
}
111+
109112
resolveTreeItem?(item: TreeItem, element: any, token: CancellationToken): ProviderResult<ExplainTreeItem> {
110113
throw new Error("Method not implemented.");
111114
}
112115
}
113116

114117
export class ExplainTreeItem extends TreeItem {
115-
children: ExplainTreeItem[];
116118
explainNode: ExplainNode;
119+
private children: ExplainTreeItem[];
117120

118121
constructor(node: ExplainNode) {
119122
super(node.title, node.childrenNodes > 0 ? TreeItemCollapsibleState.Expanded : TreeItemCollapsibleState.None);
120-
121123
this.explainNode = node;
122124
this.contextValue = `explainTreeItem`;
123125

@@ -132,8 +134,10 @@ export class ExplainTreeItem extends TreeItem {
132134
this.iconPath = new ThemeIcon(icons[node.title] || `server-process`, node.highlights.getPriorityColor()); // `circle-outline`
133135
}
134136

135-
getChildren() {
136-
return this.explainNode.children.map(c => new ExplainTreeItem(c));
137+
getChildren(): ExplainTreeItem[] {
138+
if (!this.children) {
139+
this.children = this.explainNode.children.map(c => new ExplainTreeItem(c));
140+
}
141+
return this.children;
137142
}
138-
}
139-
143+
}

0 commit comments

Comments
 (0)