diff --git a/@overflow/discovery/discovery-store.module.ts b/@overflow/discovery/discovery-store.module.ts deleted file mode 100644 index b8f2310..0000000 --- a/@overflow/discovery/discovery-store.module.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { NgModule } from '@angular/core'; -import { StoreModule } from '@ngrx/store'; - -import { EffectsModule } from '@ngrx/effects'; - -import { - REDUCERS, - EFFECTS, -} from './store'; - -import { MODULE } from './discovery.constant'; - -@NgModule({ - imports: [ - StoreModule.forFeature(MODULE.name, REDUCERS), - EffectsModule.forFeature(EFFECTS), - ], -}) -export class DiscoveryStoreModule { } diff --git a/@overflow/discovery/discovery.module.ts b/@overflow/discovery/discovery.module.ts index 754abaa..01e62e9 100644 --- a/@overflow/discovery/discovery.module.ts +++ b/@overflow/discovery/discovery.module.ts @@ -2,7 +2,6 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { DiscoveryStoreModule } from './discovery-store.module'; import { DiscoveryRPCModule } from './discovery-rpc.module'; import { DiscoveryLoggerModule } from './discovery-logger.module'; @@ -19,7 +18,6 @@ import { MetaModule } from '@overflow/meta/meta.module'; FormsModule, ReactiveFormsModule, UIModule, - DiscoveryStoreModule, DiscoveryRPCModule, DiscoveryLoggerModule, ProbeModule, diff --git a/@overflow/discovery/store/discover/discover.action.ts b/@overflow/discovery/store/discover/discover.action.ts deleted file mode 100644 index 8450f40..0000000 --- a/@overflow/discovery/store/discover/discover.action.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { Action } from '@ngrx/store'; - -import { - Zone, - Host, - Port, - Service, - DiscoverZone as MDDiscoverZone, - DiscoverHost as MDDiscoverHost, - DiscoverPort as MDDiscoverPort, - DiscoverService as MDiscoverService, -} from '@overflow/commons-typescript/model/discovery'; - - export enum ActionType { - DiscoverZone = '[discovery.discovery] discoverZone', - DiscoverHost = '[discovery.discovery] discoverHost', - 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', - DiscoveredService = '[discovery.discovery] DiscoveryService.discoveredService', -} - -export class DiscoverZone implements Action { - readonly type = ActionType.DiscoverZone; - - constructor(public payload: {probeID: string, discoverZone: MDDiscoverZone}) {} -} - -export class DiscoverHost implements Action { - readonly type = ActionType.DiscoverHost; - - constructor(public payload: {probeID: string, zone: Zone, discoverHost: MDDiscoverHost}) {} -} - -export class DiscoverPort implements Action { - readonly type = ActionType.DiscoverPort; - - constructor(public payload: {probeID: string, host: Host, discoverPort: MDDiscoverPort}) {} -} - -export class DiscoverService implements Action { - readonly type = ActionType.DiscoverService; - constructor(public payload: {probeID: string, port: Port, discoverService: MDiscoverService}) {} -} - -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; - - constructor(public payload: Zone) {} -} - -export class DiscoveredHost implements Action { - readonly type = ActionType.DiscoveredHost; - - constructor(public payload: Host) {} -} - -export class DiscoveredPort implements Action { - readonly type = ActionType.DiscoveredPort; - - constructor(public payload: Port) {} -} - -export class DiscoveredService implements Action { - readonly type = ActionType.DiscoveredService; - constructor(public payload: Service) {} -} - -export type Actions = - | DiscoverZone - | DiscoverHost - | DiscoverPort - | DiscoverService - | DiscoveryStart - | DiscoveryStop - | DiscoveredZone - | DiscoveredHost - | DiscoveredPort - | DiscoveredService -; diff --git a/@overflow/discovery/store/discover/discover.effect.spec.ts b/@overflow/discovery/store/discover/discover.effect.spec.ts deleted file mode 100644 index f868840..0000000 --- a/@overflow/discovery/store/discover/discover.effect.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { TestBed, inject } from '@angular/core/testing'; - -import { Effects } from './discover.effect'; - -describe('Discover.Effects', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [Effects] - }); - }); - - it('should be created', inject([Effects], (effects: Effects) => { - expect(effects).toBeTruthy(); - })); -}); diff --git a/@overflow/discovery/store/discover/discover.effect.ts b/@overflow/discovery/store/discover/discover.effect.ts deleted file mode 100644 index 92b1448..0000000 --- a/@overflow/discovery/store/discover/discover.effect.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Router } from '@angular/router'; - -import { Effect, Actions, ofType } from '@ngrx/effects'; -import { Action } from '@ngrx/store'; - -import { Observable } from 'rxjs/Observable'; -import { of } from 'rxjs/observable/of'; - -import 'rxjs/add/operator/catch'; -import 'rxjs/add/operator/do'; -import 'rxjs/add/operator/exhaustMap'; -import 'rxjs/add/operator/switchMap'; -import 'rxjs/add/operator/map'; -import 'rxjs/add/operator/take'; - -import { - DiscoverZone, - DiscoverHost, - DiscoverPort, - DiscoverService, - ActionType -} from './discover.action'; -import {DiscoveryService} from '../../service/discovery.service'; - - -@Injectable() -export class Effects { - - constructor(private actions$: Actions, - private discoveryService: DiscoveryService, - private router: Router) { - } - - @Effect({ dispatch: false }) - discoveryZone$ = this.actions$ - .ofType(ActionType.DiscoverZone) - .map((action: DiscoverZone) => action.payload) - .do(payload => { - this.discoveryService.discoverZone(payload.probeID, payload.discoverZone); - }); - - @Effect({ dispatch: false }) - discoveryHost$ = this.actions$ - .ofType(ActionType.DiscoverHost) - .map((action: DiscoverHost) => action.payload) - .do(payload => { - this.discoveryService.discoverHost(payload.probeID, payload.zone, payload.discoverHost); - }); - - @Effect({ dispatch: false }) - discoveryPort$ = this.actions$ - .ofType(ActionType.DiscoverPort) - .map((action: DiscoverPort) => action.payload) - .do(payload => { - this.discoveryService.discoverPort(payload.probeID, payload.host, payload.discoverPort); - }); - - @Effect({ dispatch: false }) - discoveryService$ = this.actions$ - .ofType(ActionType.DiscoverService) - .map((action: DiscoverService) => action.payload) - .do(payload => { - this.discoveryService.discoverService(payload.probeID, payload.port, payload.discoverService); - }); -} diff --git a/@overflow/discovery/store/discover/discover.reducer.ts b/@overflow/discovery/store/discover/discover.reducer.ts deleted file mode 100644 index 5da1790..0000000 --- a/@overflow/discovery/store/discover/discover.reducer.ts +++ /dev/null @@ -1,227 +0,0 @@ -import { - Actions, - ActionType, -} from './discover.action'; - -import { - State, - initialState, -} from './discover.state'; - -import { - Zone, - Host, - Port, - Service, -} from '@overflow/commons-typescript/model/discovery'; - -// import * as _ 'lodash'; - -export function reducer(state = initialState, action: Actions): State { - switch (action.type) { - case ActionType.DiscoveryStart: { - - return { - ...state, - isStart: true - }; - } - case ActionType.DiscoveryStop: { - return { - ...state, - isEnd: true - }; - } - case ActionType.DiscoveredZone: { - const zone: Zone = action.payload; - const zones: Map = null === state.zones ? new Map() : state.zones; - - zones.set(zone.network, zone); - - const newZones: Map = new Map(); - - zones.forEach(function(value, key) { - newZones.set(key, value); - }); - - return { - ...state, - zones : newZones, - }; - } - - case ActionType.DiscoveredHost: { - const host: Host = action.payload; - let zone = null; - - let zones: Map = state.zones; - - if (zones === undefined || zones === null) { - zones = new Map(); - zone = host.zone; - // zones.set(zone.network, zone); - } else { - zone = zones.get(host.zone.network); - } - - if (undefined === zone) { - // console.error(`Discovery.discoveredHost: Zone[${host.zone.network}] is not exist`); - zone = new Map(); - } - if (null === zone.hosts || undefined === zone.hosts) { - zone.hosts = new Map(); - zone.hosts.set(host.ipv4, host); - } else { - if (zone.hosts.has(host.ipv4) === false) { - zone.hosts.set(host.ipv4, host); - } - } - - zones.set(zone.network, zone); - - const newZones: Map = new Map(); - - zones.forEach(function(value, key) { - newZones.set(key, value); - }); - - return { - ...state, - zones: newZones - }; - } - - case ActionType.DiscoveredPort: { - const port: Port = action.payload; - let zone = state.zones.get(port.host.zone.network); - - let zones: Map = state.zones; - - if (zones === undefined || zones === null) { - zones = new Map(); - } - - if (zone === undefined || zone === null) { - zone = port.host.zone; - } - - // if (undefined === zone) { - // console.error(`Discovery.DiscoveredPort: Zone[${port.host.zone.network}] is not exist`); - // } - - // if (null === zone.hosts || undefined === zone.hosts.get(port.host.ip)) { - // console.error(`Discovery.DiscoveredPort: Host[${port.host.ip}] is not exist`); - // return state; - // } - - if (zone.hosts === undefined || zone.hosts === null) { - zone.hosts = new Map(); - } - let host: Host = null; - host = zone.hosts.get(port.host.ipv4); - - if (host === undefined || host === null) { - host = port.host; - } - - if (null === host.ports || undefined === host.ports) { - host.ports = new Map(); - host.ports.set(port.portNumber, port); - } else { - if (host.ports.has(port.portNumber) === false) { - host.ports.set(port.portNumber, port); - } - } - - zone.hosts.set(host.ipv4, host); - zones.set(zone.network, zone); - - const newZones: Map = new Map(); - - zones.forEach(function(value, key) { - newZones.set(key, value); - }); - - return { - ...state, - zones: newZones - }; - - } - - case ActionType.DiscoveredService: { - const service: Service = action.payload; - let zone = state.zones.get(service.port.host.zone.network); - - let zones: Map = state.zones; - - if (zones === undefined || zones === null) { - zones = new Map(); - } - - if (zone === undefined || zone === null) { - zone = service.port.host.zone; - } - - if (zone.hosts === undefined || zone.hosts === null) { - zone.hosts = new Map(); - } - - // if (undefined === zone) { - // console.error(`Discovery.DiscoveredService: Zone[${service.port.host.zone.network}] is not exist`); - // } - // if (null === zone.hosts || undefined === zone.hosts.get(service.port.host.ip)) { - // console.error(`Discovery.DiscoveredPort: Host[${service.port.host.ip}] is not exist`); - // } - let host: Host = null; - host = zone.hosts.get(service.port.host.ipv4); - - if (host === undefined || host === null) { - zone.hosts.set(service.port.host.ipv4, service.port.host); - host = service.port.host; - } - - if (undefined === host.ports || null === host.ports) { - host.ports = new Map(); - host.ports.set(service.port.portNumber, service.port); - } - - let port: Port = null; - port = host.ports.get(service.port.portNumber); - - if (undefined === port || null === port) { - port = service.port; - } - - if ( undefined === port.services || null === port.services) { - port.services = new Map(); - } - port.services.set(service.serviceName, service); - - host.ports.set(service.port.portNumber, port); - zone.hosts.set(host.ipv4, host); - zones.set(zone.network, zone); - - const newZones: Map = new Map(); - - zones.forEach(function(value, key) { - newZones.set(key, value); - }); - - return { - ...state, - zones: newZones - }; - } - - default: { - return state; - } - } -} - - -// function checkZone(state, pZone: Zone) : { - - -// } diff --git a/@overflow/discovery/store/discover/discover.state.ts b/@overflow/discovery/store/discover/discover.state.ts deleted file mode 100644 index 18a5d42..0000000 --- a/@overflow/discovery/store/discover/discover.state.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { RPCClientError } from '@loafer/ng-rpc'; - -import { Zone } from '@overflow/commons-typescript/model/discovery'; - -export interface State { - error: RPCClientError | null; - processing: boolean; - zones: Map | null; - isReq: boolean; - isStart: boolean; - isEnd: boolean; -} - -export const initialState: State = { - error: null, - processing: false, - zones: null, - isReq: false, - isStart: false, - isEnd: false -}; - diff --git a/@overflow/discovery/store/discover/index.ts b/@overflow/discovery/store/discover/index.ts deleted file mode 100644 index cdd131c..0000000 --- a/@overflow/discovery/store/discover/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './discover.action'; -export * from './discover.reducer'; -export * from './discover.state'; -export * from './discover.effect'; diff --git a/@overflow/discovery/store/index.ts b/@overflow/discovery/store/index.ts deleted file mode 100644 index 6f6a789..0000000 --- a/@overflow/discovery/store/index.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { - createSelector, - createFeatureSelector, - ActionReducerMap, - Selector, -} from '@ngrx/store'; - -import { StateSelector } from '@overflow/core/ngrx/store'; - -import { MODULE } from '../discovery.constant'; - - -import * as DiscoverStore from './discover'; -import * as SettingStore from './setting'; - - -export interface State { - discover: DiscoverStore.State; - setting: SettingStore.State; -} - -export const REDUCERS = { - discover: DiscoverStore.reducer, - setting: SettingStore.reducer, -}; - -export const EFFECTS = [ - SettingStore.Effects, - DiscoverStore.Effects, -]; - -export const selectDiscoveryState = createFeatureSelector(MODULE.name); - -export const DiscoverSelector = new StateSelector(createSelector( - selectDiscoveryState, - (state: State) => state.discover -)); - -export const SettingSelector = new StateSelector(createSelector( - selectDiscoveryState, - (state: State) => state.setting -)); diff --git a/@overflow/discovery/store/regist/index.ts b/@overflow/discovery/store/regist/index.ts deleted file mode 100644 index f6da3fb..0000000 --- a/@overflow/discovery/store/regist/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './regist.action'; -export * from './regist.effect'; -export * from './regist.reducer'; -export * from './regist.state'; diff --git a/@overflow/discovery/store/regist/regist.action.ts b/@overflow/discovery/store/regist/regist.action.ts deleted file mode 100644 index 48d3fc4..0000000 --- a/@overflow/discovery/store/regist/regist.action.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Action } from '@ngrx/store'; - -import { RPCClientError } from '@loafer/ng-rpc'; - -import { - Zone, - Host, - Port, - Service, - DiscoverZone as MDDiscoverZone, - DiscoverHost as MDDiscoverHost, - DiscoverPort as MDDiscoverPort, - DiscoverService as MDiscoverService, -} from '@overflow/commons-typescript/model/discovery'; -import { Probe } from '@overflow/commons-typescript/model/probe'; - - export enum ActionType { - SaveAllTarget = '[@@REGIST] TargetDiscoveryService.saveAllTarget', - SaveAllTargetSuccess = '[@@REGIST] TargetDiscoveryService.SaveAllTargetSuccess', - SaveAllTargetFailure = '[@@REGIST] TargetDiscoveryService.SaveAllTargetFailure', -} - -export class DiscoverySaveAllTarget implements Action { - readonly type = ActionType.SaveAllTarget; - - constructor(public payload: {hosts: Host[], probe: Probe}) {} -} - -export class DiscoverySaveAllTargetSuccess implements Action { - readonly type = ActionType.SaveAllTargetSuccess; - - constructor(public payload: Boolean) {} -} - -export class DiscoverySaveAllTargetFailure implements Action { - readonly type = ActionType.SaveAllTargetFailure; - - constructor(public payload: RPCClientError) {} -} - -export type Actions = - | DiscoverySaveAllTarget - | DiscoverySaveAllTargetSuccess - | DiscoverySaveAllTargetFailure -; diff --git a/@overflow/discovery/store/regist/regist.effect.spec.ts b/@overflow/discovery/store/regist/regist.effect.spec.ts deleted file mode 100644 index 2b298f3..0000000 --- a/@overflow/discovery/store/regist/regist.effect.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { TestBed, inject } from '@angular/core/testing'; - -import { Effects } from './regist.effect'; - -describe('Regist.Effects', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [Effects] - }); - }); - - it('should be created', inject([Effects], (effects: Effects) => { - expect(effects).toBeTruthy(); - })); -}); diff --git a/@overflow/discovery/store/regist/regist.effect.ts b/@overflow/discovery/store/regist/regist.effect.ts deleted file mode 100644 index 8d2c169..0000000 --- a/@overflow/discovery/store/regist/regist.effect.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Router } from '@angular/router'; - -import { Effect, Actions, ofType } from '@ngrx/effects'; -import { Action } from '@ngrx/store'; - -import { Observable } from 'rxjs/Observable'; -import { of } from 'rxjs/observable/of'; - -import 'rxjs/add/operator/catch'; -import 'rxjs/add/operator/do'; -import 'rxjs/add/operator/exhaustMap'; -import 'rxjs/add/operator/switchMap'; -import 'rxjs/add/operator/map'; -import 'rxjs/add/operator/take'; - -import { RPCClientError } from '@loafer/ng-rpc'; - -import { DiscoveryStartInfo } from '@overflow/commons-typescript/model/discovery'; -import { TargetDiscoveryService } from '../../service/target-discovery.service'; - -import { - DiscoverySaveAllTarget, - DiscoverySaveAllTargetSuccess, - DiscoverySaveAllTargetFailure, - ActionType -} from './regist.action'; - -@Injectable() -export class Effects { - - constructor( - private actions$: Actions, - private targetDiscoveryService: TargetDiscoveryService, - private router: Router - ) { } - - @Effect() - saveAllTargetResult$: Observable = this.actions$ - .ofType(ActionType.SaveAllTarget) - .map((action: DiscoverySaveAllTarget) => action.payload) - .switchMap(payload => this.targetDiscoveryService.saveAllTarget(payload.hosts, payload.probe)) - .map(result => { - return new DiscoverySaveAllTargetSuccess(result); - }) - .catch((error: RPCClientError) => { - console.log(error.response.message); - return of(new DiscoverySaveAllTargetFailure(error)); - }); - -} diff --git a/@overflow/discovery/store/regist/regist.reducer.ts b/@overflow/discovery/store/regist/regist.reducer.ts deleted file mode 100644 index 3e34b2f..0000000 --- a/@overflow/discovery/store/regist/regist.reducer.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { - Actions, - ActionType, -} from './regist.action'; - -import { - State, - initialState, -} from './regist.state'; - -import { DiscoveryStartInfo } from '@overflow/commons-typescript/model/discovery'; - -export function reducer(state = initialState, action: Actions): State { - switch (action.type) { - case ActionType.SaveAllTarget: { - return { - ...state, - error: null, - isPending: true, - }; - } - - case ActionType.SaveAllTargetSuccess: { - return { - ...state, - error: null, - isPending: false, - isSuccess: action.payload, - }; - } - - case ActionType.SaveAllTargetFailure: { - return { - ...state, - error: action.payload, - isPending: false, - isSuccess: null, - }; - } - - default: { - return state; - } - } -} diff --git a/@overflow/discovery/store/regist/regist.state.ts b/@overflow/discovery/store/regist/regist.state.ts deleted file mode 100644 index b1f440a..0000000 --- a/@overflow/discovery/store/regist/regist.state.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { RPCClientError } from '@loafer/ng-rpc'; - -import { DiscoveryStartInfo } from '@overflow/commons-typescript/model/discovery'; - -export interface State { - error: RPCClientError | null; - isPending: boolean; - isSuccess: Boolean | null; -} - -export const initialState: State = { - error: null, - isPending: false, - isSuccess: null, -}; - -export const getSuccess = (state: State) => state.isSuccess; - diff --git a/@overflow/discovery/store/setting/index.ts b/@overflow/discovery/store/setting/index.ts deleted file mode 100644 index 1393479..0000000 --- a/@overflow/discovery/store/setting/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './setting.action'; -export * from './setting.effect'; -export * from './setting.reducer'; -export * from './setting.state'; diff --git a/@overflow/discovery/store/setting/setting.action.ts b/@overflow/discovery/store/setting/setting.action.ts deleted file mode 100644 index 03559e7..0000000 --- a/@overflow/discovery/store/setting/setting.action.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Action } from '@ngrx/store'; - -import { RPCClientError } from '@loafer/ng-rpc'; - -import { DiscoveryStartInfo } from '@overflow/commons-typescript/model/discovery'; - -export enum ActionType { - Setting = '[discovery.setting] Setting', - SettingSuccess = '[discovery.setting] SettingSuccess', - SettingFailure = '[discovery.setting] SettingFailure', - SettingRedirect = '[discovery.setting] SettingRedirect', -} - -export class Setting implements Action { - readonly type = ActionType.Setting; - - constructor(public payload: DiscoveryStartInfo) {} -} - -export class SettingSuccess implements Action { - readonly type = ActionType.SettingSuccess; - - constructor(public payload: DiscoveryStartInfo) {} -} - -export class SettingFailure implements Action { - readonly type = ActionType.SettingFailure; - - constructor(public payload: RPCClientError) {} -} - -export class SettingRedirect implements Action { - readonly type = ActionType.SettingRedirect; -} - - -export type Actions = - | Setting - | SettingSuccess - | SettingFailure - | SettingRedirect -; diff --git a/@overflow/discovery/store/setting/setting.effect.spec.ts b/@overflow/discovery/store/setting/setting.effect.spec.ts deleted file mode 100644 index cbfff71..0000000 --- a/@overflow/discovery/store/setting/setting.effect.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { TestBed, inject } from '@angular/core/testing'; - -import { Effects } from './setting.effect'; - -describe('Auth.Effects', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [Effects] - }); - }); - - it('should be created', inject([Effects], (effects: Effects) => { - expect(effects).toBeTruthy(); - })); -}); diff --git a/@overflow/discovery/store/setting/setting.effect.ts b/@overflow/discovery/store/setting/setting.effect.ts deleted file mode 100644 index ee49794..0000000 --- a/@overflow/discovery/store/setting/setting.effect.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Router } from '@angular/router'; - -import { Effect, Actions, ofType } from '@ngrx/effects'; -import { Action } from '@ngrx/store'; - -import { Observable } from 'rxjs/Observable'; -import { of } from 'rxjs/observable/of'; - -import 'rxjs/add/operator/catch'; -import 'rxjs/add/operator/do'; -import 'rxjs/add/operator/exhaustMap'; -import 'rxjs/add/operator/switchMap'; -import 'rxjs/add/operator/map'; -import 'rxjs/add/operator/take'; - -import { RPCClientError } from '@loafer/ng-rpc'; - -import { DiscoveryStartInfo } from '@overflow/commons-typescript/model/discovery'; -import { DiscoveryService } from '../../service/discovery.service'; - -import { - Setting, - SettingSuccess, - SettingFailure, - ActionType, -} from './setting.action'; - -@Injectable() -export class Effects { - - constructor( - private actions$: Actions, - private discoveryService: DiscoveryService, - private router: Router - ) { } - - // @Effect() - // startDiscovery$: Observable = this.actions$ - // .ofType(ActionType.Setting) - // .map((action: Setting) => action.payload) - // .switchMap(payload => this.discoveryService.start(payload)) - // .map(discoveryStartInfo => { - // return new SettingSuccess(discoveryStartInfo); - // }) - // .catch((error: RPCClientError) => { - // console.log(error.response.message); - // return of(new SettingFailure(error)); - // }); - -} diff --git a/@overflow/discovery/store/setting/setting.reducer.ts b/@overflow/discovery/store/setting/setting.reducer.ts deleted file mode 100644 index 6a62cf5..0000000 --- a/@overflow/discovery/store/setting/setting.reducer.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { - Actions, - ActionType, - Setting, -} from './setting.action'; - -import { - State, - initialState, -} from './setting.state'; - -import { DiscoveryStartInfo } from '@overflow/commons-typescript/model/discovery'; - -export function reducer(state = initialState, action: Actions): State { - switch (action.type) { - case ActionType.Setting: { - return { - ...state, - error: null, - isPending: true, - }; - } - - case ActionType.SettingSuccess: { - return { - ...state, - isStart: true, - error: null, - isPending: false, - discoveryStartInfo: action.payload, - }; - } - - case ActionType.SettingFailure: { - return { - ...state, - isStart: false, - error: action.payload, - isPending: false, - discoveryStartInfo: null, - }; - } - - default: { - return state; - } - } -} diff --git a/@overflow/discovery/store/setting/setting.state.ts b/@overflow/discovery/store/setting/setting.state.ts deleted file mode 100644 index 9514352..0000000 --- a/@overflow/discovery/store/setting/setting.state.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { RPCClientError } from '@loafer/ng-rpc'; - -import { DiscoveryStartInfo } from '@overflow/commons-typescript/model/discovery'; - -export interface State { - isStart: boolean; - error: RPCClientError | null; - isPending: boolean; - discoveryStartInfo: DiscoveryStartInfo | null; -} - -export const initialState: State = { - isStart: false, - error: null, - isPending: false, - discoveryStartInfo: null, -}; - -export const isStart = (state: State) => state.isStart; -export const getDiscoveryStartInfo = (state: State) => state.discoveryStartInfo; -export const getError = (state: State) => state.error; -export const isPending = (state: State) => state.isPending; diff --git a/@overflow/discovery/subscriber/discovery.subscriber.ts b/@overflow/discovery/subscriber/discovery.subscriber.ts index c4157e7..1bbfe33 100644 --- a/@overflow/discovery/subscriber/discovery.subscriber.ts +++ b/@overflow/discovery/subscriber/discovery.subscriber.ts @@ -5,9 +5,6 @@ import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { RPCSubscriber } from '@loafer/ng-rpc'; import { LoggerService } from '@loafer/ng-logger'; -import { DiscoverSelector } from '../store'; -import * as DiscoverStore from '../store/discover'; - import { Zone, Host,