63 lines
1.8 KiB
TypeScript
63 lines
1.8 KiB
TypeScript
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';
|
|
import * as ProbeHostStore from './probe-host';
|
|
import * as ProbeHostListStore from './probe-host-list';
|
|
import * as ProbeModifyStore from './modify';
|
|
|
|
export interface State {
|
|
list: ProbeListStore.State;
|
|
detail: ProbeDetailStore.State;
|
|
probeHost: ProbeHostStore.State;
|
|
probeHosts: ProbeHostListStore.State;
|
|
modify: ProbeModifyStore.State;
|
|
}
|
|
|
|
export const REDUCERS = {
|
|
list: ProbeListStore.reducer,
|
|
detail: ProbeDetailStore.reducer,
|
|
probeHost: ProbeHostStore.reducer,
|
|
probeHosts: ProbeHostListStore.reducer,
|
|
modify: ProbeModifyStore.reducer
|
|
};
|
|
|
|
export const EFFECTS = [
|
|
ProbeListStore.Effects,
|
|
ProbeDetailStore.Effects,
|
|
ProbeHostStore.Effects,
|
|
ProbeHostListStore.Effects,
|
|
ProbeModifyStore.Effects
|
|
];
|
|
|
|
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
|
|
));
|
|
export const ModifySelector = new StateSelector<ProbeModifyStore.State>(createSelector(
|
|
selectProbeState,
|
|
(state: State) => state.modify
|
|
));
|
|
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
|
|
));
|