152 lines
3.9 KiB
TypeScript
Raw Normal View History

2018-04-30 17:12:31 +09:00
import { Component, ViewChild, OnInit, Input, AfterContentInit, OnDestroy } from '@angular/core';
2018-06-01 19:27:27 +09:00
import { Observable, of, Subscription } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
2018-04-30 17:12:31 +09:00
import { Router, ActivatedRoute } from '@angular/router';
2018-05-02 17:25:38 +09:00
import { Sensor } from '@overflow/commons-typescript/model/sensor';
import { Infra } from '@overflow/commons-typescript/model/infra';
2018-04-30 17:12:31 +09:00
import { Store, select } from '@ngrx/store';
2018-06-01 19:27:27 +09:00
2018-05-24 15:44:13 +09:00
import { RPCClientError } from '@loafer/ng-rpc';
2018-05-27 23:17:07 +09:00
// import * as SensorListStore from '@overflow/sensor/store/list';
2018-05-24 15:44:13 +09:00
// import { PageParams, Page } from 'app/commons/model';
2018-05-02 17:25:38 +09:00
import { Target } from '@overflow/commons-typescript/model/target';
2018-04-30 17:12:31 +09:00
2018-04-06 20:02:18 +09:00
2018-04-16 17:28:39 +09:00
@Component({
selector: 'of-target-detail',
templateUrl: './detail.component.html',
})
2018-04-30 17:12:31 +09:00
export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
2018-04-06 20:02:18 +09:00
2018-06-05 20:31:29 +09:00
// infra$: Observable<Infra>;
// infraSubscription$: Subscription;
// sensorsSubscription$: Subscription;
// // sensors$ = this.sensorListStore.pipe(select(sensorListSelector.select('page')));
// target$: Observable<Target>;
//
// infraId = null;
// infra: Infra;
// sensors: Sensor[];
// sensorsCount = 0;
// sensorSettingDisplay = false;
//
// pageSize = '10';
// totalLength = 0;
// currPage = 0;
2018-04-30 17:53:15 +09:00
2018-04-30 17:12:31 +09:00
constructor(
2018-06-05 20:31:29 +09:00
// private router: Router,
// private route: ActivatedRoute,
// private store: Store<any>,
2018-04-30 17:12:31 +09:00
) { }
2018-04-06 20:02:18 +09:00
2018-04-16 17:28:39 +09:00
ngOnInit() {
2018-06-05 20:31:29 +09:00
// this.infraSubscription$ = this.infra$.subscribe(
// (infra: Infra) => {
// this.infra = infra;
// },
// (error: RPCClientError) => {
// console.log(error.response.message);
// }
// );
2018-05-24 15:44:13 +09:00
// this.sensorsSubscription$ = this.sensors$.subscribe(
// (page: Page) => {
// if (page) {
// this.sensorsCount = page.totalElements;
// this.sensors = page.content;
// }
// },
// (error: RPCClientError) => {
// console.log(error.response.message);
// }
// );
2018-04-16 17:28:39 +09:00
}
2018-04-06 20:02:18 +09:00
2018-04-16 17:28:39 +09:00
ngAfterContentInit() {
2018-06-05 20:31:29 +09:00
// this.infraId = this.route.snapshot.paramMap.get('id');
// this.getInfra();
// this.getSensors(this.currPage);
2018-04-16 17:28:39 +09:00
}
2018-04-06 20:02:18 +09:00
2018-04-30 17:12:31 +09:00
ngOnDestroy() {
2018-06-05 20:31:29 +09:00
// if (this.infraSubscription$) {
// this.infraSubscription$.unsubscribe();
// }
2018-04-16 17:28:39 +09:00
}
2018-04-06 20:02:18 +09:00
2018-04-30 17:53:15 +09:00
getInfra() {
2018-06-01 19:27:27 +09:00
// this.infraDetailStore.dispatch(
// new InfraDetailStore.Read(
// { id: this.infraId }
// )
// );
2018-04-30 17:53:15 +09:00
}
getSensors(pageIndex) {
2018-05-24 15:44:13 +09:00
// const pageParams: PageParams = {
// pageNo: pageIndex + '',
// countPerPage: this.pageSize,
// sortCol: 'id',
// sortDirection: 'descending'
// };
// this.sensorListStore.dispatch(
// new SensorListStore.ReadAllByInfra(
// { id: this.infraId, pageParams: pageParams }
// )
// );
2018-04-30 17:53:15 +09:00
}
2018-04-30 17:12:31 +09:00
onAddSensor() {
2018-06-05 20:31:29 +09:00
// this.sensorSettingDisplay = true;
2018-04-16 17:28:39 +09:00
}
2018-04-06 20:02:18 +09:00
2018-04-30 17:12:31 +09:00
onSensorSettingClose() {
2018-06-05 20:31:29 +09:00
// this.sensorSettingDisplay = false;
2018-04-16 17:28:39 +09:00
}
2018-04-30 17:12:31 +09:00
2018-04-30 17:53:15 +09:00
onPaging(e) {
2018-06-05 20:31:29 +09:00
// this.getSensors(e.page);
2018-04-30 19:59:32 +09:00
}
onRowSelect(event) {
2018-06-05 20:31:29 +09:00
// this.router.navigate(['sensor', event.data.id, 'info']);
2018-04-30 19:59:32 +09:00
}
onTraceroute() {
2018-06-05 20:31:29 +09:00
// alert('지원 예정');
2018-04-30 19:59:32 +09:00
}
onDisplayNameChange(value: string) {
2018-06-05 20:31:29 +09:00
// if (value === this.infra.target.displayName) {
// return;
// }
// const target = this.infra.target;
// target.displayName = value;
2018-06-01 19:27:27 +09:00
// this.targetModifyStore.dispatch(
// new TargetModifyStore.Modify(target)
// );
2018-04-30 21:04:58 +09:00
2018-06-05 20:31:29 +09:00
// const modifySuccessSubscription$: Subscription = this.target$.subscribe(
// (t: Target) => {
// if (t) {
// }
// if (modifySuccessSubscription$) {
// modifySuccessSubscription$.unsubscribe();
// }
// },
// (error: RPCClientError) => {
// console.log(error);
// }
// );
2018-04-30 19:59:32 +09:00
}
onDisplayNameChangeKeypress(event, value) {
2018-06-06 19:36:51 +09:00
// if (event.key === 'Enter') {
// this.onDisplayNameChange(value);
// }
2018-04-30 19:59:32 +09:00
}
2018-04-30 17:53:15 +09:00
2018-04-16 17:28:39 +09:00
}