Removing older show plan from results pane (#18294)

This commit is contained in:
Aasim Khan
2022-02-10 08:31:22 -08:00
committed by GitHub
parent c73791c466
commit 424c6e34a4
3 changed files with 8 additions and 30 deletions

View File

@@ -146,8 +146,8 @@ export class QueryResultsEditor extends EditorPane {
this.resultsView.chartData(dataId);
}
public showQueryPlan(xml: string) {
this.resultsView.showPlan(xml);
public showTopOperation(xml: string) {
this.resultsView.showTopOperations(xml);
}
public registerQueryModelViewTab(title: string, componentId: string): void {

View File

@@ -10,7 +10,6 @@ import QueryRunner from 'sql/workbench/services/query/common/queryRunner';
import { MessagePanel } from 'sql/workbench/contrib/query/browser/messagePanel';
import { GridPanel } from 'sql/workbench/contrib/query/browser/gridPanel';
import { ChartTab } from 'sql/workbench/contrib/charts/browser/chartTab';
import { QueryPlanTab } from 'sql/workbench/contrib/queryPlan/browser/queryPlan';
import { TopOperationsTab } from 'sql/workbench/contrib/queryPlan/browser/topOperations';
import { QueryModelViewTab } from 'sql/workbench/contrib/query/browser/modelViewTab/queryModelViewTab';
import { GridPanelState } from 'sql/workbench/common/editor/query/gridTableState';
@@ -163,7 +162,6 @@ export class QueryResultsView extends Disposable {
private resultsTab: ResultsTab;
private messagesTab: MessagesTab;
private chartTab: ChartTab;
private qpTab: QueryPlanTab;
private qp2Tab: QueryPlan2Tab;
private topOperationsTab: TopOperationsTab;
private dynamicModelViewTabs: QueryModelViewTab[] = [];
@@ -184,7 +182,6 @@ export class QueryResultsView extends Disposable {
this.chartTab = this._register(new ChartTab(instantiationService));
this._panelView = this._register(new TabbedPanel(container, { showHeaderWhenSingleView: true }));
this._register(attachTabbedPanelStyler(this._panelView, themeService));
this.qpTab = this._register(new QueryPlanTab());
this.qp2Tab = this._register(this.instantiationService.createInstance(QueryPlan2Tab));
this.topOperationsTab = this._register(new TopOperationsTab(instantiationService));
@@ -225,7 +222,7 @@ export class QueryResultsView extends Disposable {
this.runnerDisposables.add(Event.once(runner.onResultSet)(() => this.showResults()));
this.hideResults();
this.hideChart();
this.hidePlan();
this.hideTopOperations();
this.hidePlan2();
this.hideDynamicViewModelTabs();
this.input?.state.visibleTabs.clear();
@@ -266,12 +263,6 @@ export class QueryResultsView extends Disposable {
this._panelView.removeTab(this.chartTab.identifier);
}
if (this.input?.state.visibleTabs.has(this.qpTab.identifier) && !this._panelView.contains(this.qpTab)) {
this._panelView.pushTab(this.qpTab);
} else if (!this.input?.state.visibleTabs.has(this.qpTab.identifier) && this._panelView.contains(this.qpTab)) {
this._panelView.removeTab(this.qpTab.identifier);
}
if (this.input?.state.visibleTabs.has(this.qp2Tab.identifier) && !this._panelView.contains(this.qp2Tab)) {
this._panelView.pushTab(this.qp2Tab);
} else if (!this.input?.state.visibleTabs.has(this.qp2Tab.identifier) && this._panelView.contains(this.qp2Tab)) {
@@ -310,7 +301,7 @@ export class QueryResultsView extends Disposable {
this.runnerDisposables.add(runner.onQueryEnd(() => {
if (runner.isQueryPlan) {
runner.planXml.then(e => {
this.showPlan(e);
this.showTopOperations(e);
});
}
}));
@@ -330,12 +321,11 @@ export class QueryResultsView extends Disposable {
this._input = input;
this.runnerDisposables.clear();
[this.resultsTab, this.messagesTab, this.qpTab, this.qp2Tab, this.topOperationsTab, this.chartTab].forEach(t => t.clear());
[this.resultsTab, this.messagesTab, this.qp2Tab, this.topOperationsTab, this.chartTab].forEach(t => t.clear());
this.dynamicModelViewTabs.forEach(t => t.clear());
if (input) {
this.resultsTab.view.state = input.state.gridPanelState;
this.qpTab.view.setState(input.state.queryPlanState);
this.qp2Tab.view.addGraphs(input.state.queryPlan2State.graphs);
this.topOperationsTab.view.setState(input.state.topOperationsState);
this.chartTab.view.state = input.state.chartState;
@@ -376,7 +366,6 @@ export class QueryResultsView extends Disposable {
this.runnerDisposables.clear();
this.resultsTab.clear();
this.messagesTab.clear();
this.qpTab.clear();
this.topOperationsTab.clear();
this.chartTab.clear();
this.dynamicModelViewTabs.forEach(t => t.clear());
@@ -419,18 +408,11 @@ export class QueryResultsView extends Disposable {
this._panelView.showTab(this.resultsTab.identifier);
}
public showPlan(xml: string) {
this.input?.state.visibleTabs.add(this.qpTab.identifier);
if (!this._panelView.contains(this.qpTab)) {
this._panelView.pushTab(this.qpTab);
}
public showTopOperations(xml: string) {
this.input?.state.visibleTabs.add(this.topOperationsTab.identifier);
if (!this._panelView.contains(this.topOperationsTab)) {
this._panelView.pushTab(this.topOperationsTab);
}
this._panelView.showTab(this.qpTab.identifier);
this.qpTab.view.showPlan(xml);
this.topOperationsTab.view.showPlan(xml);
}
@@ -444,11 +426,7 @@ export class QueryResultsView extends Disposable {
}
}
public hidePlan() {
if (this._panelView.contains(this.qpTab)) {
this._panelView.removeTab(this.qpTab.identifier);
}
public hideTopOperations() {
if (this._panelView.contains(this.topOperationsTab)) {
this._panelView.removeTab(this.topOperationsTab.identifier);
}

View File

@@ -17,7 +17,7 @@ import { TableDataView } from 'sql/base/browser/ui/table/tableDataView';
import { TopOperationsState } from 'sql/workbench/common/editor/query/topOperationsState';
const topOperationColumns: Array<Slick.Column<any>> = [
{ name: localize('topOperations.operation', "Operation"), field: 'operation', sortable: true },
{ name: localize('topOperations.operation', "Operation"), field: 'operation', sortable: true, width: 300 },
{ name: localize('topOperations.object', "Object"), field: 'object', sortable: true },
{ name: localize('topOperations.estCost', "Est Cost"), field: 'estCost', sortable: true },
{ name: localize('topOperations.estSubtreeCost', "Est Subtree Cost"), field: 'estSubtreeCost', sortable: true },