Renaming query plan to execution plan (#18551)

This commit is contained in:
Aasim Khan
2022-02-25 00:49:34 -08:00
committed by GitHub
parent 8032f59d41
commit 02341088eb
165 changed files with 373 additions and 350 deletions

View File

@@ -0,0 +1,48 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ExecutionPlanWidgetBase as ExecutionPlanWidgetBase } from 'sql/workbench/contrib/executionPlan/browser/executionPlanWidgetBase';
export class ExecutionPlanWidgetController {
private _executionPlanWidgetMap: Map<string, ExecutionPlanWidgetBase> = new Map();
constructor(private _parentContainer: HTMLElement) {
}
private addWidget(widget: ExecutionPlanWidgetBase) {
if (widget.identifier && !this._executionPlanWidgetMap.has(widget.identifier)) {
this._executionPlanWidgetMap.set(widget.identifier, widget);
if (widget.container) {
widget.container.classList.add('child');
this._parentContainer.appendChild(widget.container);
widget.focus();
}
}
}
public removeWidget(widget: ExecutionPlanWidgetBase) {
if (widget.identifier) {
if (this._executionPlanWidgetMap.has(widget.identifier)) {
this._parentContainer.removeChild(this._executionPlanWidgetMap.get(widget.identifier).container);
this._executionPlanWidgetMap.delete(widget.identifier);
} else {
throw new Error('The view is not present in the container');
}
}
}
/**
* Adds or removes view from the controller.
* @param widget PlanActionView to be added.
*/
public toggleWidget(widget: ExecutionPlanWidgetBase) {
if (!this._executionPlanWidgetMap.has(widget.identifier)) {
this.addWidget(widget);
} else {
this.removeWidget(widget);
}
}
}