comparison app/query.service.ts @ 25:0795207f3b90

ng2-table now with pager, sorting and styling.
author casties
date Tue, 26 Jan 2016 19:19:23 +0100
parents f6f4177d0a81
children 193271b6b9d2
comparison
equal deleted inserted replaced
24:f6f4177d0a81 25:0795207f3b90
5 //import 'rxjs/add/operator/map'; 5 //import 'rxjs/add/operator/map';
6 6
7 import {QueryMode, QUERY_MODES} from './query-mode'; 7 import {QueryMode, QUERY_MODES} from './query-mode';
8 import {QueryState} from './query-state'; 8 import {QueryState} from './query-state';
9 import {QueryStep} from './query-step'; 9 import {QueryStep} from './query-step';
10 import {ResultColumn} from './result-column';
10 11
11 @Injectable() 12 @Injectable()
12 export class QueryService { 13 export class QueryService {
13 14
14 //public neo4jBaseUrl = 'https://ismi-dev.mpiwg-berlin.mpg.de/neo4j-ismi/db/data'; 15 //public neo4jBaseUrl = 'https://ismi-dev.mpiwg-berlin.mpg.de/neo4j-ismi/db/data';
278 * Return nice column objects 279 * Return nice column objects
279 */ 280 */
280 getColumns(attributes: string[]) { 281 getColumns(attributes: string[]) {
281 var cols = []; 282 var cols = [];
282 if (attributes.indexOf('ismi_id') > -1) { 283 if (attributes.indexOf('ismi_id') > -1) {
283 cols.push({'name': 'ismi_id', 'title': 'ISMI ID'}); 284 cols.push(new ResultColumn('ismi_id', 'ISMI ID'));
284 } 285 }
285 if (attributes.indexOf('label') > -1) { 286 if (attributes.indexOf('label') > -1) {
286 cols.push({'name': 'label', 'title': 'Label'}); 287 cols.push(new ResultColumn('label', 'Label', 'asc'));
287 } 288 }
288 attributes.forEach((att) => { 289 attributes.forEach((att) => {
289 if (att != 'ismi_id' && att != 'label' && att != 'type' && att[0] != '_') { 290 if (att != 'ismi_id' && att != 'label' && att != 'type' && att[0] != '_') {
290 cols.push({'name': att, 'title': att}); 291 cols.push(new ResultColumn(att, att));
291 } 292 }
292 }); 293 });
293 294
294 return cols; 295 return cols;
295 } 296 }