2018-04-29 11:56:46 +00:00
|
|
|
import { Component, OnInit, Inject, AfterContentInit, OnDestroy } from '@angular/core';
|
2018-04-16 06:00:05 +00:00
|
|
|
import { ActivatedRoute, Router } from '@angular/router';
|
2018-04-18 11:28:53 +00:00
|
|
|
import { ConfirmationService } from 'primeng/primeng';
|
|
|
|
import { Store, select } from '@ngrx/store';
|
2018-05-24 06:44:13 +00:00
|
|
|
import { RPCClientError } from '@loafer/ng-rpc';
|
2018-04-18 11:28:53 +00:00
|
|
|
import * as DetailStore from '../../store/detail';
|
2018-05-27 14:17:07 +00:00
|
|
|
// import { sensorSelector } from '../../store';
|
2018-05-02 08:09:39 +00:00
|
|
|
import { Sensor } from '@overflow/commons-typescript/model/sensor';
|
2018-04-29 11:56:46 +00:00
|
|
|
import { Subscription } from 'rxjs/Subscription';
|
2018-04-06 11:02:18 +00:00
|
|
|
|
2018-04-16 06:00:05 +00:00
|
|
|
@Component({
|
|
|
|
selector: 'of-sensor-detail',
|
|
|
|
templateUrl: './detail.component.html',
|
2018-04-18 11:28:53 +00:00
|
|
|
providers: [ConfirmationService]
|
2018-04-16 06:00:05 +00:00
|
|
|
})
|
2018-05-28 03:23:09 +00:00
|
|
|
export class SensorDetailComponent {
|
2018-04-18 11:28:53 +00:00
|
|
|
|
2018-05-27 14:17:07 +00:00
|
|
|
// sensorSubscription$: Subscription;
|
|
|
|
// sensor$ = this.detailStore.pipe(select(sensorSelector.select('sensor')));
|
|
|
|
// sensor: Sensor;
|
|
|
|
// sensorSettingDisplay: boolean;
|
2018-04-06 11:02:18 +00:00
|
|
|
|
2018-05-27 14:17:07 +00:00
|
|
|
// constructor(
|
|
|
|
// private route: ActivatedRoute,
|
|
|
|
// private router: Router,
|
|
|
|
// private confirmationService: ConfirmationService,
|
|
|
|
// private detailStore: Store<DetailStore.State>,
|
|
|
|
// ) {
|
|
|
|
// this.sensorSettingDisplay = false;
|
|
|
|
// }
|
2018-04-06 11:02:18 +00:00
|
|
|
|
2018-05-27 14:17:07 +00:00
|
|
|
// ngOnInit() {
|
|
|
|
// this.sensorSubscription$ = this.sensor$.subscribe(
|
|
|
|
// (sensor: Sensor) => {
|
|
|
|
// console.log(sensor);
|
|
|
|
// this.sensor = sensor;
|
|
|
|
// },
|
|
|
|
// (error: RPCClientError) => {
|
|
|
|
// console.log(error.response.message);
|
|
|
|
// }
|
|
|
|
// );
|
|
|
|
// }
|
2018-04-18 11:28:53 +00:00
|
|
|
|
2018-05-27 14:17:07 +00:00
|
|
|
// ngAfterContentInit() {
|
|
|
|
// const sensorId = this.route.snapshot.paramMap.get('id');
|
|
|
|
// this.detailStore.dispatch(
|
|
|
|
// new DetailStore.Read(
|
|
|
|
// { id: sensorId }
|
|
|
|
// )
|
|
|
|
// );
|
|
|
|
// }
|
2018-04-18 11:28:53 +00:00
|
|
|
|
2018-05-27 14:17:07 +00:00
|
|
|
// ngOnDestroy() {
|
|
|
|
// if (this.sensorSubscription$) {
|
|
|
|
// this.sensorSubscription$.unsubscribe();
|
|
|
|
// }
|
|
|
|
// }
|
2018-04-29 11:56:46 +00:00
|
|
|
|
2018-05-27 14:17:07 +00:00
|
|
|
// onStartOrStop() { }
|
2018-04-18 11:28:53 +00:00
|
|
|
|
2018-05-27 14:17:07 +00:00
|
|
|
// onEdit() {
|
|
|
|
// this.sensorSettingDisplay = true;
|
|
|
|
// }
|
2018-04-18 11:28:53 +00:00
|
|
|
|
2018-05-27 14:17:07 +00:00
|
|
|
// onRemove() {
|
|
|
|
// this.confirmationService.confirm({
|
|
|
|
// header: 'Are you sure to remove this Sensor?',
|
|
|
|
// icon: 'fa fa-trash',
|
|
|
|
// message: 'All the related data will be deleted. ',
|
|
|
|
// accept: () => {
|
|
|
|
// alert('으앙 안돼 지우지마ㅠㅠ');
|
|
|
|
// },
|
|
|
|
// reject: () => {
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// }
|
2018-04-18 12:56:57 +00:00
|
|
|
|
2018-05-27 14:17:07 +00:00
|
|
|
// onTargetClick(target) {
|
|
|
|
// // this.router.navigate(['sensors'], { queryParams: { target: target.id } });
|
|
|
|
// this.router.navigate(['target', target.id, 'info']);
|
|
|
|
// }
|
2018-04-16 06:00:05 +00:00
|
|
|
}
|
2018-04-06 11:02:18 +00:00
|
|
|
|