mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-09 09:42:34 -05:00
* moving test files and inital refactoring * relayer extension host code * fix imports * make insights work * relayer dashboard * relayer notebooks * moveing more code around * formatting * accept angular as browser * fix serializer * add missing files * remove declarations from extensions * fix build errors * more relayering * change urls to relative to help code relayering * remove layering to prep for merge * fix hygiene errors * fix hygiene errors * fix tests
70 lines
2.2 KiB
TypeScript
70 lines
2.2 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* 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 { IQueryPlanParams, IBootstrapParams } from 'sql/platform/bootstrap/common/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} }`);
|
|
}
|
|
}
|
|
}
|