2018-04-06 11:02:18 +00:00
|
|
|
import {
|
|
|
|
createSelector,
|
|
|
|
createFeatureSelector,
|
|
|
|
} from '@ngrx/store';
|
|
|
|
|
|
|
|
import { MODULE } from '../sensor.constant';
|
|
|
|
|
2018-05-27 14:17:07 +00:00
|
|
|
import * as SensorEntityStore from './entity/sensor';
|
2018-05-28 10:35:06 +00:00
|
|
|
import * as SensorListContainerStore from './container/sensor-list';
|
2018-04-06 11:02:18 +00:00
|
|
|
|
|
|
|
export interface State {
|
2018-05-28 10:35:06 +00:00
|
|
|
sensor_list: SensorListContainerStore.State;
|
2018-04-06 11:02:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const REDUCERS = {
|
2018-05-28 10:35:06 +00:00
|
|
|
sensor: SensorListContainerStore.reducer,
|
2018-04-06 11:02:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const EFFECTS = [
|
2018-05-27 14:17:07 +00:00
|
|
|
SensorEntityStore.Effects,
|
2018-04-06 11:02:18 +00:00
|
|
|
];
|
|
|
|
|
2018-05-27 14:17:07 +00:00
|
|
|
export const selectState = createFeatureSelector<State>(MODULE.name);
|
2018-04-06 11:02:18 +00:00
|
|
|
|
2018-05-28 10:35:06 +00:00
|
|
|
export const SensorEntitySelector = SensorListContainerStore.getSelectors(createSelector(
|
2018-05-27 14:17:07 +00:00
|
|
|
selectState,
|
2018-05-28 10:35:06 +00:00
|
|
|
(state: State) => state.sensor_list
|
2018-04-06 11:02:18 +00:00
|
|
|
));
|
|
|
|
|
2018-05-27 14:17:07 +00:00
|
|
|
export const SensorPageSelector = createSelector(
|
|
|
|
selectState,
|
2018-05-28 10:35:06 +00:00
|
|
|
(state: State) => state.sensor_list.page
|
2018-05-27 14:17:07 +00:00
|
|
|
);
|