mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-22 01:25:38 -05:00
Registers all disposable items for query execution plans (#20851)
This commit is contained in:
@@ -13,6 +13,7 @@ import { ExecutionPlanFileView } from 'sql/workbench/contrib/executionPlan/brows
|
||||
import { ExecutionPlanFileViewCache } from 'sql/workbench/contrib/executionPlan/browser/executionPlanFileViewCache';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { QueryResultsView } from 'sql/workbench/contrib/query/browser/queryResultsView';
|
||||
import { Disposable, dispose } from 'vs/base/common/lifecycle';
|
||||
|
||||
export class ExecutionPlanTab implements IPanelTab {
|
||||
public readonly title = localize('executionPlanTitle', "Query Plan (Preview)");
|
||||
@@ -27,6 +28,7 @@ export class ExecutionPlanTab implements IPanelTab {
|
||||
}
|
||||
|
||||
public dispose() {
|
||||
dispose(this.view);
|
||||
}
|
||||
|
||||
public clear() {
|
||||
@@ -35,7 +37,7 @@ export class ExecutionPlanTab implements IPanelTab {
|
||||
|
||||
}
|
||||
|
||||
export class ExecutionPlanTabView implements IPanelView {
|
||||
export class ExecutionPlanTabView extends Disposable implements IPanelView {
|
||||
private _container: HTMLElement = DOM.$('.execution-plan-tab');
|
||||
private _input: ExecutionPlanState;
|
||||
private _viewCache: ExecutionPlanFileViewCache = ExecutionPlanFileViewCache.getInstance();
|
||||
@@ -45,6 +47,7 @@ export class ExecutionPlanTabView implements IPanelView {
|
||||
private _queryResultsView: QueryResultsView,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
public set state(newInput: ExecutionPlanState) {
|
||||
@@ -63,7 +66,7 @@ export class ExecutionPlanTabView implements IPanelView {
|
||||
} else {
|
||||
// creating a new view for the new input
|
||||
newInput.executionPlanFileViewUUID = generateUuid();
|
||||
newView = this._instantiationService.createInstance(ExecutionPlanFileView, this._queryResultsView);
|
||||
newView = this._register(this._instantiationService.createInstance(ExecutionPlanFileView, this._queryResultsView));
|
||||
newView.onShow(this._container);
|
||||
newView.addGraphs(
|
||||
newInput.graphs
|
||||
@@ -88,7 +91,7 @@ export class ExecutionPlanTabView implements IPanelView {
|
||||
if (currentView) {
|
||||
currentView.onHide(this._container);
|
||||
this._input.graphs = [];
|
||||
currentView = this._instantiationService.createInstance(ExecutionPlanFileView, this._queryResultsView);
|
||||
currentView = this._register(this._instantiationService.createInstance(ExecutionPlanFileView, this._queryResultsView));
|
||||
this._viewCache.executionPlanFileViewMap.set(this._input.executionPlanFileViewUUID, currentView);
|
||||
currentView.render(this._container);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user