aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/components/plan-node/plan-node.ts10
-rw-r--r--app/components/plan-view/plan-view.ts4
-rw-r--r--app/enums.ts8
-rw-r--r--app/index.html2
-rw-r--r--app/services/color-service.ts2
-rw-r--r--app/services/help-service.ts28
-rw-r--r--app/services/plan-service.ts22
-rw-r--r--app/services/syntax-highlight-service.ts11
-rw-r--r--tools/config.ts3
-rw-r--r--tools/tasks/build.index.ts1
-rw-r--r--tools/tasks/build.sass.dev.ts3
-rw-r--r--tools/utils/template-injectables.ts1
12 files changed, 47 insertions, 48 deletions
diff --git a/app/components/plan-node/plan-node.ts b/app/components/plan-node/plan-node.ts
index ce5f5db..8e4e261 100644
--- a/app/components/plan-node/plan-node.ts
+++ b/app/components/plan-node/plan-node.ts
@@ -53,8 +53,7 @@ export class PlanNode {
constructor(private _planService: PlanService,
private _syntaxHighlightService: SyntaxHighlightService,
private _helpService: HelpService,
- private _colorService: ColorService)
- { }
+ private _colorService: ColorService) { }
ngOnInit() {
this.currentHighlightType = this.viewOptions.highlightType;
@@ -126,7 +125,10 @@ export class PlanNode {
break;
}
- if (this.width < 1) { this.width = 1 }
+ if (this.width < 1) {
+ this.width = 1;
+ }
+
this.backgroundColor = this._colorService.numberToColorHsl(1 - this.width / nodeWidth);
}
@@ -134,7 +136,7 @@ export class PlanNode {
var dur: number = _.round(this.node[this._planService.ACTUAL_DURATION_PROP]);
// convert duration into approriate units
if (dur < 1) {
- this.duration = "<1";
+ this.duration = '<1';
this.durationUnit = 'ms';
} else if (dur > 1 && dur < 1000) {
this.duration = dur.toString();
diff --git a/app/components/plan-view/plan-view.ts b/app/components/plan-view/plan-view.ts
index 302d8ee..93b3a97 100644
--- a/app/components/plan-view/plan-view.ts
+++ b/app/components/plan-view/plan-view.ts
@@ -55,7 +55,7 @@ export class PlanView {
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
- }
+ };
}
ngOnInit() {
@@ -75,7 +75,7 @@ export class PlanView {
var unit: string = '';
if (originalValue < 1) {
- duration = "<1";
+ duration = '<1';
unit = 'ms';
} else if (originalValue > 1 && originalValue < 1000) {
duration = originalValue.toString();
diff --git a/app/enums.ts b/app/enums.ts
index d7784d8..6d8b387 100644
--- a/app/enums.ts
+++ b/app/enums.ts
@@ -1,8 +1,8 @@
export class HighlightType {
- static NONE: string = "none";
- static DURATION: string = "duration";
- static ROWS: string = "rows";
- static COST: string = "cost";
+ static NONE: string = 'none';
+ static DURATION: string = 'duration';
+ static ROWS: string = 'rows';
+ static COST: string = 'cost';
}
export enum EstimateDirection {
diff --git a/app/index.html b/app/index.html
index bf41f3f..42f7528 100644
--- a/app/index.html
+++ b/app/index.html
@@ -17,8 +17,6 @@
<script>
System.config(<%= JSON.stringify(SYSTEM_CONFIG) %>)
- // window.define = System.amdDefine;
- // window.require = window.requirejs = System.amdRequire;
</script>
<!-- libs:js -->
diff --git a/app/services/color-service.ts b/app/services/color-service.ts
index 37183c0..3116a07 100644
--- a/app/services/color-service.ts
+++ b/app/services/color-service.ts
@@ -15,7 +15,7 @@ export class ColorService {
hslToRgb(h, s, l) {
var r, g, b;
- if (s == 0) {
+ if (s === 0) {
r = g = b = l; // achromatic
} else {
function hue2rgb(p, q, t) {
diff --git a/app/services/help-service.ts b/app/services/help-service.ts
index 0195aff..6067b05 100644
--- a/app/services/help-service.ts
+++ b/app/services/help-service.ts
@@ -7,24 +7,24 @@ export class HelpService {
}
export var NODE_DESCRIPTIONS = {
- "LIMIT":"returns a specified number of rows from a record set.",
- "SORT": "sorts a record set based on the specified sort key.",
- "NESTED LOOP": `merges two record sets by looping through every record in the first set and
+ 'LIMIT':'returns a specified number of rows from a record set.',
+ 'SORT': 'sorts a record set based on the specified sort key.',
+ 'NESTED LOOP': `merges two record sets by looping through every record in the first set and
trying to find a match in the second set. All matching records are returned.`,
- "MERGE JOIN": `merges two record sets by first sorting them on a <strong>join key</strong>.`,
- "HASH": `generates a hash table from the records in the input recordset. Hash is used by
+ 'MERGE JOIN': `merges two record sets by first sorting them on a <strong>join key</strong>.`,
+ 'HASH': `generates a hash table from the records in the input recordset. Hash is used by
<strong>Hash Join</strong>.`,
- "HASH JOIN": `joins to record sets by hashing one of them (using a <strong>Hash Scan</scan>).`,
- "AGGREGATE": `groups records together based on a GROUP BY or aggregate function (like <code>sum()</code>).`,
- "HASHAGGREGATE": `groups records together based on a GROUP BY or aggregate function (like sum()). Hash Aggregate uses
+ 'HASH JOIN': `joins to record sets by hashing one of them (using a <strong>Hash Scan</scan>).`,
+ 'AGGREGATE': `groups records together based on a GROUP BY or aggregate function (like <code>sum()</code>).`,
+ 'HASHAGGREGATE': `groups records together based on a GROUP BY or aggregate function (like sum()). Hash Aggregate uses
a hash to first organize the records by a key.`,
- "SEQ SCAN": `finds relevant records by sequentially scanning the input record set. When reading from a table,
+ 'SEQ SCAN': `finds relevant records by sequentially scanning the input record set. When reading from a table,
Seq Scans (unlike Index Scans) perform a single read operation (only the table is read).`,
- "INDEX SCAN": `finds relevant records based on an <strong>Index</strong>. Index Scans perform 2 read operations: one to
+ 'INDEX SCAN': `finds relevant records based on an <strong>Index</strong>. Index Scans perform 2 read operations: one to
read the index and another to read the actual value from the table.`,
- "INDEX ONLY SCAN": `finds relevant records based on an <strong>Index</strong>. Index Only Scans perform a single read operation
+ 'INDEX ONLY SCAN': `finds relevant records based on an <strong>Index</strong>. Index Only Scans perform a single read operation
from the index and do not read from the corresponding table.`,
- "BITMAP HEAP SCAN": "searches through the pages returned by the <strong>Bitmap Index Scan</strong> for relevant rows.",
- "BITMAP INDEX SCAN": `uses a <strong>Bitmap Index</strong> (index which uses 1 bit per page) to find all relevant pages.
+ 'BITMAP HEAP SCAN': 'searches through the pages returned by the <strong>Bitmap Index Scan</strong> for relevant rows.',
+ 'BITMAP INDEX SCAN': `uses a <strong>Bitmap Index</strong> (index which uses 1 bit per page) to find all relevant pages.
Results of this node are fed to the <strong>Bitmap Heap Scan</strong>.`
-}
+};
diff --git a/app/services/plan-service.ts b/app/services/plan-service.ts
index bf74c38..b5f8102 100644
--- a/app/services/plan-service.ts
+++ b/app/services/plan-service.ts
@@ -1,5 +1,5 @@
import {IPlan} from '../interfaces/iplan';
-import {HighlightType, EstimateDirection} from '../enums';
+import {EstimateDirection} from '../enums';
/// <reference path="moment.d.ts" />
/// <reference path="lodash.d.ts" />
@@ -22,11 +22,11 @@ export class PlanService {
HASH_CONDITION_PROP: string = 'Hash Cond';
// computed by pev
- COMPUTED_TAGS_PROP: string = "*Tags";
+ COMPUTED_TAGS_PROP: string = '*Tags';
- COSTLIEST_NODE_PROP: string = "*Costiest Node (by cost)";
- LARGEST_NODE_PROP: string = "*Largest Node (by rows)";
- SLOWEST_NODE_PROP: string = "*Slowest Node (by duration)";
+ COSTLIEST_NODE_PROP: string = '*Costiest Node (by cost)';
+ LARGEST_NODE_PROP: string = '*Largest Node (by rows)';
+ SLOWEST_NODE_PROP: string = '*Slowest Node (by duration)';
MAXIMUM_COSTS_PROP: string = '*Most Expensive Node (cost)';
MAXIMUM_ROWS_PROP: string = '*Largest Node (rows)';
@@ -38,6 +38,8 @@ export class PlanService {
ARRAY_INDEX_KEY: string = 'arrayIndex';
+ PEV_PLAN_TAG: string = 'plan_';
+
private _maxRows: number = 0;
private _maxCost: number = 0;
private _maxDuration: number = 0;
@@ -46,7 +48,9 @@ export class PlanService {
var plans: Array<IPlan> = [];
for (var i in localStorage) {
- plans.push(JSON.parse(localStorage[i]));
+ if (_.startsWith(i, this.PEV_PLAN_TAG)) {
+ plans.push(JSON.parse(localStorage[i]));
+ }
}
return plans;
@@ -58,7 +62,7 @@ export class PlanService {
createPlan(planName: string, planContent: string, planQuery): IPlan {
var plan: IPlan = {
- id: 'plan_' + new Date().getTime().toString(),
+ id: this.PEV_PLAN_TAG + new Date().getTime().toString(),
name: planName || 'plan created on ' + moment().format('LLL'),
createdOn: new Date(),
content: JSON.parse(planContent)[0],
@@ -99,7 +103,7 @@ export class PlanService {
if (key === this.PLANS_PROP) {
_.each(value, (value) => {
this.processNode(value);
- })
+ });
}
});
}
@@ -136,7 +140,7 @@ export class PlanService {
if (key === this.PLANS_PROP) {
_.each(value, (value) => {
this.findOutlierNodes(value);
- })
+ });
}
});
}
diff --git a/app/services/syntax-highlight-service.ts b/app/services/syntax-highlight-service.ts
index 17f6e61..93ccb99 100644
--- a/app/services/syntax-highlight-service.ts
+++ b/app/services/syntax-highlight-service.ts
@@ -7,9 +7,8 @@ export class SyntaxHighlightService {
highlight(code: string, keyItems: Array<string>) {
hljs.registerLanguage('sql', LANG_SQL);
-
hljs.configure({
- tabReplace: ' ', // 4 spaces
+ tabReplace: ' '
});
// prior to syntax highlighting, we want to tag key items in the raw code. making the
@@ -17,12 +16,12 @@ export class SyntaxHighlightService {
// makes it simpler to find the items we're looing for
var result: string = code.toUpperCase().replace(', ', ',');
_.each(keyItems, (keyItem: string) => {
- result = result.replace(keyItem.toUpperCase(), `${this.OPEN_TAG}${keyItem}${this.CLOSE_TAG}`)
+ result = result.replace(keyItem.toUpperCase(), `${this.OPEN_TAG}${keyItem}${this.CLOSE_TAG}`);
});
result = hljs.highlightAuto(result).value;
- result = result.replace(new RegExp(this.OPEN_TAG, 'g'), "<span class='code-key-item'>")
- result = result.replace(new RegExp(this.CLOSE_TAG, 'g'), "</span>");
+ result = result.replace(new RegExp(this.OPEN_TAG, 'g'), `<span class='code-key-item'>`);
+ result = result.replace(new RegExp(this.CLOSE_TAG, 'g'), '</span>');
return result;
}
@@ -185,4 +184,4 @@ export var LANG_SQL = function(hljs) {
COMMENT_MODE
]
};
-}
+};
diff --git a/tools/config.ts b/tools/config.ts
index 8219423..0b9c613 100644
--- a/tools/config.ts
+++ b/tools/config.ts
@@ -10,7 +10,7 @@ export const LIVE_RELOAD_PORT = argv['reload-port'] || 4002;
export const DOCS_PORT = argv['docs-port'] || 4003;
export const APP_BASE = argv['base'] || '/';
-export const APP_TITLE = 'My Angular2 App';
+export const APP_TITLE = 'Postgres EXPLAIN Visualizer (pev)';
export const APP_SRC = 'app';
export const ASSETS_SRC = `${APP_SRC}/assets`;
@@ -91,7 +91,6 @@ export const SYSTEM_CONFIG_BUILDER = {
}
};
-
// --------------
// Private.
function appVersion(): number | string {
diff --git a/tools/tasks/build.index.ts b/tools/tasks/build.index.ts
index bbf98ee..3c2bec8 100644
--- a/tools/tasks/build.index.ts
+++ b/tools/tasks/build.index.ts
@@ -13,7 +13,6 @@ export = function buildIndexDev(gulp, plugins) {
.pipe(gulp.dest(APP_DEST));
};
-
function inject(name?: string) {
return plugins.inject(gulp.src(getInjectablesDependenciesRef(name), { read: false }), {
name,
diff --git a/tools/tasks/build.sass.dev.ts b/tools/tasks/build.sass.dev.ts
index a2127be..086c306 100644
--- a/tools/tasks/build.sass.dev.ts
+++ b/tools/tasks/build.sass.dev.ts
@@ -12,10 +12,9 @@ export = function buildSassDev(gulp, plugins, option) {
}
}))
.pipe(plugins.compass({
- // config_file: './config.rb',
style: 'compressed',
css: 'app/assets/css',
- sass: join(APP_SRC, 'assets/sass'),
+ sass: join(APP_SRC, 'assets/sass')
}))
.pipe(gulp.dest(join(APP_SRC, 'assets')));
};
diff --git a/tools/utils/template-injectables.ts b/tools/utils/template-injectables.ts
index 83ac315..6d60791 100644
--- a/tools/utils/template-injectables.ts
+++ b/tools/utils/template-injectables.ts
@@ -19,7 +19,6 @@ export function registerInjectableAssetsRef(paths: string[], target: string = ''
export function transformPath(plugins, env) {
return function (filepath) {
filepath = ENV === 'prod' ? filepath.replace(`/${APP_DEST}`, '') : filepath;
- arguments[0] = join(APP_BASE, filepath);
return slash(plugins.inject.transform.apply(plugins.inject.transform, arguments));
};
}