member_webapp/src/packages/probe/store/index.ts

55 lines
1.5 KiB
TypeScript
Raw Normal View History

2018-04-06 11:02:18 +00:00
import {
createSelector,
createFeatureSelector,
ActionReducerMap,
} from '@ngrx/store';
import { StateSelector } from 'packages/core/ngrx/store';
import { MODULE } from '../probe.constant';
import * as ProbeListStore from './list';
import * as ProbeDetailStore from './detail';
2018-04-25 09:04:47 +00:00
import * as ProbeHostStore from './probe-host';
import * as ProbeHostListStore from './probe-host-list';
2018-04-06 11:02:18 +00:00
export interface State {
list: ProbeListStore.State;
detail: ProbeDetailStore.State;
2018-04-25 09:04:47 +00:00
probeHost: ProbeHostStore.State;
probeHosts: ProbeHostListStore.State;
2018-04-06 11:02:18 +00:00
}
export const REDUCERS = {
list: ProbeListStore.reducer,
detail: ProbeDetailStore.reducer,
2018-04-25 09:04:47 +00:00
probeHost: ProbeHostStore.reducer,
probeHosts: ProbeHostListStore.reducer
2018-04-06 11:02:18 +00:00
};
export const EFFECTS = [
ProbeListStore.Effects,
ProbeDetailStore.Effects,
2018-04-25 09:04:47 +00:00
ProbeHostStore.Effects,
ProbeHostListStore.Effects
2018-04-06 11:02:18 +00:00
];
export const selectProbeState = createFeatureSelector<State>(MODULE.name);
export const ListSelector = new StateSelector<ProbeListStore.State>(createSelector(
selectProbeState,
(state: State) => state.list
));
export const DetailSelector = new StateSelector<ProbeDetailStore.State>(createSelector(
selectProbeState,
(state: State) => state.detail
));
2018-04-25 09:04:47 +00:00
export const ProbeHostSelector = new StateSelector<ProbeHostStore.State>(createSelector(
selectProbeState,
(state: State) => state.probeHost
));
export const ProbeHostListSelector = new StateSelector<ProbeHostListStore.State>(createSelector(
selectProbeState,
(state: State) => state.probeHosts
));