Handle maintaining tab state properly (#5776)

* handle maintaining tab state properly

* some code cleanup
This commit is contained in:
Anthony Dresser
2019-05-31 10:13:19 -07:00
committed by GitHub
parent d7df71c8ba
commit 6b76611c93

View File

@@ -182,12 +182,10 @@ export class QueryResultsView extends Disposable {
this.messagesTab = this._register(new MessagesTab(instantiationService)); this.messagesTab = this._register(new MessagesTab(instantiationService));
this.chartTab = this._register(new ChartTab(instantiationService)); this.chartTab = this._register(new ChartTab(instantiationService));
this._panelView = this._register(new TabbedPanel(container, { showHeaderWhenSingleView: false })); this._panelView = this._register(new TabbedPanel(container, { showHeaderWhenSingleView: false }));
attachTabbedPanelStyler(this._panelView, themeService); this._register(attachTabbedPanelStyler(this._panelView, themeService));
this.qpTab = this._register(new QueryPlanTab()); this.qpTab = this._register(new QueryPlanTab());
this.topOperationsTab = this._register(new TopOperationsTab(instantiationService)); this.topOperationsTab = this._register(new TopOperationsTab(instantiationService));
attachTabbedPanelStyler(this._panelView, themeService);
this._panelView.pushTab(this.resultsTab); this._panelView.pushTab(this.resultsTab);
this._panelView.pushTab(this.messagesTab); this._panelView.pushTab(this.messagesTab);
this._register(this._panelView.onTabChange(e => { this._register(this._panelView.onTabChange(e => {
@@ -197,9 +195,6 @@ export class QueryResultsView extends Disposable {
})); }));
} }
public style() {
}
private setQueryRunner(runner: QueryRunner) { private setQueryRunner(runner: QueryRunner) {
this.resultsTab.queryRunner = runner; this.resultsTab.queryRunner = runner;
this.messagesTab.queryRunner = runner; this.messagesTab.queryRunner = runner;
@@ -211,20 +206,22 @@ export class QueryResultsView extends Disposable {
this.input.state.visibleTabs = new Set(); this.input.state.visibleTabs = new Set();
this.input.state.activeTab = this.resultsTab.identifier; this.input.state.activeTab = this.resultsTab.identifier;
})); }));
if (this.input.state.visibleTabs.has(this.chartTab.identifier)) { if (this.input.state.visibleTabs.has(this.chartTab.identifier) && !this._panelView.contains(this.chartTab)) {
if (!this._panelView.contains(this.chartTab)) { this._panelView.pushTab(this.chartTab);
this._panelView.pushTab(this.chartTab); } else if (!this.input.state.visibleTabs.has(this.chartTab.identifier) && this._panelView.contains(this.chartTab)) {
} this._panelView.removeTab(this.chartTab.identifier);
} }
if (this.input.state.visibleTabs.has(this.qpTab.identifier)) {
if (!this._panelView.contains(this.qpTab)) { if (this.input.state.visibleTabs.has(this.qpTab.identifier) && !this._panelView.contains(this.qpTab)) {
this._panelView.pushTab(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.topOperationsTab.identifier)) {
if (!this._panelView.contains(this.topOperationsTab)) { if (this.input.state.visibleTabs.has(this.topOperationsTab.identifier) && !this._panelView.contains(this.topOperationsTab)) {
this._panelView.pushTab(this.topOperationsTab); this._panelView.pushTab(this.topOperationsTab);
} } else if (!this.input.state.visibleTabs.has(this.topOperationsTab.identifier) && this._panelView.contains(this.topOperationsTab)) {
this._panelView.removeTab(this.topOperationsTab.identifier);
} }
// restore query model view tabs // restore query model view tabs