This commit is contained in:
crusader 2018-04-20 00:15:20 +09:00
parent fa47b00e82
commit 967c93a883
3 changed files with 37 additions and 1 deletions

View File

@ -17,6 +17,8 @@ import {
DiscoverPort = '[discovery.discovery] discoverPort',
DiscoverService = '[discovery.discovery] discoverService',
DiscoveryStart = '[discovery.discovery] DiscoveryService.discoveryStart',
DiscoveryStop = '[discovery.discovery] DiscoveryService.discoveryStop',
DiscoveredZone = '[discovery.discovery] DiscoveryService.discoveredZone',
DiscoveredHost = '[discovery.discovery] DiscoveryService.discoveredHost',
DiscoveredPort = '[discovery.discovery] DiscoveryService.discoveredPort',
@ -46,6 +48,17 @@ export class DiscoverService implements Action {
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 {
readonly type = ActionType.DiscoveredZone;
@ -75,6 +88,8 @@ export type Actions =
| DiscoverHost
| DiscoverPort
| DiscoverService
| DiscoveryStart
| DiscoveryStop
| DiscoveredZone
| DiscoveredHost
| DiscoveredPort

View File

@ -19,6 +19,12 @@ import {
export function reducer(state = initialState, action: Actions): State {
switch (action.type) {
case ActionType.DiscoveryStart: {
return state;
}
case ActionType.DiscoveryStop: {
return state;
}
case ActionType.DiscoveredZone: {
const zone: Zone = <Zone>action.payload;
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'})
public discoveredZone(zone: Zone): void {
this.loggerService.debug('DiscoverySubscriber.discoveredZone zone:', zone);
@ -30,7 +45,7 @@ export class DiscoverySubscriber {
}
@RPCSubscriber({method: 'DiscoveryService.discoveredHost'})
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));
}