Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Peter Bastiani 2021-08-04 12:05:09 +02:00
commit ff018d9db1
12 changed files with 232 additions and 175 deletions

54
package-lock.json generated
View File

@ -1657,9 +1657,9 @@
"dev": true "dev": true
}, },
"postcss": { "postcss": {
"version": "7.0.35", "version": "7.0.36",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.35.tgz", "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.36.tgz",
"integrity": "sha512-3QT8bBJeX/S5zKTTjTCIjRF3If4avAT6kqxcASlTWEtAFCb9NH0OUxNDfgZSWdP5fJnBYCMEWkIFfWeugjzYMg==", "integrity": "sha512-BebJSIUMwJHRH0HAQoxN4u1CN86glsrwsW0q7T+/m44eXOUAxSNdHRkNZPYz5vVUbg17hFgOQDE7fZk7li3pZw==",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "^2.4.2", "chalk": "^2.4.2",
@ -4079,25 +4079,25 @@
"dev": true "dev": true
}, },
"@farmmaps/common": { "@farmmaps/common": {
"version": "1.0.1", "version": "1.1.1-prerelease.2031",
"resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common/-/common-1.0.1.tgz", "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common/-/common-1.1.1-prerelease.2031.tgz",
"integrity": "sha512-ZVj+/0dVSNT1TtU+ExBFyak/Hfl8hKl5RnBWux6+v7GyHJYyaYDotbSPhszoNm6Mrz7Lt0pifCja1vUKL8w5sQ==", "integrity": "sha512-lSmTd2D1/PqzaXBjjY4X6UTYA5joZndXyZpUkFNm/Z0TTFmzFKmiIyGRA9AHX4StdQXC7QsCNfalYN31tnwtuQ==",
"requires": { "requires": {
"tslib": "^2.0.0" "tslib": "^2.0.0"
} }
}, },
"@farmmaps/common-map": { "@farmmaps/common-map": {
"version": "1.0.1", "version": "1.1.1-prerelease.2031",
"resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common-map/-/common-map-1.0.1.tgz", "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common-map/-/common-map-1.1.1-prerelease.2031.tgz",
"integrity": "sha512-yWBM/F0RLvb6hG0QEREBamYOeaPUjIYUw2tazlQoXzVtGeNm/8S0p+3l6Uw6U3z35Zk7/Ptaeb7nXsK6dOGgWg==", "integrity": "sha512-BQ2bvNohPth0+oxoSoh+WWLJ/mP2CGW4Qf4xqgC3tgfW+UZfD0dBPl7IT2piuvOuUQzlSVloinCJ4ciZGyZRXg==",
"requires": { "requires": {
"tslib": "^2.0.0" "tslib": "^2.0.0"
} }
}, },
"@farmmaps/common-map3d": { "@farmmaps/common-map3d": {
"version": "1.0.1", "version": "1.1.1-prerelease.2031",
"resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common-map3d/-/common-map3d-1.0.1.tgz", "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common-map3d/-/common-map3d-1.1.1-prerelease.2031.tgz",
"integrity": "sha512-7aD/d1s35l8QwUPn4Z4LwxoRE4qhW+1KBAxcXEorIoc4pFTR04Mx+WoYJgTYXaOjAayPjTUM7K+bpR6d0uCqMA==", "integrity": "sha512-2M5wv5sFwlVwPGlN1b1AGM3Dh/DJFS7+L3b6e6ir2+ASoyy7xhZ67IWS2du8B7y7/xVsgxCJcJp1EJezbSCMAA==",
"requires": { "requires": {
"tslib": "^2.0.0" "tslib": "^2.0.0"
} }
@ -9897,9 +9897,9 @@
} }
}, },
"lodash": { "lodash": {
"version": "4.17.20", "version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true "dev": true
}, },
"lodash.memoize": { "lodash.memoize": {
@ -11633,9 +11633,9 @@
"dev": true "dev": true
}, },
"postcss": { "postcss": {
"version": "7.0.32", "version": "7.0.36",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.32.tgz", "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.36.tgz",
"integrity": "sha512-03eXong5NLnNCD05xscnGKGDZ98CyzoqPSMjOe6SuoQY7Z2hIj0Ld1g/O/UQRuOle2aRtiIRDg9tDcTGAkLfKw==", "integrity": "sha512-BebJSIUMwJHRH0HAQoxN4u1CN86glsrwsW0q7T+/m44eXOUAxSNdHRkNZPYz5vVUbg17hFgOQDE7fZk7li3pZw==",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "^2.4.2", "chalk": "^2.4.2",
@ -14717,9 +14717,9 @@
} }
}, },
"url-parse": { "url-parse": {
"version": "1.4.7", "version": "1.5.1",
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz", "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.1.tgz",
"integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==", "integrity": "sha512-HOfCOUJt7iSYzEx/UqgtwKRMC6EU91NFhsCHMv9oM03VJcVo2Qrp8T8kI9D7amFf1cu+/3CEhgb3rF9zL7k85Q==",
"requires": { "requires": {
"querystringify": "^2.1.1", "querystringify": "^2.1.1",
"requires-port": "^1.0.0" "requires-port": "^1.0.0"
@ -15303,9 +15303,9 @@
"dev": true "dev": true
}, },
"ws": { "ws": {
"version": "6.2.1", "version": "6.2.2",
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz",
"integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", "integrity": "sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw==",
"requires": { "requires": {
"async-limiter": "~1.0.0" "async-limiter": "~1.0.0"
} }
@ -15342,9 +15342,9 @@
} }
}, },
"y18n": { "y18n": {
"version": "4.0.0", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==",
"dev": true "dev": true
}, },
"yallist": { "yallist": {

View File

@ -19,9 +19,9 @@
"@angular/platform-browser": "~11.2.14", "@angular/platform-browser": "~11.2.14",
"@angular/platform-browser-dynamic": "~11.2.14", "@angular/platform-browser-dynamic": "~11.2.14",
"@angular/router": "~11.2.14", "@angular/router": "~11.2.14",
"@farmmaps/common": "~1.0", "@farmmaps/common": "1.1.1-prerelease.2031",
"@farmmaps/common-map": "~1.0", "@farmmaps/common-map": "1.1.1-prerelease.2031",
"@farmmaps/common-map3d": "~1.0", "@farmmaps/common-map3d": "1.1.1-prerelease.2031",
"@microsoft/signalr": "^3.1.16", "@microsoft/signalr": "^3.1.16",
"@ng-bootstrap/ng-bootstrap": "^9.0", "@ng-bootstrap/ng-bootstrap": "^9.0",
"@ngrx/effects": "^11.0", "@ngrx/effects": "^11.0",

View File

@ -257,7 +257,7 @@ export class ZoomToExtent implements Action {
export class DoQuery implements Action { export class DoQuery implements Action {
readonly type = DOQUERY; readonly type = DOQUERY;
constructor(public query:IQueryState) { } constructor(public query:IQueryState,public replace:boolean = false) { }
} }
export class SetStyle implements Action { export class SetStyle implements Action {

View File

@ -1,4 +1,5 @@
import { Component, Host, Input, OnInit, OnChanges, SimpleChanges, forwardRef } from '@angular/core'; import { Component, Host, Input, OnInit, OnChanges, SimpleChanges, forwardRef } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ViewComponent, MapComponent } from 'ngx-openlayers'; import { ViewComponent, MapComponent } from 'ngx-openlayers';
@ -9,12 +10,24 @@ import { ViewComponent, MapComponent } from 'ngx-openlayers';
export class ZoomToExtentComponent implements OnChanges { export class ZoomToExtentComponent implements OnChanges {
view: ViewComponent; view: ViewComponent;
map: MapComponent; map: MapComponent;
paddingTop: number = 0;
paddingLeft: number = 0;
paddingBottom: number = 0;
paddingRight: number = 0;
@Input() extent: number[]; @Input() extent: number[];
@Input() animate: boolean = false; @Input() animate: boolean = false;
constructor(@Host() view: ViewComponent, @Host() map: MapComponent) { constructor(@Host() view: ViewComponent, @Host() map: MapComponent,route: ActivatedRoute ) {
this.view = view; this.view = view;
this.map = map; this.map = map;
if(route && route.snapshot && route.snapshot.data && route.snapshot.data["fm-map-zoom-to-extent"]) {
let params = route.snapshot.data["fm-map-zoom-to-extent"];
this.paddingTop = params["padding-top"] ? params["padding-top"] : 0;
this.paddingBottom = params["padding-bottom"] ? params["padding-bottom"] : 0;
this.paddingLeft = params["padding-left"] ? params["padding-left"] : 0;
this.paddingRight = params["padding-right"] ? params["padding-right"] : 0;
}
} }
ngOnChanges(changes: SimpleChanges) { ngOnChanges(changes: SimpleChanges) {
@ -31,7 +44,7 @@ export class ZoomToExtentComponent implements OnChanges {
bottom = 5 * rem; bottom = 5 * rem;
left = 23 * rem; left = 23 * rem;
} }
options.padding = [top, right, bottom, left]; options.padding = [top + (this.paddingTop*rem), right+ (this.paddingRight*rem), bottom + (this.paddingBottom*rem), left+ (this.paddingLeft*rem)];
if (this.animate) options["duration"] = 1000; if (this.animate) options["duration"] = 1000;
this.view.instance.fit(this.extent, options); this.view.instance.fit(this.extent, options);
} }

View File

@ -33,8 +33,8 @@
<aol-interaction-default></aol-interaction-default> <aol-interaction-default></aol-interaction-default>
<aol-interaction-dragrotateandzoom></aol-interaction-dragrotateandzoom> <aol-interaction-dragrotateandzoom></aol-interaction-dragrotateandzoom>
<fm-map-item-layers [itemLayers]="state.baseLayers"></fm-map-item-layers> <fm-map-item-layers [itemLayers]="state.baseLayers"></fm-map-item-layers>
<fm-map-item-layers [itemLayers]="state.overlayLayers"></fm-map-item-layers> <fm-map-item-layers *ngIf="!overrideOverlayLayers" [itemLayers]="state.overlayLayers"></fm-map-item-layers>
<fm-map-item-layers [itemLayer]="state.selectedItemLayer"></fm-map-item-layers> <fm-map-item-layers *ngIf="!overrideSelectedItemLayer" [itemLayer]="state.selectedItemLayer"></fm-map-item-layers>
<aol-layer-vector> <aol-layer-vector>
<fm-map-item-source-vector [styles]="state.styles" [features]="state.features" (onFeatureSelected)="handleFeatureClick($event)" (onFeatureHover)="handleFeatureHover($event)" [selectedFeature]="state.selectedFeature" [selectedItem]="state.selectedItem"></fm-map-item-source-vector> <fm-map-item-source-vector [styles]="state.styles" [features]="state.features" (onFeatureSelected)="handleFeatureClick($event)" (onFeatureHover)="handleFeatureHover($event)" [selectedFeature]="state.selectedFeature" [selectedItem]="state.selectedItem"></fm-map-item-source-vector>
</aol-layer-vector> </aol-layer-vector>

View File

@ -61,6 +61,7 @@ aol-map { position:absolute;width:100%;height:calc(100vh + 4rem);}
top:0em; top:0em;
bottom: 7.1em; bottom: 7.1em;
width: 100%; width: 100%;
pointer-events: none;
} }
.fullscreen .side-panel-container { .fullscreen .side-panel-container {

View File

@ -11,6 +11,7 @@ import { DeviceService } from '@farmmaps/common';
import * as mapReducers from '../../reducers/map.reducer'; import * as mapReducers from '../../reducers/map.reducer';
import * as mapActions from '../../actions/map.actions'; import * as mapActions from '../../actions/map.actions';
import { IMapState} from '../../models/map.state'; import { IMapState} from '../../models/map.state';
import { IQuery } from '../../reducers/map.reducer'
import { ISelectedFeatures } from '../../models/selected.features'; import { ISelectedFeatures } from '../../models/selected.features';
import { IItemLayer } from '../../models/item.layer'; import { IItemLayer } from '../../models/item.layer';
import { IListItem, IQueryState } from '@farmmaps/common'; import { IListItem, IQueryState } from '@farmmaps/common';
@ -73,7 +74,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
public searchCollapsed$: Observable<boolean> = this.store.select(mapReducers.selectGetSearchCollapsed); public searchCollapsed$: Observable<boolean> = this.store.select(mapReducers.selectGetSearchCollapsed);
public searchMinified$: Observable<boolean> = this.store.select(mapReducers.selectGetSearchMinified); public searchMinified$: Observable<boolean> = this.store.select(mapReducers.selectGetSearchMinified);
public menuVisible$: Observable<boolean>; public menuVisible$: Observable<boolean>;
public query$: Observable<IQueryState> = this.store.select(mapReducers.selectGetQuery); public query$: Observable<IQuery> = this.store.select(mapReducers.selectGetQuery);
public position$: Observable<GeolocationPosition> = this.geolocationService.getCurrentPosition(); public position$: Observable<GeolocationPosition> = this.geolocationService.getCurrentPosition();
public compassHeading$: Observable<number> = this.deviceorientationService.getCurrentCompassHeading(); public compassHeading$: Observable<number> = this.deviceorientationService.getCurrentCompassHeading();
public baseLayersCollapsed:boolean = true; public baseLayersCollapsed:boolean = true;
@ -84,6 +85,8 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
private lastUrl = ""; private lastUrl = "";
private initialized: boolean = false; private initialized: boolean = false;
public noContent: boolean = false; public noContent: boolean = false;
public overrideSelectedItemLayer: boolean = false;
public overrideOverlayLayers: boolean = false;
@ViewChild('map') map; @ViewChild('map') map;
@ViewChild('contentDiv') contentDiv: ElementRef; @ViewChild('contentDiv') contentDiv: ElementRef;
@ -99,28 +102,33 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
private zone: NgZone, private zone: NgZone,
private deviceorientationService:DeviceOrientationService, private deviceorientationService:DeviceOrientationService,
public devicesService:DeviceService) { public devicesService:DeviceService) {
this.querySub = this.query$.pipe(skip(1), withLatestFrom(this.mapState$)).subscribe(([queryState,mapState]) =>{ if(route && route.snapshot && route.snapshot.data && route.snapshot.data["fm-map-map"]) {
if(queryState) { let params = route.snapshot.data["fm-map-map"];
this.overrideSelectedItemLayer = params["overrideSelectedItemlayer"] ? params["overrideSelectedItemlayer"] : false;
this.overrideOverlayLayers = params["overrideOverlayLayers"] ? params["overrideOverlayLayers"] : false;
}
this.querySub = this.query$.pipe(skip(1), withLatestFrom(this.mapState$)).subscribe(([query,mapState]) =>{
if(query && query.querystate) {
let newQueryState = tassign(mapReducers.initialQueryState); let newQueryState = tassign(mapReducers.initialQueryState);
console.debug(`Do Query`); console.debug(`Do Query`);
let urlparts=[]; let urlparts=[];
if (queryState.itemCode && queryState.itemCode != "") { if (query.querystate.itemCode && query.querystate.itemCode != "") {
if(queryState.itemType && queryState.itemType!= "") { if(query.querystate.itemType && query.querystate.itemType!= "") {
let itemType = this.itemTypeService.itemTypes[queryState.itemType]; let itemType = this.itemTypeService.itemTypes[query.querystate.itemType];
if (itemType && itemType.viewer && itemType.viewer == "edit_in_editor" && itemType.editor) { if (itemType && itemType.viewer && itemType.viewer == "edit_in_editor" && itemType.editor) {
urlparts.push('/editor'); urlparts.push('/editor');
urlparts.push(itemType.editor); urlparts.push(itemType.editor);
urlparts.push('item'); urlparts.push('item');
urlparts.push(queryState.itemCode); urlparts.push(query.querystate.itemCode);
} }
} }
} else { } else {
newQueryState= queryState; newQueryState= query.querystate;
} }
if(urlparts.length==0 ) { if(urlparts.length==0 ) {
newQueryState.itemCode = queryState.itemCode; newQueryState.itemCode = query.querystate.itemCode;
this.zone.run(() => { this.zone.run(() => {
this.replaceUrl(mapState,newQueryState,false); this.replaceUrl(mapState,newQueryState,query.replace);
}) })
} else { } else {
this.router.navigate(urlparts); this.router.navigate(urlparts);

View File

@ -1,10 +1,12 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Store, Action } from '@ngrx/store'; import { Store, Action,createFeatureSelector } from '@ngrx/store';
import { Effect, Actions,ofType } from '@ngrx/effects'; 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,merge} from 'rxjs'; import { EMPTY, Observable , of} from 'rxjs';
import { withLatestFrom, switchMap, map, catchError, mergeMap,tap } from 'rxjs/operators'; import { withLatestFrom, switchMap, map, catchError, mergeMap } from 'rxjs/operators';
import {GeoJSON,WKT} from 'ol/format'; import {GeoJSON,WKT} from 'ol/format';
import {Feature} from 'ol'; import {Feature} from 'ol';
@ -29,11 +31,24 @@ import * as style from 'ol/style';
import { ItemTypeService,IQueryState } from '@farmmaps/common'; import { ItemTypeService,IQueryState } from '@farmmaps/common';
import { TemporalItemLayer } from '../models/item.layer' import { TemporalItemLayer } from '../models/item.layer'
export const getRouterState = createFeatureSelector<RouterReducerState>('router');
export const {
selectCurrentRoute, // select the current route
selectQueryParams, // select the current route query params
selectQueryParam, // factory function to select a query param
selectRouteParams, // select the current route params
selectRouteParam, // factory function to select a route param
selectRouteData, // select the current route data
selectUrl, // select the current url
} = fromRouter.getSelectors(getRouterState);
@Injectable() @Injectable()
export class MapEffects { export class MapEffects {
private _geojsonFormat: GeoJSON; private _geojsonFormat: GeoJSON;
private _wktFormat: WKT; private _wktFormat: WKT;
private overrideSelectedItemLayer: boolean = false;
private toPointFeature(updateEvent:commonActions.DeviceUpdateEvent): Feature { private toPointFeature(updateEvent:commonActions.DeviceUpdateEvent): Feature {
var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{ var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
@ -46,8 +61,7 @@ export class MapEffects {
return f; return f;
} }
@Effect() init$ = createEffect(() => this.actions$.pipe(
init$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.INIT), ofType(mapActions.INIT),
withLatestFrom(this.store$.select(commonReducers.selectGetRootItems)), withLatestFrom(this.store$.select(commonReducers.selectGetRootItems)),
switchMap(([action, rootItems]) => { switchMap(([action, rootItems]) => {
@ -87,25 +101,23 @@ export class MapEffects {
return actions; return actions;
} }
)); )));
@Effect() initBaseLayers$ = createEffect(() => this.actions$.pipe(
initBaseLayers$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.INIT), ofType(mapActions.INIT),
withLatestFrom(this.store$.select(mapReducers.selectGetProjection)), withLatestFrom(this.store$.select(mapReducers.selectGetProjection)),
map(([action, projection]) => new mapActions.LoadBaseLayers(projection))); map(([action, projection]) => new mapActions.LoadBaseLayers(projection)))
);
@Effect() loadBaseLayers$ = createEffect(() => this.actions$.pipe(
loadBaseLayers$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.LOADBASELAYERS), ofType(mapActions.LOADBASELAYERS),
switchMap((action: mapActions.LoadBaseLayers) => { switchMap((action: mapActions.LoadBaseLayers) => {
return this.itemService$.getItemList("vnd.farmmaps.itemtype.layer", { "isBaseLayer": true }).pipe( return this.itemService$.getItemList("vnd.farmmaps.itemtype.layer", { "isBaseLayer": true }).pipe(
map((items: IItem[]) => new mapActions.LoadBaseLayersSuccess(items)), map((items: IItem[]) => new mapActions.LoadBaseLayersSuccess(items)),
catchError(error => of(new commonActions.Fail(error)))); catchError(error => of(new commonActions.Fail(error))));
})); })));
@Effect() startSearch$ = createEffect(() => this.actions$.pipe(
startSearch$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.STARTSEARCH), ofType(mapActions.STARTSEARCH),
switchMap((action) => { switchMap((action) => {
let a = action as mapActions.StartSearch; let a = action as mapActions.StartSearch;
@ -128,11 +140,10 @@ export class MapEffects {
return []; return [];
} }
return newAction; return newAction;
})); })));
@Effect() zoomToExtent$ = createEffect(() => this.actions$.pipe(
zoomToExtent$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.STARTSEARCHSUCCESS), ofType(mapActions.STARTSEARCHSUCCESS),
mergeMap((action: mapActions.StartSearchSuccess) => { mergeMap((action: mapActions.StartSearchSuccess) => {
let actions =[]; let actions =[];
@ -149,10 +160,9 @@ export class MapEffects {
} }
} }
return actions; return actions;
})); })));
@Effect() zoomToExtent2$ = createEffect(() => this.actions$.pipe(
zoomToExtent2$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.SETFEATURES), ofType(mapActions.SETFEATURES),
switchMap((action: mapActions.SetFeatures) => { switchMap((action: mapActions.SetFeatures) => {
let extent = createEmpty(); let extent = createEmpty();
@ -163,17 +173,15 @@ export class MapEffects {
if(action.features.length>0) return of(new mapActions.SetExtent(extent)); if(action.features.length>0) return of(new mapActions.SetExtent(extent));
} }
return EMPTY; return EMPTY;
})); })));
@Effect() hideMenu$ = createEffect(() => this.actions$.pipe(
hideMenu$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.STARTSEARCHSUCCESS), ofType(mapActions.STARTSEARCHSUCCESS),
mergeMap((action: mapActions.StartSearchSuccess) => { mergeMap((action: mapActions.StartSearchSuccess) => {
return of(new commonActions.SetMenuVisible(false)); return of(new commonActions.SetMenuVisible(false));
})); })));
@Effect() selectItem$ = createEffect(() => this.actions$.pipe(
selectItem$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.SELECTITEM), ofType(mapActions.SELECTITEM),
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)), withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)),
switchMap(([action, selectedItem]) => { switchMap(([action, selectedItem]) => {
@ -194,20 +202,19 @@ export class MapEffects {
return []; return [];
} }
} }
)); )));
@Effect() selectItemSuccessSetLayer$ = createEffect(() => this.actions$.pipe(
selectItemSuccessSetLayer$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.SELECTITEMSUCCESS), ofType(mapActions.SELECTITEMSUCCESS),
map((action:mapActions.SelectItemSuccess) => map((action:mapActions.SelectItemSuccess) =>
new mapActions.SetSelectedItemLayer(action.item) new mapActions.SetSelectedItemLayer(action.item)
) )
); ));
@Effect() selectItemSuccess$ = createEffect(() => this.actions$.pipe(
selectItemSuccess$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.SELECTITEMSUCCESS), ofType(mapActions.SELECTITEMSUCCESS),
switchMap((action:mapActions.SelectItemSuccess) => { switchMap((action:mapActions.SelectItemSuccess) => {
if(!this.overrideSelectedItemLayer) {
return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe( return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe(
map((feature: any) => { map((feature: any) => {
let f = this._geojsonFormat.readFeature(feature); let f = this._geojsonFormat.readFeature(feature);
@ -215,11 +222,13 @@ export class MapEffects {
return new mapActions.AddFeatureSuccess(f ); return new mapActions.AddFeatureSuccess(f );
}), }),
catchError(error => of(new commonActions.Fail(error)))); catchError(error => of(new commonActions.Fail(error))));
} else {
return EMPTY;
} }
)); }
)));
@Effect() selectItemSuccessTemporal$ = createEffect(() => this.actions$.pipe(
selectItemSuccessTemporal$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.SELECTITEMSUCCESS), ofType(mapActions.SELECTITEMSUCCESS),
switchMap((action:mapActions.SelectItemSuccess) => { switchMap((action:mapActions.SelectItemSuccess) => {
if(action.item.itemType == "vnd.farmmaps.itemtype.temporal") { if(action.item.itemType == "vnd.farmmaps.itemtype.temporal") {
@ -234,16 +243,14 @@ export class MapEffects {
return []; return [];
} }
} }
)); )));
@Effect() uploadedItemClick$ = createEffect(() => this.actions$.pipe(
uploadedItemClick$: Observable<Action> = this.actions$.pipe(
ofType(commonActions.UPLOADEDFILECLICK), ofType(commonActions.UPLOADEDFILECLICK),
switchMap((action: commonActions.UploadedFileClick) => of(new mapActions.DoQuery(tassign(mapReducers.initialState.query, {itemCode:action.itemCode}))) switchMap((action: commonActions.UploadedFileClick) => of(new mapActions.DoQuery(tassign(mapReducers.initialState.query.querystate, {itemCode:action.itemCode})))
)); )));
@Effect() featureUpdate$ = createEffect(() => this.actions$.pipe(
featureUpdate$: Observable<Action> = this.actions$.pipe(
ofType(commonActions.DEVICEUPDATEEVENT), ofType(commonActions.DEVICEUPDATEEVENT),
withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)), withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)),
mergeMap(([action, features]) => { mergeMap(([action, features]) => {
@ -260,10 +267,9 @@ export class MapEffects {
} else { } else {
return []; return [];
} }
})); })));
@Effect() itemUpdate$ = createEffect(() => this.actions$.pipe(
itemUpdate$: Observable<Action> = this.actions$.pipe(
ofType(commonActions.ITEMCHANGEDEVENT), ofType(commonActions.ITEMCHANGEDEVENT),
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)), withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)),
mergeMap(([action, selectedItem]) => { mergeMap(([action, selectedItem]) => {
@ -282,7 +288,7 @@ export class MapEffects {
} else { } else {
return []; return [];
} }
})); })));
getActionFromQueryState(queryState:IQueryState, inSearch:boolean):Observable<Action>|[] { getActionFromQueryState(queryState:IQueryState, inSearch:boolean):Observable<Action>|[] {
if(!inSearch && (queryState.itemType || queryState.parentCode || queryState.itemCode || queryState.query || queryState.tags)) { if(!inSearch && (queryState.itemType || queryState.parentCode || queryState.itemCode || queryState.query || queryState.tags)) {
@ -299,8 +305,7 @@ export class MapEffects {
return of(newAction); return of(newAction);
} }
@Effect() getLayerValue$ = createEffect(() => this.actions$.pipe(
getLayerValue$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.GETLAYERVALUE), ofType(mapActions.GETLAYERVALUE),
mergeMap((action:mapActions.GetLayerValue) => { mergeMap((action:mapActions.GetLayerValue) => {
var l = action.itemLayer.item.data["layers"][action.itemLayer.layerIndex]; var l = action.itemLayer.item.data["layers"][action.itemLayer.layerIndex];
@ -324,19 +329,17 @@ export class MapEffects {
return a; return a;
})) }))
} }
)); )));
@Effect() updateLayerValuesOnLayerAddedOrRemoved$ = createEffect(() => this.actions$.pipe(
updateLayerValuesOnLayerAddedOrRemoved$: Observable<Action> = this.actions$.pipe( ofType(mapActions.ADDLAYER,mapActions.REMOVELAYER,mapActions.SELECTITEMSUCCESS,mapActions.SELECTTEMPORALITEMSSUCCESS, mapActions.NEXTTEMPORAL,mapActions.PREVIOUSTEMPORAL,mapActions.TOGGLELAYERVALUESENABLED,mapActions.SETLAYERINDEX,mapActions.SETSELECTEDITEMLAYER),
ofType(mapActions.ADDLAYER,mapActions.REMOVELAYER,mapActions.SELECTITEM,mapActions.NEXTTEMPORAL,mapActions.PREVIOUSTEMPORAL,mapActions.TOGGLELAYERVALUESENABLED),
withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesX)), withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesX)),
withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesY)), withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesY)),
map(([[action,x],y]) => new mapActions.SetLayerValuesLocation(x,y)) map(([[action,x],y]) => new mapActions.SetLayerValuesLocation(x,y))
); ));
@Effect() getLayerValues$ = createEffect(() => this.actions$.pipe(
getLayerValues$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.SETLAYERVALUESLOCATION), ofType(mapActions.SETLAYERVALUESLOCATION),
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItemLayer)), withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItemLayer)),
withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesEnabled)), withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesEnabled)),
@ -362,20 +365,18 @@ export class MapEffects {
}); });
} }
return actions; return actions;
})); })));
@Effect() setState$ = createEffect(() => this.actions$.pipe(
setState$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.SETSTATE), ofType(mapActions.SETSTATE),
withLatestFrom(this.store$.select(mapReducers.selectGetInSearch)), withLatestFrom(this.store$.select(mapReducers.selectGetInSearch)),
switchMap(([action,inSearch]) => { switchMap(([action,inSearch]) => {
let a = action as mapActions.SetState; let a = action as mapActions.SetState;
return this.getActionFromQueryState(a.queryState,inSearch); return this.getActionFromQueryState(a.queryState,inSearch);
})); })));
@Effect() escape$ = createEffect(() => this.actions$.pipe(
escape$:Observable<Action> = this.actions$.pipe(
ofType(commonActions.ESCAPE), ofType(commonActions.ESCAPE),
switchMap((action) => { switchMap((action) => {
let a = action as commonActions.Escape; let a = action as commonActions.Escape;
@ -384,7 +385,21 @@ export class MapEffects {
} else { } else {
return EMPTY; return EMPTY;
} }
})); })));
setOverride$ = createEffect(() => this.actions$.pipe(
ofType(ROUTER_NAVIGATED),
switchMap(() => this.store$.select(selectRouteData as any)),
switchMap((data: any) => {
if(data && data["fm-map-map"]) {
let params = data["fm-map-map"];
this.overrideSelectedItemLayer = params["overrideSelectedItemlayer"] ? params["overrideSelectedItemlayer"] : false;
} else {
this.overrideSelectedItemLayer = false;
}
return [];
})
));
constructor(private actions$: Actions, private store$: Store<mapReducers.State>, private folderService$: FolderService, private itemService$: ItemService,private featureIconService$:FeatureIconService,private itemTypeService$:ItemTypeService) { constructor(private actions$: Actions, private store$: Store<mapReducers.State>, private folderService$: FolderService, private itemService$: ItemService,private featureIconService$:FeatureIconService,private itemTypeService$:ItemTypeService) {
this._geojsonFormat = new GeoJSON(); this._geojsonFormat = new GeoJSON();

View File

@ -33,12 +33,17 @@ export const initialQueryState: IQueryState = {
bbox: [] bbox: []
}; };
export interface IQuery {
querystate: IQueryState,
replace: boolean
}
export interface State { export interface State {
period:IPeriodState, period:IPeriodState,
mapState: IMapState, mapState: IMapState,
viewExtent: number[], viewExtent: number[],
queryState: IQueryState, queryState: IQueryState,
query:IQueryState, query:IQuery,
parentCode: string, parentCode: string,
features: Array<Feature>, features: Array<Feature>,
panelVisible: boolean, panelVisible: boolean,
@ -297,8 +302,14 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
case mapActions.DOQUERY: { case mapActions.DOQUERY: {
let a = action as mapActions.DoQuery; let a = action as mapActions.DoQuery;
return tassign(state, { return tassign(state, {
query: tassign(a.query, { bbox: a.query.bboxFilter ? state.viewExtent : [] })}); query: tassign(state.query,
{
querystate: tassign(a.query, { bbox: a.query.bboxFilter ? state.viewExtent : [] }),
replace:a.replace
})
})
} }
case mapActions.ADDFEATURESUCCESS: { case mapActions.ADDFEATURESUCCESS: {
let a = action as mapActions.AddFeatureSuccess; let a = action as mapActions.AddFeatureSuccess;
let features = state.features.slice(); let features = state.features.slice();
@ -507,6 +518,30 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
v.push(a.layervalue); v.push(a.layervalue);
return tassign(state,{layerValues:v}); return tassign(state,{layerValues:v});
} }
case commonActions.ITEMDELETEDEVENT:{
let a= action as commonActions.ItemDeletedEvent;
if(state.selectedItem && state.selectedItem.code == a.itemCode) {
return tassign(state,{
selectedItem: null,
selectedItemLayer: null,
features:[]
});
}
if(state.features.length>0) {
var index = -1;
for (var i = 0; i < state.features.length; i++) {
if (state.features[i].getId() == a.itemCode ) {
index=i;
}
}
if(index>=0) {
let newFeatures = state.features.slice(0);
newFeatures.splice(index,1);
return tassign(state,{features:newFeatures});
}
}
return state;
}
default: { default: {
return state; return state;
} }

View File

@ -7,6 +7,7 @@
transition: left 0.2s, top 0.2s; transition: left 0.2s, top 0.2s;
background-color: white; background-color: white;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.3); box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
pointer-events: all;
} }
.side-panel.resizing { .side-panel.resizing {

View File

@ -1,9 +1,9 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { OAuthService,UserInfo } from 'angular-oauth2-oidc'; import { OAuthService,UserInfo } from 'angular-oauth2-oidc';
import { Store, Action } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { Effect, Actions,ofType } from '@ngrx/effects'; import { Actions,ofType,createEffect } from '@ngrx/effects';
import { Observable , defer , of,from,zip } from 'rxjs'; import { of,from,zip } from 'rxjs';
import { withLatestFrom,mergeMap,switchMap,map,catchError,first} from 'rxjs/operators'; import { withLatestFrom,mergeMap,switchMap,map,catchError,first} from 'rxjs/operators';
import * as appCommonActions from '../actions/app-common.actions'; import * as appCommonActions from '../actions/app-common.actions';
import * as appCommonReducers from '../reducers/app-common.reducer'; import * as appCommonReducers from '../reducers/app-common.reducer';
@ -12,43 +12,37 @@ import { FolderService } from '../services/folder.service';
import { UserService } from '../services/user.service'; import { UserService } from '../services/user.service';
import { IItemTypes } from '../models/item.types'; import { IItemTypes } from '../models/item.types';
import { IListItem } from '../models/list.item'; import { IListItem } from '../models/list.item';
import { IUser } from '../models/user';
import {IQueryState} from '../models/query.state';
import {StateSerializerService} from '../services/state-serializer.service'; import {StateSerializerService} from '../services/state-serializer.service';
@Injectable() @Injectable()
export class AppCommonEffects { export class AppCommonEffects {
@Effect({ dispatch: false }) login$ = createEffect(() => this.actions$.pipe(
login$: Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.LOGIN), ofType(appCommonActions.LOGIN),
withLatestFrom(this.store$.select(appCommonReducers.selectGetInitialized)), withLatestFrom(this.store$.select(appCommonReducers.selectGetInitialized)),
mergeMap(([action, initialized]) => { mergeMap(([action, initialized]) => {
var a = (action as appCommonActions.Login); var a = (action as appCommonActions.Login);
this.oauthService$.initCodeFlow(a.url,{"prompt":"login"}); this.oauthService$.initCodeFlow(a.url,{"prompt":"login"});
return []; return [];
})); })),{dispatch:false});
@Effect({ dispatch: false }) logout$ = createEffect(() => this.actions$.pipe(
logout$: Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.LOGOUT), ofType(appCommonActions.LOGOUT),
mergeMap((action) => { mergeMap((action) => {
this.oauthService$.revokeTokenAndLogout(); this.oauthService$.revokeTokenAndLogout();
return []; return [];
})); })),{dispatch:false});
@Effect() loadItemTypes$ = createEffect(() => this.actions$.pipe(
loadItemTypes$: Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.LOADITEMTYPES), ofType(appCommonActions.LOADITEMTYPES),
switchMap((action) => { switchMap((action) => {
return this.itemService$.getItemTypes().pipe( return this.itemService$.getItemTypes().pipe(
map((itemTypes: IItemTypes) => new appCommonActions.LoadItemTypesSuccess(itemTypes)), map((itemTypes: IItemTypes) => new appCommonActions.LoadItemTypesSuccess(itemTypes)),
catchError(error => of(new appCommonActions.Fail(error)))) catchError(error => of(new appCommonActions.Fail(error))))
} }
)); )));
@Effect() initUser$ = createEffect(() => this.actions$.pipe(
initUser$: Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.INITUSER), ofType(appCommonActions.INITUSER),
first(), first(),
switchMap((action) => { switchMap((action) => {
@ -56,11 +50,10 @@ export class AppCommonEffects {
switchMap(([user,userInfo]) => {return of(new appCommonActions.InitUserSuccess(user,userInfo as UserInfo))} ), switchMap(([user,userInfo]) => {return of(new appCommonActions.InitUserSuccess(user,userInfo as UserInfo))} ),
catchError(error => of(new appCommonActions.Fail(error)))) catchError(error => of(new appCommonActions.Fail(error))))
} }
)); )));
@Effect() initUserPackages$ = createEffect(() => this.actions$.pipe(
initUserPackages$:Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.INITUSERPACKAGES), ofType(appCommonActions.INITUSERPACKAGES),
switchMap(() => { switchMap(() => {
return this.itemService$.getItemList('vnd.farmmaps.itemtype.package').pipe( return this.itemService$.getItemList('vnd.farmmaps.itemtype.package').pipe(
@ -68,10 +61,9 @@ export class AppCommonEffects {
catchError(error => of(new appCommonActions.Fail(error))) catchError(error => of(new appCommonActions.Fail(error)))
) )
}) })
); ));
@Effect() userPackagesChanged$ = createEffect(() => this.actions$.pipe(
userPackagesChanged$:Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.ITEMCHANGEDEVENT), ofType(appCommonActions.ITEMCHANGEDEVENT),
switchMap((action) => { switchMap((action) => {
let a = action as appCommonActions.ItemChangedEvent; let a = action as appCommonActions.ItemChangedEvent;
@ -80,10 +72,9 @@ export class AppCommonEffects {
else else
return []; return [];
}) })
); ));
@Effect() initUserSettingsRoot$ = createEffect(() => this.actions$.pipe(
initUserSettingsRoot$:Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.INITUSERSETTINGSROOT), ofType(appCommonActions.INITUSERSETTINGSROOT),
withLatestFrom(this.store$.select(appCommonReducers.SelectGetUser)), withLatestFrom(this.store$.select(appCommonReducers.SelectGetUser)),
switchMap(([, user]) => { switchMap(([, user]) => {
@ -92,10 +83,9 @@ export class AppCommonEffects {
catchError(error => of(new appCommonActions.Fail(error))) catchError(error => of(new appCommonActions.Fail(error)))
) )
}) })
); ));
@Effect() initUserSettingsRootChanged$ = createEffect(() => this.actions$.pipe(
initUserSettingsRootChanged$:Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.ITEMCHANGEDEVENT), ofType(appCommonActions.ITEMCHANGEDEVENT),
switchMap((action) => { switchMap((action) => {
let a = action as appCommonActions.ItemChangedEvent; let a = action as appCommonActions.ItemChangedEvent;
@ -104,38 +94,34 @@ export class AppCommonEffects {
else else
return []; return [];
}) })
); ));
@Effect() initUserSuccess$ = createEffect(() => this.actions$.pipe(
initUserSuccess$: Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.INITUSERSUCCESS), ofType(appCommonActions.INITUSERSUCCESS),
switchMap(() => { switchMap(() => {
return [new appCommonActions.InitRoot(),new appCommonActions.InitUserPackages(),new appCommonActions.InitUserSettingsRoot()]; return [new appCommonActions.InitRoot(),new appCommonActions.InitUserPackages(),new appCommonActions.InitUserSettingsRoot()];
} }
)); )));
@Effect() initRoot$ = createEffect(() => this.actions$.pipe(
initRoot$: Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.INITROOT), ofType(appCommonActions.INITROOT),
switchMap(() => { switchMap(() => {
return this.folderService$.getMyRoots().pipe( return this.folderService$.getMyRoots().pipe(
map((folders: IListItem[]) => new appCommonActions.InitRootSuccess(folders)), map((folders: IListItem[]) => new appCommonActions.InitRootSuccess(folders)),
catchError(error => of(new appCommonActions.Fail(error)))) catchError(error => of(new appCommonActions.Fail(error))))
} }
)); )));
@Effect() deleteItems$ = createEffect(() => this.actions$.pipe(
deleteItems$: Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.DELETEITEMS), ofType(appCommonActions.DELETEITEMS),
switchMap((action:appCommonActions.DeleteItems) => { switchMap((action:appCommonActions.DeleteItems) => {
return this.itemService$.deleteItems(action.itemCodes).pipe( return this.itemService$.deleteItems(action.itemCodes).pipe(
map((deletedItemCodes: string[]) => new appCommonActions.DeleteItemsSuccess(deletedItemCodes)), map((deletedItemCodes: string[]) => new appCommonActions.DeleteItemsSuccess(deletedItemCodes)),
catchError(error => of(new appCommonActions.Fail(error)))) catchError(error => of(new appCommonActions.Fail(error))))
} }
)); )));
@Effect() editItem$ = createEffect(() => this.actions$.pipe(
editItem$: Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.EDITITEM), ofType(appCommonActions.EDITITEM),
withLatestFrom(this.store$.select(appCommonReducers.selectGetItemTypes)), withLatestFrom(this.store$.select(appCommonReducers.selectGetItemTypes)),
switchMap(([action, itemtypes]) => { switchMap(([action, itemtypes]) => {
@ -148,10 +134,9 @@ export class AppCommonEffects {
this.router$.navigate(['/editor',editor,'item', a.item.code]) this.router$.navigate(['/editor',editor,'item', a.item.code])
return []; return [];
} }
)); )));
@Effect() viewItem$ = createEffect(() => this.actions$.pipe(
viewItem$: Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.VIEWITEM), ofType(appCommonActions.VIEWITEM),
withLatestFrom(this.store$.select(appCommonReducers.selectGetItemTypes)), withLatestFrom(this.store$.select(appCommonReducers.selectGetItemTypes)),
switchMap(([action, itemtypes]) => { switchMap(([action, itemtypes]) => {
@ -181,20 +166,18 @@ export class AppCommonEffects {
} }
return []; return [];
} }
)); )));
@Effect({ dispatch: false }) fail$ = createEffect(() => this.actions$.pipe(
fail$: Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.FAIL), ofType(appCommonActions.FAIL),
map((action) => { map((action) => {
let failAction = action as appCommonActions.Fail; let failAction = action as appCommonActions.Fail;
console.debug(failAction.payload) console.debug(failAction.payload)
return null; return null;
})); })),{dispatch:false});
@Effect({ dispatch: false }) online$ = createEffect(() => this.actions$.pipe(
online$: Observable<Action> = this.actions$.pipe(
ofType(appCommonActions.ONLINE), ofType(appCommonActions.ONLINE),
switchMap((action) => { switchMap((action) => {
console.debug("Online: Check token"); console.debug("Online: Check token");
@ -206,7 +189,7 @@ export class AppCommonEffects {
} }
} }
return of(undefined); return of(undefined);
})); })),{dispatch:false});

