From 7fc812bc761c95e508e1c540393b12b03cdf1d03 Mon Sep 17 00:00:00 2001 From: Alex Tatiyants Date: Sat, 27 Feb 2016 14:38:42 -0800 Subject: add Dot view mode to make large plans easier to view --- app/components/plan-node/plan-node.html | 22 +++++++------ app/components/plan-node/plan-node.ts | 55 +++++++++++++++++++++++++++++++-- app/components/plan-view/plan-view.html | 15 ++++----- app/components/plan-view/plan-view.ts | 6 ++-- 4 files changed, 78 insertions(+), 20 deletions(-) (limited to 'app/components') diff --git a/app/components/plan-node/plan-node.html b/app/components/plan-node/plan-node.html index 5ddf55c..60cdf50 100644 --- a/app/components/plan-node/plan-node.html +++ b/app/components/plan-node/plan-node.html @@ -1,8 +1,11 @@ -
+
+
-

{{node[_planService.NODE_TYPE_PROP] | uppercase}} -

- +

{{getNodeName()}}

+ {{node[_planService.ACTUAL_DURATION_PROP] | duration}}{{node[_planService.ACTUAL_DURATION_PROP] | durationUnit}} | {{executionTimePercent}} % @@ -10,12 +13,12 @@
- -
+
on {{node[_planService.SCHEMA_PROP]}}.{{node[_planService.RELATION_NAME_PROP]}} @@ -33,20 +36,21 @@
on {{node[_planService.HASH_CONDITION_PROP]}}
+
- {{tag}} + {{getTagName(tag)}}
- + {{viewOptions.highlightType}}: {{highlightValue | number:'.0-2'}}
-
+
over estimated rows under estimated rows by {{plannerRowEstimateValue | number}}x diff --git a/app/components/plan-node/plan-node.ts b/app/components/plan-node/plan-node.ts index 0d3c420..52590e8 100644 --- a/app/components/plan-node/plan-node.ts +++ b/app/components/plan-node/plan-node.ts @@ -1,6 +1,6 @@ import {IPlan} from '../../interfaces/iplan'; import {Component, OnInit} from 'angular2/core'; -import {HighlightType, EstimateDirection} from '../../enums'; +import {HighlightType, EstimateDirection, ViewMode} from '../../enums'; import {DurationPipe, DurationUnitPipe} from '../../pipes'; import {PlanService} from '../../services/plan-service'; @@ -23,6 +23,7 @@ export class PlanNode { // consts NORMAL_WIDTH: number = 220; COMPACT_WIDTH: number = 140; + DOT_WIDTH: number = 30; EXPANDED_WIDTH: number = 400; MIN_ESTIMATE_MISS: number = 100; @@ -58,6 +59,7 @@ export class PlanNode { // expose enum to view estimateDirections = EstimateDirection; highlightTypes = HighlightType; + viewModes = ViewMode; constructor(private _planService: PlanService, private _syntaxHighlightService: SyntaxHighlightService, @@ -122,7 +124,17 @@ export class PlanNode { } calculateBar() { - this.barContainerWidth = this.viewOptions.showCompactView ? this.COMPACT_WIDTH : this.NORMAL_WIDTH; + switch (this.viewOptions.viewMode) { + case ViewMode.DOT: + this.barContainerWidth = this.DOT_WIDTH; + break; + case ViewMode.COMPACT: + this.barContainerWidth = this.COMPACT_WIDTH; + break; + default: + this.barContainerWidth = this.NORMAL_WIDTH; + break; + } // expanded view width trumps others if (this.currentExpandedView) { @@ -184,4 +196,43 @@ export class PlanNode { getNodeTypeDescription() { return this._helpService.getNodeTypeDescription(this.node[this._planService.NODE_TYPE_PROP]); } + + getNodeName() { + if (this.viewOptions.viewMode === ViewMode.DOT && !this.showDetails) { + return this.node[this._planService.NODE_TYPE_PROP].replace(/[^A-Z]/g, '').toUpperCase(); + } + + return (this.node[this._planService.NODE_TYPE_PROP]).toUpperCase(); + } + + getTagName(tagName: String) { + if (this.viewOptions.viewMode === ViewMode.DOT && !this.showDetails) { + return tagName.charAt(0); + } + return tagName; + } + + shouldShowPlannerEstimate() { + if (this.viewOptions.showPlannerEstimate && this.showDetails) { + return true; + } + + if (this.viewOptions.viewMode === ViewMode.DOT) { + return false; + } + + return this.viewOptions.showPlannerEstimate; + } + + shouldShowNodeBarLabel() { + if (this.showDetails) { + return true; + } + + if (this.viewOptions.viewMode === ViewMode.DOT) { + return false; + } + + return true; + } } diff --git a/app/components/plan-view/plan-view.html b/app/components/plan-view/plan-view.html index 4ebb70c..70278f4 100644 --- a/app/components/plan-view/plan-view.html +++ b/app/components/plan-view/plan-view.html @@ -9,21 +9,22 @@ - -
  • - - -
  • -
  • -
  • +
  • + +
    + + + +
    +
  • diff --git a/app/components/plan-view/plan-view.ts b/app/components/plan-view/plan-view.ts index 895cccf..9ba8782 100644 --- a/app/components/plan-view/plan-view.ts +++ b/app/components/plan-view/plan-view.ts @@ -2,7 +2,7 @@ import {Component, OnInit} from 'angular2/core'; import {ROUTER_DIRECTIVES, RouteParams} from 'angular2/router'; import {IPlan} from '../../interfaces/iplan'; -import {HighlightType} from '../../enums'; +import {HighlightType, ViewMode} from '../../enums'; import {PlanNode} from '../plan-node/plan-node'; import {PlanService} from '../../services/plan-service'; import {SyntaxHighlightService} from '../../services/syntax-highlight-service'; @@ -26,13 +26,15 @@ export class PlanView { showHighlightBar: true, showPlannerEstimate: false, showTags: true, - highlightType: HighlightType.NONE + highlightType: HighlightType.NONE, + viewMode: ViewMode.FULL }; showPlannerEstimate: boolean = true; showMenu: boolean = false; highlightTypes = HighlightType; // exposing the enum to the view + viewModes = ViewMode; constructor(private _planService: PlanService, routeParams: RouteParams) { this.id = routeParams.get('id'); -- cgit v1.2.3