changeset 27:c2946b7135cd

working on larger results.
author casties
date Wed, 27 Jan 2016 15:38:17 +0100
parents 991bf349bb04
children 1ceea716600f
files app/query-app.component.ts app/query-result-table.component.ts app/query-result.component.ts
diffstat 3 files changed, 16 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/app/query-app.component.ts	Wed Jan 27 13:30:38 2016 +0100
+++ b/app/query-app.component.ts	Wed Jan 27 15:38:17 2016 +0100
@@ -27,11 +27,11 @@
           <button (click)="removeQueryStep()">remove step</button>
         </div>
     </div>
-    <div class="container">    
-        <query-result-table *ngIf="queryState && queryState.results"
-            [queryState]="queryState"
-            [data]="queryState.results" [columns]="queryState.resultColumns">
-        </query-result-table>
+    <div class="container">
+        <query-result *ngIf="queryState && queryState.results"
+            [resultInfo]="queryState.resultInfo"
+            [queryState]="queryState">
+        </query-result>
     </div>
         `,
     directives: [QuerySelectComponent, QueryResultTableComponent],
--- a/app/query-result-table.component.ts	Wed Jan 27 13:30:38 2016 +0100
+++ b/app/query-result-table.component.ts	Wed Jan 27 15:38:17 2016 +0100
@@ -6,13 +6,14 @@
 import {QueryState} from './query-state';
 
 @Component({
-    selector: 'query-result-table',
+    selector: 'query-result',
     template: `
     <div *ngIf="queryState && queryState.results">
         <span>Cypher query:</span>
         <pre>{{queryState.resultCypherQuery}}</pre>
         <h2>Query result</h2>
-        <pre *ngIf="config.paging">{{queryState.resultInfo}}: page {{page}} of {{numPages}}</pre>
+        <pre>{{resultInfo}}</pre>
+        <span *ngIf="config.paging">page {{page}} of {{numPages}}</span>
         <pagination *ngIf="config.paging"
                     class="pagination-sm"
                     [(ngModel)]="page"
@@ -24,19 +25,22 @@
                     (pageChanged)="onChangeTable(config, $event)"
                     (numPages)="numPages = $event">
         </pagination>
-        <ngTable [config]="config.sorting"
+        <ngTable *ngIf="false"
+                 [config]="config.sorting"
                  (tableChanged)="onChangeTable(config)"
                  [rows]="rows" [columns]="columns">
         </ngTable>
     </div>
         `,
-    inputs: ['queryState', 'data', 'columns'],
+    inputs: ['queryState', 'resultInfo'],
     directives: [NG_TABLE_DIRECTIVES, PAGINATION_DIRECTIVES]
 })
    
 export class QueryResultTableComponent implements OnInit { 
     
     public queryState: QueryState;
+    public resultInfo: string;
+    
     public data: Array<any>;
     public columns: Array<any>;
     
@@ -56,6 +60,8 @@
     
     ngOnChanges() {
         console.debug("result table changed! queryState=", this.queryState?this.queryState.resultColumns:'');
+        this.data = this.queryState.results;
+        this.columns = this.queryState.resultColumns;
         this.config.sorting = this.queryState.resultColumns;
         this.onChangeTable(this.config, null);
     }
@@ -71,7 +77,6 @@
       }
 
     changeSort(data: any, config: any) {
-        console.debug("changeSort start");
         if (!config.sorting) {
             return data;
         }
@@ -89,7 +94,6 @@
             }
             return 0;
         });
-        console.debug("changeSort done");
         return sorted;
     }
 
--- a/app/query-result.component.ts	Wed Jan 27 13:30:38 2016 +0100
+++ b/app/query-result.component.ts	Wed Jan 27 15:38:17 2016 +0100
@@ -8,6 +8,7 @@
     selector: 'query-result',
     template: `
         <div *ngIf="queryState">
+          <span>Cypher query:</span>
           <pre>{{queryState.resultCypherQuery}}</pre>
           <p>Query results ({{queryState.resultInfo}}):</p>
           <table>