View File

@ -13,7 +13,7 @@ import {AppRootComponent} from './app.component';
import {StoreModule, ActionReducer,MetaReducer} from '@ngrx/store'; import {StoreModule, ActionReducer,MetaReducer} from '@ngrx/store';
import {EffectsModule, EffectSources} from '@ngrx/effects'; import {EffectsModule, EffectSources} from '@ngrx/effects';
import { StoreRouterConnectingModule} from '@ngrx/router-store'; import { StoreRouterConnectingModule,routerReducer} from '@ngrx/router-store';
import {AppRoutingModule} from './app-routing.module'; import {AppRoutingModule} from './app-routing.module';
import { LogoComponent } from './logo/logo.component'; import { LogoComponent } from './logo/logo.component';
@ -76,13 +76,14 @@ export const metaReducers: MetaReducer<any>[] = [debug];
AppCommonModule, AppCommonModule,
AppCommonServiceModule.forRoot(), AppCommonServiceModule.forRoot(),
BrowserModule, BrowserModule,
StoreModule.forRoot({},{metaReducers,runtimeChecks: { // TODO fix this should all be true StoreModule.forRoot({router:routerReducer},{metaReducers,runtimeChecks: { // TODO fix this should all be true
strictStateImmutability: false, strictStateImmutability: false,
strictActionImmutability: false, strictActionImmutability: false,
strictStateSerializability: false, strictStateSerializability: false,
strictActionSerializability: false strictActionSerializability: false
}}), }}),
EffectsModule.forRoot([]) StoreRouterConnectingModule.forRoot({stateKey:"router"}),
EffectsModule.forRoot([]),
], ],
providers: [ providers: [
AuthConfigFactory, AuthConfigFactory,