Mercurial > hg > ng2-query-ismi
annotate app/query-result.component.ts @ 7:6cd6c09032aa
object type query with results!
author | Robert Casties <casties@mpiwg-berlin.mpg.de> |
---|---|
date | Fri, 15 Jan 2016 20:00:47 +0100 |
parents | b06a5d61afed |
children | 402c7229dc7c |
rev | line source |
---|---|
4 | 1 import {Component, OnInit} from 'angular2/core'; |
2 | |
5
b06a5d61afed
new query state stuff.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
4
diff
changeset
|
3 import {QueryState} from './query-state'; |
b06a5d61afed
new query state stuff.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
4
diff
changeset
|
4 |
7
6cd6c09032aa
object type query with results!
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
5 import {QueryResultRowComponent} from './query-result-row.component'; |
6cd6c09032aa
object type query with results!
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
6 |
4 | 7 @Component({ |
8 selector: 'query-result', | |
9 template: ` | |
5
b06a5d61afed
new query state stuff.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
4
diff
changeset
|
10 <div *ngIf="queryState"> |
7
6cd6c09032aa
object type query with results!
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
11 <p>Cypher: {{queryState.cypherQuery}}</p> |
5
b06a5d61afed
new query state stuff.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
4
diff
changeset
|
12 <p>Query results ({{queryState.numResults}}):</p> |
7
6cd6c09032aa
object type query with results!
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
13 <ul> |
6cd6c09032aa
object type query with results!
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
14 <li *ngFor="#row of queryState.results"> |
6cd6c09032aa
object type query with results!
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
15 <query-result-row [rowData]="row" [rowType]="queryState.resultTypes"></query-result-row> |
6cd6c09032aa
object type query with results!
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
16 </li> |
6cd6c09032aa
object type query with results!
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
17 </ul> |
5
b06a5d61afed
new query state stuff.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
4
diff
changeset
|
18 </div> |
b06a5d61afed
new query state stuff.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
4
diff
changeset
|
19 `, |
7
6cd6c09032aa
object type query with results!
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
20 directives: [QueryResultRowComponent], |
5
b06a5d61afed
new query state stuff.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
4
diff
changeset
|
21 inputs: ['queryState'] |
4 | 22 }) |
23 | |
24 export class QueryResultComponent implements OnInit { | |
25 | |
5
b06a5d61afed
new query state stuff.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
4
diff
changeset
|
26 public queryState: QueryState; |
4 | 27 |
7
6cd6c09032aa
object type query with results!
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
28 ngOnChanges() { |
6cd6c09032aa
object type query with results!
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
29 console.debug("result changed!"); |
6cd6c09032aa
object type query with results!
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
30 } |
6cd6c09032aa
object type query with results!
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
31 |
4 | 32 ngOnInit() { |
33 this.setup(); | |
34 } | |
35 | |
36 setup() { | |
7
6cd6c09032aa
object type query with results!
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
5
diff
changeset
|
37 console.debug("result init!"); |
4 | 38 } |
39 | |
40 } |