added Receive Discovery

This commit is contained in:
snoop 2017-09-29 17:00:17 +09:00
parent 254a786c47
commit 326e6ce76d
4 changed files with 109 additions and 0 deletions

View File

@ -12,6 +12,16 @@ export class DiscoveryService extends Service {
// state change test
}
public discoveryIngHost(params: any): void {
console.log('discoveryIngHost');
}
public discoveryIngPort(params: any): void {
console.log('discoveryIngPort');
}
public discoveryIngService(params: any): void {
console.log('discoveryIngService');
}
}
export default DiscoveryService;

View File

@ -0,0 +1,17 @@
// Action Type
export type REQUEST = '@overflow/discovery/ing/REQUEST';
export type REQUEST_SUCCESS = '@overflow/discovery/ing/REQUEST/SUCCESS';
export type REQUEST_FAILURE = '@overflow/discovery/ing/REQUEST/FAILURE';
export type RECEIVE_HOST = '@overflow/discovery/host/RECEIVE';
export type RECEIVE_PORT = '@overflow/discovery/port/RECEIVE';
export type RECEIVE_SERVICE = '@overflow/discovery/service/RECEIVE';
export const REQUEST: REQUEST = '@overflow/discovery/ing/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/discovery/ing/REQUEST/SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/discovery/ing/REQUEST/FAILURE';
export const RECEIVE_HOST: RECEIVE_HOST = '@overflow/discovery/host/RECEIVE';
export const RECEIVE_PORT: RECEIVE_PORT = '@overflow/discovery/port/RECEIVE';
export const RECEIVE_SERVICE: RECEIVE_SERVICE = '@overflow/discovery/service/RECEIVE';

View File

@ -0,0 +1,45 @@
import Action from '@overflow/commons/redux/Action';
import { ReducersMapObject } from 'redux';
import Host from '../../api/model/Host';
import Port from '../../api/model/Port';
import Service from '../../api/model/Service';
import * as IngActionTypes from '../action/ing';
import {
HostState, hostDefaultState,
PortState, portDefaultState,
ServiceState, serviceDefaultState,
} from '../state/Ing';
const reducer: ReducersMapObject = {
[IngActionTypes.RECEIVE_HOST]: (state: HostState = hostDefaultState,
action: Action<Host>): HostState => {
return {
...state,
// discoveryData: action.payload,
};
},
[IngActionTypes.RECEIVE_PORT]: (state: PortState = portDefaultState,
action: Action<Port>): PortState => {
return {
...state,
// discoveryData: action.payload,
};
},
[IngActionTypes.RECEIVE_SERVICE]: (state: ServiceState = serviceDefaultState,
action: Action<Service>): ServiceState => {
return {
...state,
// discoveryData: action.payload,
};
},
};
export default reducer;

View File

@ -0,0 +1,37 @@
import Host from '../../api/model/Host';
import Port from '../../api/model/Port';
import Service from '../../api/model/Service';
export interface HostState {
readonly host: Host;
readonly error?: Error;
}
export const hostDefaultState: HostState = {
host: undefined,
error: undefined,
};
export interface PortState {
readonly port: Port;
readonly error?: Error;
}
export const portDefaultState: PortState = {
port: undefined,
error: undefined,
};
export interface ServiceState {
readonly service: Service;
readonly error?: Error;
}
export const serviceDefaultState: ServiceState = {
service: undefined,
error: undefined,
};