More refactoring

This commit is contained in:
Willem Dantuma 2020-04-21 14:54:13 +02:00
parent e41c728fb2
commit ef81b04f4e
3 changed files with 10 additions and 9 deletions

View File

@ -28,7 +28,7 @@ export abstract class AbstractFeatureListComponent {
}
getAction(feature:Feature):Action {
var newQuery: any = tassign(mapReducers.initialState.query);
var newQuery: any = tassign(mapReducers.initialState.queryState);
newQuery.parentCode = feature.get('parentCode');
newQuery.itemCode = feature.get('code');
newQuery.itemType = feature.get('itemType');

View File

@ -252,14 +252,14 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
queryStateChanged = this.serializeService.serialize(state.queryState) != this.serializeService.serialize(urlQueryState);
}
if(queryStateChanged || mapStateChanged) {
if(queryStateChanged && mapStateChanged && state.setStateCount ==0) {
return of(new mapActions.SetState(newMapState,newQueryState));
} else {
return of(null);
}
window.localStorage.setItem("FarmMapsCommonMap_mapState",this.serializeMapState(newMapState));
} else if(queryStateChanged) {
return of(new mapActions.SetQueryState(newQueryState));
} return of(null)
})).subscribe((action) => {
if(action) {
window.localStorage.setItem("FarmMapsCommonMap_mapState",this.serializeMapState(action.mapState));
if(action) {
console.debug("Url to state");
this.store.dispatch(action);
}
@ -353,6 +353,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
}
handleOnMouseDown(event: MouseEvent) {
event.stopPropagation();
this.zone.run(() =>{
this.store.dispatch(new mapActions.CollapseSearch());
});

View File

@ -269,7 +269,7 @@ export class MapEffects {
}));
getActionFromQueryState(queryState:IQueryState, inSearch:boolean):Observable<Action>|[] {
if(!inSearch && (queryState.itemType || queryState.parentCode || queryState.itemType)) {
if(!inSearch && (queryState.itemType || queryState.parentCode || queryState.itemCode)) {
var newAction:Action;
if (queryState.itemCode && queryState.itemCode != "") {
newAction= new mapActions.SelectItem(queryState.itemCode);
@ -278,7 +278,7 @@ export class MapEffects {
}
return of(newAction);
} else {
return [];
return of(new commonActions.Escape(true,false));
}
}