Layer Object Explorer; query plan; task history (#5030)

* relayer query plan, task history, object-explorer

* formatting
This commit is contained in:
Anthony Dresser
2019-04-16 21:12:34 -07:00
committed by GitHub
parent 15a19c044d
commit 2f8519cb6b
93 changed files with 312 additions and 231 deletions

View File

@@ -0,0 +1,70 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/qp';
import { ElementRef, Component, Inject, forwardRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
import * as QP from 'html-query-plan';
import { IBootstrapParams } from 'sql/platform/bootstrap/node/bootstrapService';
import { IQueryPlanParams } from 'sql/platform/bootstrap/node/bootstrapParams';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { registerThemingParticipant, ICssStyleCollector, ITheme } from 'vs/platform/theme/common/themeService';
import * as colors from 'vs/platform/theme/common/colorRegistry';
export const QUERYPLAN_SELECTOR: string = 'queryplan-component';
@Component({
selector: QUERYPLAN_SELECTOR,
template: `
<div #container class="fullsize" style="overflow: scroll">
</div>
`
})
export class QueryPlanComponent implements OnDestroy, OnInit {
private _planXml: string;
private _disposables: Array<IDisposable> = [];
@ViewChild('container', { read: ElementRef }) _container: ElementRef;
constructor(
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef,
@Inject(IBootstrapParams) private _params: IQueryPlanParams
) { }
ngOnDestroy() {
dispose(this._disposables);
}
ngOnInit() {
if (this._params) {
this.planXml = this._params.planXml;
}
this._disposables.push(registerThemingParticipant(this._updateTheme));
}
public set planXml(val: string) {
this._planXml = val;
if (this._planXml) {
QP.showPlan(this._container.nativeElement, this._planXml, {
jsTooltips: false
});
}
}
private _updateTheme(theme: ITheme, collector: ICssStyleCollector) {
let backgroundColor = theme.getColor(colors.editorBackground);
let foregroundColor = theme.getColor(colors.editorForeground);
if (backgroundColor) {
collector.addRule(`div.qp-node, .qp-tt, .qp-root { background-color: ${backgroundColor} }`);
}
if (foregroundColor) {
collector.addRule(`.qp-root { color: ${foregroundColor} }`);
}
}
}