sensor list complete
This commit is contained in:
@@ -53,7 +53,3 @@
|
||||
<p-confirmDialog header="Confirmation" icon="fa ui-icon-warning" width="425"></p-confirmDialog>
|
||||
</div>
|
||||
|
||||
|
||||
<p-dialog [modal]="true" [width]="800" [(visible)]="sensorSettingDisplay" [showHeader]="true" [closeOnEscape]="false">
|
||||
<of-sensor-setting [visible]="sensorSettingDisplay" (close)="onSensorSettingClose()"></of-sensor-setting>
|
||||
</p-dialog>
|
||||
@@ -4,7 +4,7 @@ import { ConfirmationService } from 'primeng/primeng';
|
||||
import { Store, select } from '@ngrx/store';
|
||||
import { RPCClientError } from '@loafer/ng-rpc';
|
||||
import * as DetailStore from '../../store/detail';
|
||||
import { sensorSelector } from '../../store';
|
||||
// import { sensorSelector } from '../../store';
|
||||
import { Sensor } from '@overflow/commons-typescript/model/sensor';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
|
||||
@@ -13,71 +13,71 @@ import { Subscription } from 'rxjs/Subscription';
|
||||
templateUrl: './detail.component.html',
|
||||
providers: [ConfirmationService]
|
||||
})
|
||||
export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||
export class DetailComponent {
|
||||
|
||||
sensorSubscription$: Subscription;
|
||||
sensor$ = this.detailStore.pipe(select(sensorSelector.select('sensor')));
|
||||
sensor: Sensor;
|
||||
sensorSettingDisplay: boolean;
|
||||
// sensorSubscription$: Subscription;
|
||||
// sensor$ = this.detailStore.pipe(select(sensorSelector.select('sensor')));
|
||||
// sensor: Sensor;
|
||||
// sensorSettingDisplay: boolean;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private confirmationService: ConfirmationService,
|
||||
private detailStore: Store<DetailStore.State>,
|
||||
) {
|
||||
this.sensorSettingDisplay = false;
|
||||
}
|
||||
// constructor(
|
||||
// private route: ActivatedRoute,
|
||||
// private router: Router,
|
||||
// private confirmationService: ConfirmationService,
|
||||
// private detailStore: Store<DetailStore.State>,
|
||||
// ) {
|
||||
// this.sensorSettingDisplay = false;
|
||||
// }
|
||||
|
||||
ngOnInit() {
|
||||
this.sensorSubscription$ = this.sensor$.subscribe(
|
||||
(sensor: Sensor) => {
|
||||
console.log(sensor);
|
||||
this.sensor = sensor;
|
||||
},
|
||||
(error: RPCClientError) => {
|
||||
console.log(error.response.message);
|
||||
}
|
||||
);
|
||||
}
|
||||
// ngOnInit() {
|
||||
// this.sensorSubscription$ = this.sensor$.subscribe(
|
||||
// (sensor: Sensor) => {
|
||||
// console.log(sensor);
|
||||
// this.sensor = sensor;
|
||||
// },
|
||||
// (error: RPCClientError) => {
|
||||
// console.log(error.response.message);
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
|
||||
ngAfterContentInit() {
|
||||
const sensorId = this.route.snapshot.paramMap.get('id');
|
||||
this.detailStore.dispatch(
|
||||
new DetailStore.Read(
|
||||
{ id: sensorId }
|
||||
)
|
||||
);
|
||||
}
|
||||
// ngAfterContentInit() {
|
||||
// const sensorId = this.route.snapshot.paramMap.get('id');
|
||||
// this.detailStore.dispatch(
|
||||
// new DetailStore.Read(
|
||||
// { id: sensorId }
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.sensorSubscription$) {
|
||||
this.sensorSubscription$.unsubscribe();
|
||||
}
|
||||
}
|
||||
// ngOnDestroy() {
|
||||
// if (this.sensorSubscription$) {
|
||||
// this.sensorSubscription$.unsubscribe();
|
||||
// }
|
||||
// }
|
||||
|
||||
onStartOrStop() { }
|
||||
// onStartOrStop() { }
|
||||
|
||||
onEdit() {
|
||||
this.sensorSettingDisplay = true;
|
||||
}
|
||||
// onEdit() {
|
||||
// this.sensorSettingDisplay = true;
|
||||
// }
|
||||
|
||||
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: () => {
|
||||
}
|
||||
});
|
||||
}
|
||||
// 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: () => {
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
onTargetClick(target) {
|
||||
// this.router.navigate(['sensors'], { queryParams: { target: target.id } });
|
||||
this.router.navigate(['target', target.id, 'info']);
|
||||
}
|
||||
// onTargetClick(target) {
|
||||
// // this.router.navigate(['sensors'], { queryParams: { target: target.id } });
|
||||
// this.router.navigate(['target', target.id, 'info']);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user