-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathlevel-index.component.ts
51 lines (42 loc) · 1.48 KB
/
level-index.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { Component, OnInit } from '@angular/core';
import { Store } from '@ngxs/store';
import { Level } from '@xbim/flex-api';
import { EntityComparer, AddExpands, Expand, SetActive } from '@xbim/flex-webkit';
import { GridColumnDefinition } from '@xbim/grid';
import { NGXLogger } from 'ngx-logger';
import { CommonEntityColumns } from '../../common-columns';
import { LevelIndexState } from './level-state';
@Component({
selector: 'app-level-index',
templateUrl: './level-index.component.html',
styleUrls: ['./level-index.component.scss']
})
export class LevelIndexComponent implements OnInit {
constructor(private store: Store,
private logger: NGXLogger) { }
public floorplanType = "level"
definedColumns: GridColumnDefinition[] = [
...CommonEntityColumns,
{
id: 'Spaces',
title: '# Spaces',
fieldType: 'Badge',
field: '[email protected]',
orderbyField: 'Spaces/$count',
badgeIcon: 'room'
}
// Systems, Type
];
orderedColumns = ['Name', 'Description', 'Model', 'ModelName', 'EntityId', 'DateModified', 'Spaces'];
public stateType = LevelIndexState;
public comparer = new EntityComparer();
ngOnInit() {
this.store.dispatch(new AddExpands(LevelIndexState, [
new Expand('Model', '$select=SegmentName'),
new Expand('Spaces', '$count=true;$select=EntityId;$top=0'),
]));
}
public activateLevel(level: Level) {
this.store.dispatch(new SetActive(LevelIndexState, level.EntityId.toString()));
}
}