diff --git a/src/packages/sensor/component/list/list.component.html b/src/packages/sensor/component/list/list.component.html
index cd72483..2775fe5 100644
--- a/src/packages/sensor/component/list/list.component.html
+++ b/src/packages/sensor/component/list/list.component.html
@@ -19,7 +19,7 @@
-
+
diff --git a/src/packages/sensor/component/list/list.component.ts b/src/packages/sensor/component/list/list.component.ts
index 40520e8..d231e35 100644
--- a/src/packages/sensor/component/list/list.component.ts
+++ b/src/packages/sensor/component/list/list.component.ts
@@ -4,6 +4,14 @@ import { AfterContentInit } from '@angular/core/src/metadata/lifecycle_hooks';
import { Router } from '@angular/router';
import { Sensor } from '../../model';
+import { Store, select } from '@ngrx/store';
+
+import * as SensorStore from '../../store';
+
+import { RPCError } from 'packages/core/rpc/error';
+import * as ReadAllByDomainStore from '../../store/readallbydomain';
+import { ReadAllByMemberSelector } from '../../store';
+import { Domain } from '../../../domain/model';
@Component({
selector: 'of-sensor-list',
@@ -12,6 +20,8 @@ import { Sensor } from '../../model';
})
export class ListComponent implements OnInit, AfterContentInit {
+ sensorList$ = this.store.pipe(select(ReadAllByMemberSelector.select('sensorList')));
+
displayedColumns = ['crawler', 'type', 'name', 'sensors'];
dataSource: MatTableDataSource;
@ViewChild(MatSort) sort: MatSort;
@@ -22,27 +32,55 @@ export class ListComponent implements OnInit, AfterContentInit {
*/
ngAfterContentInit() {
// temporary data
- const data: Sensor[] = new Array();
- for (let i = 0; i < 3; i++) {
- const t: Sensor = {
- id: i,
- target: {
- id: 1,
- displayName: '192.168.1.1',
- },
- crawler: {
- id: 1,
- name: 'WMI'
- },
- };
- data.push(t);
- }
+ // const data: Sensor[] = new Array();
+ // for (let i = 0; i < 3; i++) {
+ // const t: Sensor = {
+ // id: i,
+ // target: {
+ // id: 1,
+ // displayName: '192.168.1.1',
+ // },
+ // crawler: {
+ // id: 1,
+ // name: 'WMI'
+ // },
+ // };
+ // data.push(t);
+ // }
- this.dataSource = new MatTableDataSource(data);
- this.dataSource.sort = this.sort;
+ this.store.select(ReadAllByMemberSelector.select('domain')).subscribe(
+ (domain: Domain) => {
+ this.store.dispatch(new ReadAllByDomainStore.ReadAllByDomain(domain));
+ },
+ (error) => {
+ console.log(error);
+ }
+ );
+
+ // const domain: Domain = {
+ // id: 1
+ // };
+
+ // this.store.dispatch(new ReadAllByDomainStore.ReadAllByDomain(domain));
+
+ this.sensorList$.subscribe(
+ (probes: Sensor[]) => {
+ console.log(probes);
+ this.dataSource = new MatTableDataSource(probes);
+ this.dataSource.sort = this.sort;
+ },
+ (error: RPCError) => {
+ console.log(error.message);
+ }
+ );
+
+
+ // this.dataSource = new MatTableDataSource(data);
+ // this.dataSource.sort = this.sort;
}
- constructor(private router: Router) { }
+ constructor(private router: Router,
+ private store: Store) { }
ngOnInit() {
}