This commit is contained in:
crusader
2018-06-01 19:27:27 +09:00
parent f290f5bdb1
commit fd369d3519
75 changed files with 77 additions and 1718 deletions

View File

@@ -1,16 +1,15 @@
import { Component, ViewChild, OnInit, Input, AfterContentInit, OnDestroy } from '@angular/core';
import { Observable, of, Subscription } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { Router, ActivatedRoute } from '@angular/router';
import { Sensor } from '@overflow/commons-typescript/model/sensor';
import { Infra } from '@overflow/commons-typescript/model/infra';
import { Store, select } from '@ngrx/store';
import { DetailSelector as InfraDetailSelector } from '@overflow/infra/store';
import * as InfraDetailStore from '@overflow/infra/store/detail';
import { Subscription } from 'rxjs/Subscription';
import { RPCClientError } from '@loafer/ng-rpc';
// import * as SensorListStore from '@overflow/sensor/store/list';
// import { PageParams, Page } from 'app/commons/model';
import { ModifySelector } from '@overflow/target/store';
import * as TargetModifyStore from '@overflow/target/store/modify';
import { Target } from '@overflow/commons-typescript/model/target';
@@ -20,11 +19,11 @@ import { Target } from '@overflow/commons-typescript/model/target';
})
export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
infra$: Observable<Infra>;
infraSubscription$: Subscription;
infra$ = this.infraDetailStore.pipe(select(InfraDetailSelector.select('infra')));
sensorsSubscription$: Subscription;
// sensors$ = this.sensorListStore.pipe(select(sensorListSelector.select('page')));
target$ = this.targetModifyStore.pipe(select(ModifySelector.select('target')));
target$: Observable<Target>;
infraId = null;
infra: Infra;
@@ -39,9 +38,7 @@ export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
constructor(
private router: Router,
private route: ActivatedRoute,
private infraDetailStore: Store<InfraDetailStore.State>,
// private sensorListStore: Store<SensorListStore.State>,
private targetModifyStore: Store<TargetModifyStore.State>
private store: Store<any>,
) { }
ngOnInit() {
@@ -79,11 +76,11 @@ export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
}
getInfra() {
this.infraDetailStore.dispatch(
new InfraDetailStore.Read(
{ id: this.infraId }
)
);
// this.infraDetailStore.dispatch(
// new InfraDetailStore.Read(
// { id: this.infraId }
// )
// );
}
getSensors(pageIndex) {
@@ -127,9 +124,9 @@ export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
}
const target = this.infra.target;
target.displayName = value;
this.targetModifyStore.dispatch(
new TargetModifyStore.Modify(target)
);
// this.targetModifyStore.dispatch(
// new TargetModifyStore.Modify(target)
// );
const modifySuccessSubscription$: Subscription = this.target$.subscribe(
(t: Target) => {