From 7e0665204c5931a8fa47d835a4799030a960c354 Mon Sep 17 00:00:00 2001 From: Alex Tatiyants Date: Fri, 29 Jan 2016 21:21:35 -0800 Subject: add usage hints/disclaimer. close #11, #6 --- app/components/plan-new/plan-new.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'app/components/plan-new') diff --git a/app/components/plan-new/plan-new.html b/app/components/plan-new/plan-new.html index f74529d..f27037d 100644 --- a/app/components/plan-new/plan-new.html +++ b/app/components/plan-new/plan-new.html @@ -1,6 +1,9 @@
- For best results, use EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, FORMAT JSON) - + + + For best results, use EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, FORMAT JSON)
+ Psql users can export the plan to a file using psql -qAt -f explain.sql > analyze.json
+

DISCLAIMER: Pev stores your plans locally (localStorage) and will not send them anywhere.

-- cgit v1.2.3 From 781479ea7f793c8d075caee53f6413a1d2e85307 Mon Sep 17 00:00:00 2001 From: Alex Tatiyants Date: Fri, 29 Jan 2016 21:33:19 -0800 Subject: add plan validation --- app/components/plan-new/plan-new.html | 1 + app/components/plan-new/plan-new.ts | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'app/components/plan-new') diff --git a/app/components/plan-new/plan-new.html b/app/components/plan-new/plan-new.html index f27037d..f150969 100644 --- a/app/components/plan-new/plan-new.html +++ b/app/components/plan-new/plan-new.html @@ -9,6 +9,7 @@
+

{{validationMessage}}

diff --git a/app/components/plan-new/plan-new.ts b/app/components/plan-new/plan-new.ts index 93149e2..115fa82 100644 --- a/app/components/plan-new/plan-new.ts +++ b/app/components/plan-new/plan-new.ts @@ -16,19 +16,28 @@ export class PlanNew { newPlanContent: string; newPlanQuery: string; newPlan: IPlan; + validationMessage: string; - constructor( private _router: Router, private _planService: PlanService) { } + constructor(private _router: Router, private _planService: PlanService) { } submitPlan() { + // remove psql generated header + this.newPlanContent = this.newPlanContent.replace('QUERY PLAN', ''); + + if (!this._planService.isJsonString(this.newPlanContent)) { + this.validationMessage = 'The string you submitted is not valid JSON' + return; + } + this.newPlan = this._planService.createPlan(this.newPlanName, this.newPlanContent, this.newPlanQuery); - this._router.navigate( ['PlanView', { id: this.newPlan.id }] ); + this._router.navigate(['PlanView', { id: this.newPlan.id }]); } prefill() { - this.newPlanName = 'Sample plan'; - this.newPlanContent = SAMPLE_JSON; - this.newPlanQuery = SAMPLE_QUERY; - } + this.newPlanName = 'Sample plan'; + this.newPlanContent = SAMPLE_JSON; + this.newPlanQuery = SAMPLE_QUERY; + } } export var SAMPLE_JSON = `[ { -- cgit v1.2.3 From 9b004d78b5012e4e7a3bf6e1eb086d941050425f Mon Sep 17 00:00:00 2001 From: Alex Tatiyants Date: Sat, 5 Mar 2016 12:02:08 -0800 Subject: tweak styles for new plan page --- app/components/plan-new/plan-new.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/components/plan-new') diff --git a/app/components/plan-new/plan-new.html b/app/components/plan-new/plan-new.html index f150969..42bb8f6 100644 --- a/app/components/plan-new/plan-new.html +++ b/app/components/plan-new/plan-new.html @@ -10,6 +10,6 @@

{{validationMessage}}

- - + + -- cgit v1.2.3