Revert "AW-2924 Cache codelists"

This reverts commit 914e272fc2.
This commit is contained in:
2023-08-09 10:17:32 +02:00
parent 914e272fc2
commit d92bf54c8d
5 changed files with 10 additions and 93 deletions

View File

@@ -1,5 +1,5 @@
import { tassign } from 'tassign';
import { IItem } from '@farmmaps/common';
import { IItem,Item } from '@farmmaps/common';
import { IItemLayer,ItemLayer,ITemporalItemLayer,TemporalItemLayer} from '../models/item.layer';
import { IMapState} from '../models/map.state';
import { IQueryState} from '@farmmaps/common';
@@ -17,7 +17,6 @@ import {Geometry} from 'ol/geom';
import { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store';
import { MODULE_NAME } from '../module-name';
import { ICodeLists } from '../models/codelist.cache';
const startDate:Date = new Date(new Date(Date.now()).getFullYear(), new Date(Date.now()).getMonth() - 3, 1);
const endDate:Date = new Date(Date.now());
@@ -73,8 +72,7 @@ export interface State {
layerValuesEnabled:boolean,
layerValues: Array<ILayervalue>
showDataLayerSlide:boolean,
viewEnabled: boolean,
codeLists:ICodeLists,
viewEnabled:boolean
}
export const initialState: State = {
@@ -119,8 +117,7 @@ export const initialState: State = {
layerValuesEnabled:false,
layerValues:[],
showDataLayerSlide:false,
viewEnabled: true,
codeLists: {}
viewEnabled:true
}
export function reducer(state = initialState, action: mapActions.Actions | commonActions.Actions | RouterNavigationAction): State {
@@ -572,12 +569,6 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
}
return state;
}
case mapActions.SETCODELIST:{
const a = action as mapActions.SetCodeList;
const codeLists = tassign(state.codeLists);
codeLists[a.itemType] = a.values;
return tassign(state,{codeLists:codeLists});
}
default: {
return state;
}
@@ -616,7 +607,7 @@ export const getLayerValues = (state:State) => state.layerValues;
export const getLayerValuesX = (state:State) => state.layerValuesX;
export const getLayerValuesY = (state:State) => state.layerValuesY;
export const getViewEnabled = (state:State) => state.viewEnabled;
export const getCodeLists = (state:State) => state.codeLists;
export const selectMapState = createFeatureSelector<State>(MODULE_NAME);
export const selectGetMapState= createSelector(selectMapState, getMapState);
@@ -651,5 +642,5 @@ export const selectGetLayerValues = createSelector(selectMapState,getLayerValues
export const selectGetLayerValuesX = createSelector(selectMapState,getLayerValuesX);
export const selectGetLayerValuesY = createSelector(selectMapState,getLayerValuesY);
export const selectGetViewEnabled = createSelector(selectMapState,getViewEnabled);
export const selectGetCodeLists = createSelector(selectMapState, getCodeLists);
export const selectGetCodeList = (id: string) => createSelector(selectGetCodeLists, (codeLists) => codeLists[id]);