From c24dd61de12463378a3ea36e375d5dcaf7e4d8c6 Mon Sep 17 00:00:00 2001 From: insanity Date: Sun, 27 May 2018 15:52:27 +0900 Subject: [PATCH] dispatch lifecycle --- @overflow/probe/container/probe-detail-container.html | 1 - @overflow/probe/container/probe-detail-container.ts | 7 +++++-- @overflow/probe/store/index.ts | 6 +++--- src/environments/environment.ts | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/@overflow/probe/container/probe-detail-container.html b/@overflow/probe/container/probe-detail-container.html index c913044..664b2df 100644 --- a/@overflow/probe/container/probe-detail-container.html +++ b/@overflow/probe/container/probe-detail-container.html @@ -1,2 +1 @@ -
An error has occurred.
\ No newline at end of file diff --git a/@overflow/probe/container/probe-detail-container.ts b/@overflow/probe/container/probe-detail-container.ts index 57b07a6..83c27e6 100644 --- a/@overflow/probe/container/probe-detail-container.ts +++ b/@overflow/probe/container/probe-detail-container.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, Input, AfterViewInit, Output, EventEmitter } from '@angular/core'; +import { Component, OnInit, Input, AfterViewInit, Output, EventEmitter, AfterContentInit, OnChanges, SimpleChanges } from '@angular/core'; import { Observable } from 'rxjs'; import { ProbeHost, Probe } from '@overflow/commons-typescript/model/probe'; import { Store, select } from '@ngrx/store'; @@ -10,7 +10,7 @@ import { ActivatedRoute } from '@angular/router'; selector: 'of-probe-detail-container', templateUrl: './probe-detail-container.html', }) -export class ProbeDetailContainerComponent implements OnInit { +export class ProbeDetailContainerComponent implements OnInit, OnChanges { @Input() probeHostID: number; @Output() discovery = new EventEmitter(); @@ -28,6 +28,9 @@ export class ProbeDetailContainerComponent implements OnInit { ngOnInit() { this.probeHost$ = this.store.pipe(select(ProbeSelector.selectOne(this.probeHostID))); + } + + ngOnChanges(changes: SimpleChanges): void { this.store.dispatch(new ProbeStore.Read(this.probeHostID)); } diff --git a/@overflow/probe/store/index.ts b/@overflow/probe/store/index.ts index ee28bdd..d8f61a4 100644 --- a/@overflow/probe/store/index.ts +++ b/@overflow/probe/store/index.ts @@ -13,13 +13,13 @@ import * as ProbeListContainerStore from './container/probe-list'; import * as ProbeDetailContainerStore from './container/probe-detail'; export interface State { - probes: ProbeEntityStore.State; + probe: ProbeEntityStore.State; probe_list_container: ProbeListContainerStore.State; probe_detail_container: ProbeDetailContainerStore.State; } export const REDUCERS = { - probes: ProbeEntityStore.reducer, + probe: ProbeEntityStore.reducer, probe_list_container: ProbeListContainerStore.reducer, probe_detail_container: ProbeDetailContainerStore.reducer }; @@ -32,7 +32,7 @@ export const selectState = createFeatureSelector(MODULE.name); export const ProbeSelector = ProbeEntityStore.getSelectors(createSelector( selectState, - (state: State) => state.probes + (state: State) => state.probe )); export const ProbeListContainerSelector = ProbeListContainerStore.getSelectors(createSelector( diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 7f890ba..1d32219 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -5,7 +5,7 @@ export const environment = { production: false, - restBaseURL: 'http://192.168.1.50:19080/webapp', + restBaseURL: 'http://192.168.1.101:19080/webapp', webappRPCConfig: { url: 'ws://192.168.1.101:19090/webapp', reconnectInterval: 5000,