2018-05-02 08:25:38 +00:00
|
|
|
import { Component, OnInit, AfterContentInit, OnDestroy } from '@angular/core';
|
2018-04-16 08:28:39 +00:00
|
|
|
import { Router, ActivatedRoute } from '@angular/router';
|
2018-05-02 08:25:38 +00:00
|
|
|
import { Infra } from '@overflow/commons-typescript/model/infra';
|
|
|
|
import { Probe } from '@overflow/commons-typescript/model/probe';
|
|
|
|
import { Target } from '@overflow/commons-typescript/model/target';
|
2018-06-01 10:27:27 +00:00
|
|
|
|
2018-06-05 11:31:29 +00:00
|
|
|
import { Observable, of, Subscription } from 'rxjs';
|
|
|
|
import { Store, select } from '@ngrx/store';
|
2018-04-16 10:45:10 +00:00
|
|
|
|
2018-04-16 08:28:39 +00:00
|
|
|
@Component({
|
|
|
|
selector: 'of-target-list',
|
|
|
|
templateUrl: './list.component.html',
|
|
|
|
})
|
2018-04-29 11:56:46 +00:00
|
|
|
export class ListComponent implements OnInit, AfterContentInit, OnDestroy {
|
2018-04-16 08:28:39 +00:00
|
|
|
|
2018-06-05 11:31:29 +00:00
|
|
|
// infrasSubscription$: Subscription;
|
|
|
|
// infras$: Observable<Infra[]>;
|
|
|
|
// infras: Infra[];
|
|
|
|
// probe: Probe;
|
|
|
|
// target: Target = null;
|
|
|
|
// sensorSettingDisplay = false;
|
2018-04-16 08:28:39 +00:00
|
|
|
|
2018-04-30 08:12:31 +00:00
|
|
|
pageSize = '10';
|
|
|
|
totalLength = 0;
|
|
|
|
currPage = 0;
|
|
|
|
|
2018-04-16 08:28:39 +00:00
|
|
|
constructor(
|
2018-06-05 11:31:29 +00:00
|
|
|
// private route: ActivatedRoute,
|
|
|
|
// private router: Router,
|
|
|
|
// private store: Store<any>,
|
2018-04-16 08:28:39 +00:00
|
|
|
) {
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
2018-05-24 06:44:13 +00:00
|
|
|
// this.infrasSubscription$ = this.infras$.subscribe(
|
|
|
|
// (page: Page) => {
|
|
|
|
// if (!page) {
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// this.totalLength = page.totalElements;
|
|
|
|
// this.infras = page.content;
|
|
|
|
// },
|
|
|
|
// (error: RPCClientError) => {
|
|
|
|
// console.log(error);
|
|
|
|
// }
|
|
|
|
// );
|
2018-06-05 11:31:29 +00:00
|
|
|
console.log('ddddddddddddddddddddd');
|
2018-04-16 10:45:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ngAfterContentInit() {
|
2018-06-05 11:31:29 +00:00
|
|
|
// this.route.params.subscribe((params: any) => {
|
|
|
|
// this.probe = {
|
|
|
|
// id: params['id'],
|
|
|
|
// };
|
|
|
|
// this.getInfras(0);
|
|
|
|
// });
|
2018-04-16 10:45:10 +00:00
|
|
|
}
|
|
|
|
|
2018-04-29 11:56:46 +00:00
|
|
|
ngOnDestroy() {
|
2018-06-05 11:31:29 +00:00
|
|
|
// if (this.infrasSubscription$) {
|
|
|
|
// this.infrasSubscription$.unsubscribe();
|
|
|
|
// }
|
2018-04-29 11:56:46 +00:00
|
|
|
}
|
|
|
|
|
2018-04-30 08:12:31 +00:00
|
|
|
getInfras(pageNo) {
|
2018-05-24 06:44:13 +00:00
|
|
|
// const pageParams: PageParams = {
|
|
|
|
// pageNo: pageNo + '',
|
|
|
|
// countPerPage: this.pageSize,
|
|
|
|
// sortCol: 'id',
|
|
|
|
// sortDirection: 'descending'
|
|
|
|
// };
|
|
|
|
// this.infraListStore.dispatch(
|
|
|
|
// new InfraListStore.ReadAllByProbe(
|
|
|
|
// { probe: this.probe, pageParams: pageParams }
|
|
|
|
// )
|
|
|
|
// );
|
2018-04-16 08:28:39 +00:00
|
|
|
}
|
|
|
|
|
2018-04-16 10:45:10 +00:00
|
|
|
onRowSelect(event) {
|
2018-04-30 08:12:31 +00:00
|
|
|
// this.router.navigate(['target'], { queryParams: { target: event.data.id } });
|
2018-06-05 11:31:29 +00:00
|
|
|
// this.router.navigate(['target', event.data.id, 'info']);
|
2018-04-16 08:28:39 +00:00
|
|
|
}
|
|
|
|
|
2018-04-16 10:45:10 +00:00
|
|
|
onAddSensor(target: Target) {
|
2018-06-05 11:31:29 +00:00
|
|
|
// this.target = target;
|
|
|
|
// this.sensorSettingDisplay = true;
|
2018-04-16 10:45:10 +00:00
|
|
|
}
|
2018-04-16 08:28:39 +00:00
|
|
|
|
2018-04-16 10:45:10 +00:00
|
|
|
onSensorSettingClose() {
|
2018-06-05 11:31:29 +00:00
|
|
|
// this.sensorSettingDisplay = false;
|
2018-04-16 08:28:39 +00:00
|
|
|
}
|
2018-04-19 10:26:39 +00:00
|
|
|
|
2018-04-30 08:12:31 +00:00
|
|
|
onPaging(e) {
|
2018-06-05 11:31:29 +00:00
|
|
|
// this.getInfras(e.page);
|
2018-04-30 08:12:31 +00:00
|
|
|
}
|
|
|
|
|
2018-04-16 08:28:39 +00:00
|
|
|
}
|