changeset 24:f6f4177d0a81

use ng2-table for results.
author casties
date Tue, 26 Jan 2016 16:54:38 +0100
parents f7a7014abf5c
children 0795207f3b90
files .hgignore app/query-app.component.ts app/query-result-table.component.ts app/query-result.component.ts app/query.service.ts config.js package.json tsconfig.json
diffstat 8 files changed, 373 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Tue Jan 26 16:28:51 2016 +0100
+++ b/.hgignore	Tue Jan 26 16:54:38 2016 +0100
@@ -4,4 +4,6 @@
 syntax: regexp
 ^\.project$
 syntax: regexp
-^jspm_packages$
\ No newline at end of file
+^jspm_packages$
+syntax: regexp
+^\.settings$
\ No newline at end of file
--- a/app/query-app.component.ts	Tue Jan 26 16:28:51 2016 +0100
+++ b/app/query-app.component.ts	Tue Jan 26 16:54:38 2016 +0100
@@ -8,8 +8,8 @@
 import {NormalizationService} from './normalization.service';
 
 import {QuerySelectComponent} from './query-select.component';
-import {QueryResultComponent} from './query-result.component';
-//import {QueryResultTableComponent} from './query-result-table.component';
+//import {QueryResultComponent} from './query-result.component';
+import {QueryResultTableComponent} from './query-result-table.component';
 
 @Component({
     selector: 'query-app',
@@ -23,9 +23,9 @@
           <button (click)="addQueryStep()">add step</button>
           <button (click)="removeQueryStep()">remove step</button>
         </div>
-        <query-result [queryState]="queryState"></query-result>
+        <query-result-table [queryState]="queryState"></query-result-table>
         `,
-    directives: [QuerySelectComponent, QueryResultComponent],
+    directives: [QuerySelectComponent, QueryResultTableComponent],
     providers: [QueryService, NormalizationService, HTTP_PROVIDERS]
 })
     
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/query-result-table.component.ts	Tue Jan 26 16:54:38 2016 +0100
@@ -0,0 +1,39 @@
+import {Component, OnInit} from 'angular2/core';
+
+import {NG_TABLE_DIRECTIVES} from 'ng2-table/ng2-table';
+
+import {QueryState} from './query-state';
+
+@Component({
+    selector: 'query-result-table',
+    template: `
+    <div *ngIf="queryState && queryState.results">
+        <pre>{{queryState.resultCypherQuery}}</pre>
+        <p>Query results ({{queryState.resultInfo}}):</p>
+        <ngTable 
+           (tableChanged)="onChangeTable(config)"
+           [rows]="queryState.results" [columns]="queryState.resultColumns">
+        </ngTable>
+    </div>
+        `,
+    inputs: ['queryState'],
+    directives: [NG_TABLE_DIRECTIVES]
+})
+   
+export class QueryResultTableComponent implements OnInit { 
+    
+    public queryState: QueryState;
+    
+    ngOnChanges() {
+        console.debug("result table changed! queryState=", this.queryState?this.queryState.resultColumns:'');
+    }
+    
+    ngOnInit() {
+        this.setup();
+    }
+    
+    setup() {
+        console.debug("result table init!");
+    }
+    
+}
--- a/app/query-result.component.ts	Tue Jan 26 16:28:51 2016 +0100
+++ b/app/query-result.component.ts	Tue Jan 26 16:54:38 2016 +0100
@@ -13,7 +13,7 @@
           <table>
             <tr>
               <th *ngIf="queryState.resultTypes=='node' && queryState.resultColumns"
-                  *ngFor="#col of queryState.resultColumns">{{col?col.label:col}}</th>
+                  *ngFor="#col of queryState.resultColumns">{{col?col.title:col}}</th>
             </tr>
             <tr class="resultRow" *ngFor="#row of queryState.results"
                 [rowData]="row" [rowType]="queryState.resultTypes"
--- a/app/query.service.ts	Tue Jan 26 16:28:51 2016 +0100
+++ b/app/query.service.ts	Tue Jan 26 16:54:38 2016 +0100
@@ -280,14 +280,14 @@
     getColumns(attributes: string[]) {
         var cols = [];
         if (attributes.indexOf('ismi_id') > -1) {
-            cols.push({'name': 'ismi_id', 'label': 'ISMI ID'});
+            cols.push({'name': 'ismi_id', 'title': 'ISMI ID'});
         }
         if (attributes.indexOf('label') > -1) {
-            cols.push({'name': 'label', 'label': 'Label'});
+            cols.push({'name': 'label', 'title': 'Label'});
         }
         attributes.forEach((att) => {
             if (att != 'ismi_id' && att != 'label' && att != 'type' && att[0] != '_') {
-                cols.push({'name': att, 'label': att});
+                cols.push({'name': att, 'title': att});
             }
         });
            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/config.js	Tue Jan 26 16:54:38 2016 +0100
@@ -0,0 +1,319 @@
+System.config({
+  baseURL: "/",
+  defaultJSExtensions: true,
+  transpiler: "typescript",
+  typescriptOptions: {
+    "module": "commonjs",
+    "emitDecoratorMetadata": true,
+    "tsconfig": true
+  },
+  paths: {
+    "npm:*": "jspm_packages/npm/*",
+    "github:*": "jspm_packages/github/*"
+  },
+
+  packages: {
+    "app": {
+      "main": "boot",
+      "defaultExtension": "ts"
+    }
+  },
+
+  map: {
+    "angular2": "npm:angular2@2.0.0-beta.1",
+    "ng2-table": "npm:ng2-table@1.0.0-beta.0",
+    "plugin-typescript": "github:frankwallis/plugin-typescript@2.5.2",
+    "reflect-metadata": "npm:reflect-metadata@0.1.3",
+    "rxjs": "npm:rxjs@5.0.0-beta.0",
+    "typescript": "npm:typescript@1.7.5",
+    "zone.js": "npm:zone.js@0.5.10",
+    "github:frankwallis/plugin-typescript@2.5.2": {
+      "typescript": "npm:typescript@1.7.5"
+    },
+    "github:jspm/nodelibs-assert@0.1.0": {
+      "assert": "npm:assert@1.3.0"
+    },
+    "github:jspm/nodelibs-buffer@0.1.0": {
+      "buffer": "npm:buffer@3.6.0"
+    },
+    "github:jspm/nodelibs-constants@0.1.0": {
+      "constants-browserify": "npm:constants-browserify@0.0.1"
+    },
+    "github:jspm/nodelibs-crypto@0.1.0": {
+      "crypto-browserify": "npm:crypto-browserify@3.11.0"
+    },
+    "github:jspm/nodelibs-events@0.1.1": {
+      "events": "npm:events@1.0.2"
+    },
+    "github:jspm/nodelibs-path@0.1.0": {
+      "path-browserify": "npm:path-browserify@0.0.0"
+    },
+    "github:jspm/nodelibs-process@0.1.2": {
+      "process": "npm:process@0.11.2"
+    },
+    "github:jspm/nodelibs-stream@0.1.0": {
+      "stream-browserify": "npm:stream-browserify@1.0.0"
+    },
+    "github:jspm/nodelibs-string_decoder@0.1.0": {
+      "string_decoder": "npm:string_decoder@0.10.31"
+    },
+    "github:jspm/nodelibs-util@0.1.0": {
+      "util": "npm:util@0.10.3"
+    },
+    "github:jspm/nodelibs-vm@0.1.0": {
+      "vm-browserify": "npm:vm-browserify@0.0.4"
+    },
+    "npm:angular2@2.0.0-beta.1": {
+      "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+      "es6-promise": "npm:es6-promise@3.0.2",
+      "es6-shim": "npm:es6-shim@0.33.13",
+      "process": "github:jspm/nodelibs-process@0.1.2",
+      "reflect-metadata": "npm:reflect-metadata@0.1.2",
+      "rxjs": "npm:rxjs@5.0.0-beta.0",
+      "zone.js": "npm:zone.js@0.5.10"
+    },
+    "npm:asn1.js@4.3.0": {
+      "assert": "github:jspm/nodelibs-assert@0.1.0",
+      "bn.js": "npm:bn.js@4.8.1",
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "inherits": "npm:inherits@2.0.1",
+      "minimalistic-assert": "npm:minimalistic-assert@1.0.0",
+      "vm": "github:jspm/nodelibs-vm@0.1.0"
+    },
+    "npm:assert@1.3.0": {
+      "util": "npm:util@0.10.3"
+    },
+    "npm:browserify-aes@1.0.6": {
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "buffer-xor": "npm:buffer-xor@1.0.3",
+      "cipher-base": "npm:cipher-base@1.0.2",
+      "create-hash": "npm:create-hash@1.1.2",
+      "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+      "evp_bytestokey": "npm:evp_bytestokey@1.0.0",
+      "fs": "github:jspm/nodelibs-fs@0.1.2",
+      "inherits": "npm:inherits@2.0.1",
+      "systemjs-json": "github:systemjs/plugin-json@0.1.0"
+    },
+    "npm:browserify-cipher@1.0.0": {
+      "browserify-aes": "npm:browserify-aes@1.0.6",
+      "browserify-des": "npm:browserify-des@1.0.0",
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+      "evp_bytestokey": "npm:evp_bytestokey@1.0.0"
+    },
+    "npm:browserify-des@1.0.0": {
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "cipher-base": "npm:cipher-base@1.0.2",
+      "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+      "des.js": "npm:des.js@1.0.0",
+      "inherits": "npm:inherits@2.0.1"
+    },
+    "npm:browserify-rsa@4.0.0": {
+      "bn.js": "npm:bn.js@4.8.1",
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "constants": "github:jspm/nodelibs-constants@0.1.0",
+      "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+      "randombytes": "npm:randombytes@2.0.2"
+    },
+    "npm:browserify-sign@4.0.0": {
+      "bn.js": "npm:bn.js@4.8.1",
+      "browserify-rsa": "npm:browserify-rsa@4.0.0",
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "create-hash": "npm:create-hash@1.1.2",
+      "create-hmac": "npm:create-hmac@1.1.4",
+      "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+      "elliptic": "npm:elliptic@6.2.2",
+      "inherits": "npm:inherits@2.0.1",
+      "parse-asn1": "npm:parse-asn1@5.0.0",
+      "stream": "github:jspm/nodelibs-stream@0.1.0"
+    },
+    "npm:buffer-xor@1.0.3": {
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "systemjs-json": "github:systemjs/plugin-json@0.1.0"
+    },
+    "npm:buffer@3.6.0": {
+      "base64-js": "npm:base64-js@0.0.8",
+      "child_process": "github:jspm/nodelibs-child_process@0.1.0",
+      "fs": "github:jspm/nodelibs-fs@0.1.2",
+      "ieee754": "npm:ieee754@1.1.6",
+      "isarray": "npm:isarray@1.0.0",
+      "process": "github:jspm/nodelibs-process@0.1.2"
+    },
+    "npm:cipher-base@1.0.2": {
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "inherits": "npm:inherits@2.0.1",
+      "stream": "github:jspm/nodelibs-stream@0.1.0",
+      "string_decoder": "github:jspm/nodelibs-string_decoder@0.1.0"
+    },
+    "npm:constants-browserify@0.0.1": {
+      "systemjs-json": "github:systemjs/plugin-json@0.1.0"
+    },
+    "npm:core-util-is@1.0.2": {
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0"
+    },
+    "npm:create-ecdh@4.0.0": {
+      "bn.js": "npm:bn.js@4.8.1",
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+      "elliptic": "npm:elliptic@6.2.2"
+    },
+    "npm:create-hash@1.1.2": {
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "cipher-base": "npm:cipher-base@1.0.2",
+      "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+      "fs": "github:jspm/nodelibs-fs@0.1.2",
+      "inherits": "npm:inherits@2.0.1",
+      "ripemd160": "npm:ripemd160@1.0.1",
+      "sha.js": "npm:sha.js@2.4.4"
+    },
+    "npm:create-hmac@1.1.4": {
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "create-hash": "npm:create-hash@1.1.2",
+      "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+      "inherits": "npm:inherits@2.0.1",
+      "stream": "github:jspm/nodelibs-stream@0.1.0"
+    },
+    "npm:crypto-browserify@3.11.0": {
+      "browserify-cipher": "npm:browserify-cipher@1.0.0",
+      "browserify-sign": "npm:browserify-sign@4.0.0",
+      "create-ecdh": "npm:create-ecdh@4.0.0",
+      "create-hash": "npm:create-hash@1.1.2",
+      "create-hmac": "npm:create-hmac@1.1.4",
+      "diffie-hellman": "npm:diffie-hellman@5.0.1",
+      "inherits": "npm:inherits@2.0.1",
+      "pbkdf2": "npm:pbkdf2@3.0.4",
+      "public-encrypt": "npm:public-encrypt@4.0.0",
+      "randombytes": "npm:randombytes@2.0.2"
+    },
+    "npm:des.js@1.0.0": {
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "inherits": "npm:inherits@2.0.1",
+      "minimalistic-assert": "npm:minimalistic-assert@1.0.0"
+    },
+    "npm:diffie-hellman@5.0.1": {
+      "bn.js": "npm:bn.js@4.8.1",
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+      "miller-rabin": "npm:miller-rabin@4.0.0",
+      "randombytes": "npm:randombytes@2.0.2",
+      "systemjs-json": "github:systemjs/plugin-json@0.1.0"
+    },
+    "npm:elliptic@6.2.2": {
+      "bn.js": "npm:bn.js@4.8.1",
+      "brorand": "npm:brorand@1.0.5",
+      "hash.js": "npm:hash.js@1.0.3",
+      "inherits": "npm:inherits@2.0.1",
+      "systemjs-json": "github:systemjs/plugin-json@0.1.0"
+    },
+    "npm:es6-promise@3.0.2": {
+      "process": "github:jspm/nodelibs-process@0.1.2"
+    },
+    "npm:es6-shim@0.33.13": {
+      "process": "github:jspm/nodelibs-process@0.1.2"
+    },
+    "npm:evp_bytestokey@1.0.0": {
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "create-hash": "npm:create-hash@1.1.2",
+      "crypto": "github:jspm/nodelibs-crypto@0.1.0"
+    },
+    "npm:hash.js@1.0.3": {
+      "inherits": "npm:inherits@2.0.1"
+    },
+    "npm:inherits@2.0.1": {
+      "util": "github:jspm/nodelibs-util@0.1.0"
+    },
+    "npm:miller-rabin@4.0.0": {
+      "bn.js": "npm:bn.js@4.8.1",
+      "brorand": "npm:brorand@1.0.5"
+    },
+    "npm:parse-asn1@5.0.0": {
+      "asn1.js": "npm:asn1.js@4.3.0",
+      "browserify-aes": "npm:browserify-aes@1.0.6",
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "create-hash": "npm:create-hash@1.1.2",
+      "evp_bytestokey": "npm:evp_bytestokey@1.0.0",
+      "pbkdf2": "npm:pbkdf2@3.0.4",
+      "systemjs-json": "github:systemjs/plugin-json@0.1.0"
+    },
+    "npm:path-browserify@0.0.0": {
+      "process": "github:jspm/nodelibs-process@0.1.2"
+    },
+    "npm:pbkdf2@3.0.4": {
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "child_process": "github:jspm/nodelibs-child_process@0.1.0",
+      "create-hmac": "npm:create-hmac@1.1.4",
+      "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+      "path": "github:jspm/nodelibs-path@0.1.0",
+      "process": "github:jspm/nodelibs-process@0.1.2",
+      "systemjs-json": "github:systemjs/plugin-json@0.1.0"
+    },
+    "npm:process@0.11.2": {
+      "assert": "github:jspm/nodelibs-assert@0.1.0"
+    },
+    "npm:public-encrypt@4.0.0": {
+      "bn.js": "npm:bn.js@4.8.1",
+      "browserify-rsa": "npm:browserify-rsa@4.0.0",
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "create-hash": "npm:create-hash@1.1.2",
+      "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+      "parse-asn1": "npm:parse-asn1@5.0.0",
+      "randombytes": "npm:randombytes@2.0.2"
+    },
+    "npm:randombytes@2.0.2": {
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "crypto": "github:jspm/nodelibs-crypto@0.1.0",
+      "process": "github:jspm/nodelibs-process@0.1.2"
+    },
+    "npm:readable-stream@1.1.13": {
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "core-util-is": "npm:core-util-is@1.0.2",
+      "events": "github:jspm/nodelibs-events@0.1.1",
+      "inherits": "npm:inherits@2.0.1",
+      "isarray": "npm:isarray@0.0.1",
+      "process": "github:jspm/nodelibs-process@0.1.2",
+      "stream-browserify": "npm:stream-browserify@1.0.0",
+      "string_decoder": "npm:string_decoder@0.10.31"
+    },
+    "npm:reflect-metadata@0.1.2": {
+      "assert": "github:jspm/nodelibs-assert@0.1.0",
+      "process": "github:jspm/nodelibs-process@0.1.2"
+    },
+    "npm:reflect-metadata@0.1.3": {
+      "assert": "github:jspm/nodelibs-assert@0.1.0",
+      "process": "github:jspm/nodelibs-process@0.1.2"
+    },
+    "npm:ripemd160@1.0.1": {
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "process": "github:jspm/nodelibs-process@0.1.2"
+    },
+    "npm:rxjs@5.0.0-beta.0": {
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "process": "github:jspm/nodelibs-process@0.1.2"
+    },
+    "npm:sha.js@2.4.4": {
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+      "fs": "github:jspm/nodelibs-fs@0.1.2",
+      "inherits": "npm:inherits@2.0.1",
+      "process": "github:jspm/nodelibs-process@0.1.2"
+    },
+    "npm:stream-browserify@1.0.0": {
+      "events": "github:jspm/nodelibs-events@0.1.1",
+      "inherits": "npm:inherits@2.0.1",
+      "readable-stream": "npm:readable-stream@1.1.13"
+    },
+    "npm:string_decoder@0.10.31": {
+      "buffer": "github:jspm/nodelibs-buffer@0.1.0"
+    },
+    "npm:util@0.10.3": {
+      "inherits": "npm:inherits@2.0.1",
+      "process": "github:jspm/nodelibs-process@0.1.2"
+    },
+    "npm:vm-browserify@0.0.4": {
+      "indexof": "npm:indexof@0.0.1"
+    },
+    "npm:zone.js@0.5.10": {
+      "es6-promise": "npm:es6-promise@3.0.2",
+      "process": "github:jspm/nodelibs-process@0.1.2"
+    }
+  }
+});
--- a/package.json	Tue Jan 26 16:28:51 2016 +0100
+++ b/package.json	Tue Jan 26 16:54:38 2016 +0100
@@ -8,6 +8,7 @@
   "jspm": {
     "dependencies": {
       "angular2": "npm:angular2@^2.0.0-beta.1",
+      "ng2-table": "npm:ng2-table@^1.0.0-beta.0",
       "plugin-typescript": "github:frankwallis/plugin-typescript@^2.5.2",
       "reflect-metadata": "npm:reflect-metadata@^0.1.3",
       "rxjs": "npm:rxjs@5.0.0-beta.0",
@@ -17,11 +18,10 @@
       "typescript": "npm:typescript@^1.6.2"
     }
   },
-  "dependencies": {
-    "lite-server": "^1.3.4"
-  },
+  "dependencies": {},
   "devDependencies": {
     "angular2": "^2.0.0-beta.1",
+    "jspm": "0.16.19",
     "rxjs": "5.0.0-beta.0"
   }
 }
--- a/tsconfig.json	Tue Jan 26 16:28:51 2016 +0100
+++ b/tsconfig.json	Tue Jan 26 16:54:38 2016 +0100
@@ -1,7 +1,7 @@
 {
   "compilerOptions": {
     "target": "ES5",
-    "module": "system",
+    "module": "commonjs",
     "sourceMap": true,
     "emitDecoratorMetadata": true,
     "experimentalDecorators": true,