This commit is contained in:
sunny 2018-04-20 00:40:31 +09:00
commit 7c386dc588
3 changed files with 37 additions and 1 deletions

View File

@ -17,6 +17,8 @@ import {
DiscoverPort = '[discovery.discovery] discoverPort', DiscoverPort = '[discovery.discovery] discoverPort',
DiscoverService = '[discovery.discovery] discoverService', DiscoverService = '[discovery.discovery] discoverService',
DiscoveryStart = '[discovery.discovery] DiscoveryService.discoveryStart',
DiscoveryStop = '[discovery.discovery] DiscoveryService.discoveryStop',
DiscoveredZone = '[discovery.discovery] DiscoveryService.discoveredZone', DiscoveredZone = '[discovery.discovery] DiscoveryService.discoveredZone',
DiscoveredHost = '[discovery.discovery] DiscoveryService.discoveredHost', DiscoveredHost = '[discovery.discovery] DiscoveryService.discoveredHost',
DiscoveredPort = '[discovery.discovery] DiscoveryService.discoveredPort', DiscoveredPort = '[discovery.discovery] DiscoveryService.discoveredPort',
@ -46,6 +48,17 @@ export class DiscoverService implements Action {
constructor(public payload: {probeID: string, port: Port, discoveryService: MDiscoveryService}) {} constructor(public payload: {probeID: string, port: Port, discoveryService: MDiscoveryService}) {}
} }
export class DiscoveryStart implements Action {
readonly type = ActionType.DiscoveryStart;
constructor(public payload: Date) {}
}
export class DiscoveryStop implements Action {
readonly type = ActionType.DiscoveryStop;
constructor(public payload: Date) {}
}
export class DiscoveredZone implements Action { export class DiscoveredZone implements Action {
readonly type = ActionType.DiscoveredZone; readonly type = ActionType.DiscoveredZone;
@ -75,6 +88,8 @@ export type Actions =
| DiscoverHost | DiscoverHost
| DiscoverPort | DiscoverPort
| DiscoverService | DiscoverService
| DiscoveryStart
| DiscoveryStop
| DiscoveredZone | DiscoveredZone
| DiscoveredHost | DiscoveredHost
| DiscoveredPort | DiscoveredPort

View File

@ -19,6 +19,12 @@ import {
export function reducer(state = initialState, action: Actions): State { export function reducer(state = initialState, action: Actions): State {
switch (action.type) { switch (action.type) {
case ActionType.DiscoveryStart: {
return state;
}
case ActionType.DiscoveryStop: {
return state;
}
case ActionType.DiscoveredZone: { case ActionType.DiscoveredZone: {
const zone: Zone = <Zone>action.payload; const zone: Zone = <Zone>action.payload;
const zones: Map<string, Zone> = null === state.zones ? new Map() : state.zones; const zones: Map<string, Zone> = null === state.zones ? new Map() : state.zones;

View File

@ -22,6 +22,21 @@ export class DiscoverySubscriber {
) { ) {
} }
@RPCSubscriber({method: 'DiscoveryService.discoveryStart'})
public discoveryStart(startDate: Date): void {
this.loggerService.debug('DiscoverySubscriber.discoveryStart startDate:', startDate);
this.store.dispatch(new DiscoverStore.DiscoveryStart(startDate));
}
@RPCSubscriber({method: 'DiscoveryService.discoveryStop'})
public discoveryStop(stopDate: Date): void {
this.loggerService.debug('DiscoverySubscriber.discoveryStop stopDate:', stopDate);
this.store.dispatch(new DiscoverStore.DiscoveryStop(stopDate));
}
@RPCSubscriber({method: 'DiscoveryService.discoveredZone'}) @RPCSubscriber({method: 'DiscoveryService.discoveredZone'})
public discoveredZone(zone: Zone): void { public discoveredZone(zone: Zone): void {
this.loggerService.debug('DiscoverySubscriber.discoveredZone zone:', zone); this.loggerService.debug('DiscoverySubscriber.discoveredZone zone:', zone);
@ -30,7 +45,7 @@ export class DiscoverySubscriber {
} }
@RPCSubscriber({method: 'DiscoveryService.discoveredHost'}) @RPCSubscriber({method: 'DiscoveryService.discoveredHost'})
public discoveredHost(host: Host): void { public discoveredHost(host: Host): void {
// this.loggerService.debug('DiscoverySubscriber.discoveredHost host:', host); this.loggerService.debug('DiscoverySubscriber.discoveredHost host:', host);
this.store.dispatch(new DiscoverStore.DiscoveredHost(host)); this.store.dispatch(new DiscoverStore.DiscoveredHost(host));
} }