aboutsummaryrefslogtreecommitdiff
path: root/app/components/plan-new
diff options
context:
space:
mode:
authorAlex Tatiyants <atatiyan@gmail.com>2016-01-03 17:17:48 -0800
committerAlex Tatiyants <atatiyan@gmail.com>2016-01-03 17:17:48 -0800
commit5310ac7d8eb1838a6297117bc7f9fca70291f46a (patch)
tree28f54b184cb85f04e6d6720dd03258f3728fedde /app/components/plan-new
initial commit
Diffstat (limited to 'app/components/plan-new')
-rw-r--r--app/components/plan-new/plan-new.html18
-rw-r--r--app/components/plan-new/plan-new.ts26
2 files changed, 44 insertions, 0 deletions
diff --git a/app/components/plan-new/plan-new.html b/app/components/plan-new/plan-new.html
new file mode 100644
index 0000000..f9babb6
--- /dev/null
+++ b/app/components/plan-new/plan-new.html
@@ -0,0 +1,18 @@
+<nav>
+ <div class="nav-container">
+ <a [routerLink]="['PlanList']">plans</a>
+ <span class="text-muted"> | </span>
+ create plan
+ </div>
+</nav>
+
+<div class="page">
+ <span class="text-muted">For best results, use EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, FORMAT JSON)</span>
+ <div>
+ <input placeholder="name (optional)" class="input-box input-box-main" type="text" [(ngModel)]="newPlanName">
+ <button class="btn btn-primary btn-lg pull-right" (click)="submitPlan()">submit</button>
+ </div>
+
+ <textarea placeholder="paste execution plan" class="input-box input-box-lg" [(ngModel)]="newPlanContent"></textarea>
+ <textarea placeholder="paste corresponding SQL query" class="input-box input-box-lg" [(ngModel)]="newPlanQuery"></textarea>
+</div>
diff --git a/app/components/plan-new/plan-new.ts b/app/components/plan-new/plan-new.ts
new file mode 100644
index 0000000..4a748ea
--- /dev/null
+++ b/app/components/plan-new/plan-new.ts
@@ -0,0 +1,26 @@
+import {Component, OnInit} from 'angular2/core';
+import {Router, ROUTER_DIRECTIVES} from 'angular2/router';
+import {IPlan} from '../../interfaces/iplan';
+
+import {PlanService} from '../../services/plan-service';
+
+@Component({
+ selector: 'plan-new',
+ templateUrl: './components/plan-new/plan-new.html',
+ providers: [PlanService],
+ directives: [ROUTER_DIRECTIVES]
+})
+export class PlanNew {
+ planIds: string[];
+ newPlanName: string;
+ newPlanContent: string;
+ newPlanQuery: string;
+ newPlan: IPlan;
+
+ constructor( private _router: Router, private _planService: PlanService) { }
+
+ submitPlan() {
+ this.newPlan = this._planService.createPlan(this.newPlanName, this.newPlanContent, this.newPlanQuery);
+ this._router.navigate( ['PlanView', { id: this.newPlan.id }] );
+ }
+}