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

63 lines
1.8 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-27 07:31:27 +00:00
import * as ProbeModifyStore from './modify';
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-27 07:31:27 +00:00
modify: ProbeModifyStore.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,
2018-04-27 07:31:27 +00:00
probeHosts: ProbeHostListStore.reducer,
modify: ProbeModifyStore.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,
2018-04-27 07:31:27 +00:00
ProbeHostListStore.Effects,
ProbeModifyStore.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-27 07:31:27 +00:00
export const ModifySelector = new StateSelector<ProbeModifyStore.State>(createSelector(
selectProbeState,
(state: State) => state.modify
));
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
));