diff --git a/src/packages/discovery/store/discover/discover.action.ts b/src/packages/discovery/store/discover/discover.action.ts index f25e152..733fd8d 100644 --- a/src/packages/discovery/store/discover/discover.action.ts +++ b/src/packages/discovery/store/discover/discover.action.ts @@ -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 diff --git a/src/packages/discovery/store/discover/discover.reducer.ts b/src/packages/discovery/store/discover/discover.reducer.ts index 84af354..35b78b2 100644 --- a/src/packages/discovery/store/discover/discover.reducer.ts +++ b/src/packages/discovery/store/discover/discover.reducer.ts @@ -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 = action.payload; const zones: Map = null === state.zones ? new Map() : state.zones; diff --git a/src/packages/discovery/subscriber/discovery.subscriber.ts b/src/packages/discovery/subscriber/discovery.subscriber.ts index ef4d980..6d5bfec 100644 --- a/src/packages/discovery/subscriber/discovery.subscriber.ts +++ b/src/packages/discovery/subscriber/discovery.subscriber.ts @@ -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)); }