From d89ddcf3532937d395898f255c42f3d26303f1c4 Mon Sep 17 00:00:00 2001 From: Alex Tatiyants Date: Mon, 4 Jan 2016 19:42:44 -0800 Subject: add integrated query view with syntax highlighting --- app/components/plan-view/plan-view.html | 18 +++++++++--------- app/components/plan-view/plan-view.ts | 28 +++++++++++++--------------- 2 files changed, 22 insertions(+), 24 deletions(-) (limited to 'app/components/plan-view') diff --git a/app/components/plan-view/plan-view.html b/app/components/plan-view/plan-view.html index 8ebe525..c63c4d1 100644 --- a/app/components/plan-view/plan-view.html +++ b/app/components/plan-view/plan-view.html @@ -39,20 +39,20 @@ {{executionTime}} execution time ({{executionTimeUnit}}) -
- {{planStats.planningTime | number:'.0-2'}} +
+ {{plan.planStats.planningTime | number:'.0-2'}} planning time (ms)
-
- {{planStats.maxDuration | number:'.0-2'}} +
+ {{plan.planStats.maxDuration | number:'.0-2'}} slowest node (ms)
-
- {{planStats.maxRows | number:'.0-2'}} +
+ {{plan.planStats.maxRows | number:'.0-2'}} largest node (rows)
-
- {{planStats.maxCost | number:'.0-2'}} +
+ {{plan.planStats.maxCost | number:'.0-2'}} costliest node
@@ -60,7 +60,7 @@
  • - +
diff --git a/app/components/plan-view/plan-view.ts b/app/components/plan-view/plan-view.ts index 1ec3855..e1700ba 100644 --- a/app/components/plan-view/plan-view.ts +++ b/app/components/plan-view/plan-view.ts @@ -2,15 +2,16 @@ import {Component, OnInit} from 'angular2/core'; import {ROUTER_DIRECTIVES, RouteParams} from 'angular2/router'; import {IPlan} from '../../interfaces/iplan'; -import {PlanService} from '../../services/plan-service'; import {HighlightType} from '../../enums'; import {PlanNode} from '../plan-node/plan-node'; +import {PlanService} from '../../services/plan-service'; +import {SyntaxHighlightService} from '../../services/syntax-highlight-service'; @Component({ selector: 'plan-view', templateUrl: './components/plan-view/plan-view.html', directives: [ROUTER_DIRECTIVES, PlanNode], - providers: [PlanService] + providers: [PlanService, SyntaxHighlightService] }) export class PlanView { id: string; @@ -20,13 +21,6 @@ export class PlanView { executionTimeUnit: string; hideMenu: boolean = true; - planStats: any = { - executionTime: 0, - maxRows: 0, - maxCost: 0, - maxDuration: 0 - }; - viewOptions: any = { showPlanStats: true, showHighlightBar: true, @@ -40,7 +34,7 @@ export class PlanView { highlightTypes = HighlightType; // exposing the enum to the view - constructor(private _planService: PlanService, routeParams: RouteParams) { + constructor(private _planService: PlanService, routeParams: RouteParams, private _syntaxHighlightService: SyntaxHighlightService) { this.id = routeParams.get('id'); } @@ -55,13 +49,17 @@ export class PlanView { var executionTime: number = this.rootContainer['Execution Time'] || this.rootContainer['Total Runtime']; [this.executionTime, this.executionTimeUnit] = this.calculateDuration(executionTime); - this.planStats = { + this.plan.planStats = { executionTime: executionTime, - planningTime: this.rootContainer['Planning Time'], - maxRows: this.rootContainer[this._planService.MAXIMUM_ROWS_PROP], - maxCost: this.rootContainer[this._planService.MAXIMUM_COSTS_PROP], - maxDuration: this.rootContainer[this._planService.MAXIMUM_DURATION_PROP] + planningTime: this.rootContainer['Planning Time'] || 0, + maxRows: this.rootContainer[this._planService.MAXIMUM_ROWS_PROP] || 0, + maxCost: this.rootContainer[this._planService.MAXIMUM_COSTS_PROP] || 0, + maxDuration: this.rootContainer[this._planService.MAXIMUM_DURATION_PROP] || 0 } + + // get syntax highlighted query + this._syntaxHighlightService.init(); + this.plan.formattedQuery = this._syntaxHighlightService.highlight(this.plan.query); } ngOnInit() { -- cgit v1.2.3