# HG changeset patch # User casties # Date 1452679987 -3600 # Node ID 80270f5a5735292bfd60c5017eb1b627fc703d12 # Parent 59b7c3afcc6bbd806f0e4145f38be28ee0d47494 more tinkering. diff -r 59b7c3afcc6b -r 80270f5a5735 app/query.service.ts --- a/app/query.service.ts Mon Jan 11 19:25:53 2016 +0100 +++ b/app/query.service.ts Wed Jan 13 11:13:07 2016 +0100 @@ -8,6 +8,8 @@ @Injectable() export class QueryService { + public ismiObjectTypes; + public QUERY_MODES: QueryMode[] = [ {id: 'type_is', label:'Object type is'}, {id: 'att_contains', label: 'Attribute contains'}]; @@ -28,28 +30,27 @@ getIsmiObjectTypes() { var headers = new Headers(); - headers.append('Authorization', 'Basic ' + btoa('neo4j'+':'+'neo5j')); + headers.append('Authorization', 'Basic ' + btoa('neo4j' + ':' + 'neo5j')); headers.append('Content-Type', 'application/json'); headers.append('Accept', 'application/json'); var data = { - 'query': `MATCH (n) + 'query': `MATCH (n) WITH DISTINCT labels(n) AS labels UNWIND labels AS label RETURN DISTINCT label ORDER BY label`, - 'params': {} - }; - - console.debug("http:", this._http, " headers:", headers, " data:", data); - - var post = this._http.post('http://localhost:7474/db/data/cypher/', JSON.stringify(data), {'headers': headers}); - console.debug("post:", post); - var map = post.map(res => res.json()); - console.debug("map:", map); - map.subscribe( - data => console.debug("neo4j data=", data), - err => console.error("neo4j error=", err), - () => console.debug('neo4j query Complete') - ); + 'params': {} + }; + + this._http.post('http://localhost:7474/db/data/cypher/', JSON.stringify(data), {'headers': headers}) + .map(res => res.json()) + .subscribe( + data => { + console.debug("neo4j data=", data); + this.ismiObjectTypes = data.data.map(elem => elem[0]).filter(elem => elem[0] != "_"); + }, + err => console.error("neo4j error=", err), + () => console.debug('neo4j query Complete') + ); } } \ No newline at end of file diff -r 59b7c3afcc6b -r 80270f5a5735 package.json --- a/package.json Mon Jan 11 19:25:53 2016 +0100 +++ b/package.json Wed Jan 13 11:13:07 2016 +0100 @@ -15,7 +15,7 @@ "reflect-metadata": "^0.1.2", "rxjs": "5.0.0-beta.0", "systemjs": "0.19.14", - "zone.js": "0.5.10", + "zone.js": "0.5.10" }, "devDependencies": { "concurrently": "^1.0.0",