AW-2924 Cache codelists
This commit is contained in:
@@ -5,7 +5,7 @@ import { ROUTER_NAVIGATED, RouterReducerState } from '@ngrx/router-store';
|
||||
import * as fromRouter from '@ngrx/router-store';
|
||||
import { createEffect, Actions, ofType } from '@ngrx/effects';
|
||||
|
||||
import { EMPTY, Observable, of } from 'rxjs';
|
||||
import { EMPTY, Observable, of, forkJoin } from 'rxjs';
|
||||
import { withLatestFrom, switchMap, map, catchError, mergeMap } from 'rxjs/operators';
|
||||
|
||||
import { GeoJSON, WKT } from 'ol/format';
|
||||
@@ -99,6 +99,65 @@ export class MapEffects {
|
||||
color: 'rgba(0, 0, 0, 0)'
|
||||
})
|
||||
})));
|
||||
// cache code lists
|
||||
forkJoin([
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl017'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl018'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl020'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl022'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl104'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl127'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl232'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl251'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl256'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl259'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl263'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl264'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl290'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl291'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl293'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl405'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl411'),
|
||||
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl421'),
|
||||
]).subscribe(([
|
||||
cl017,
|
||||
cl018,
|
||||
cl020,
|
||||
cl022,
|
||||
cl104,
|
||||
cl127,
|
||||
cl232,
|
||||
cl251,
|
||||
cl256,
|
||||
cl259,
|
||||
cl263,
|
||||
cl264,
|
||||
cl290,
|
||||
cl291,
|
||||
cl293,
|
||||
cl405,
|
||||
cl411,
|
||||
cl421,
|
||||
]) => {
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl017', cl017));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl018', cl018));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl020', cl020));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl020', cl020));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl104', cl104));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl127', cl127));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl232', cl232));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl251', cl251));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl256', cl256));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl259', cl259));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl263', cl263));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl264', cl264));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl290', cl290));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl291', cl291));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl293', cl293));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl405', cl405));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl411', cl411));
|
||||
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl421', cl421));
|
||||
});
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
Reference in New Issue
Block a user