From 7a27df60c226439ab49731ffdefa3d401ea302b0 Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Wed, 19 Feb 2020 12:02:56 +0100 Subject: [PATCH] Implement select_as_mapitem --- package-lock.json | 12 +++++----- package.json | 4 ++-- .../src/fm/effects/app-common.effects.ts | 23 +++++++++++++++++-- src/app/menu/menu.component.ts | 3 ++- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index c2255a1..dfd7f0d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3477,9 +3477,9 @@ } }, "@farmmaps/common": { - "version": "0.0.1-prerelease.180", - "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common/-/common-0.0.1-prerelease.180.tgz", - "integrity": "sha512-CUojHUj+QR+N1+cBELqArqctCf6CklWKyHQ5QF0mutX9cHdUeWHF9bwzPlvatAqHCNogPJh62/r1oerq1ELoQw==", + "version": "0.0.1-prerelease.183", + "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common/-/common-0.0.1-prerelease.183.tgz", + "integrity": "sha512-/M4HffRHRKCRzkU9BJmxhfdDybKrKcWoD3NbofGEShcfGy9TPyeEdnrzb/RuWVNe3EWcpjz1xCuUsOIslxlFqg==", "requires": { "angular-oauth2-oidc": "^8.0.2", "ngx-uploadx": "^3.3.2", @@ -3487,9 +3487,9 @@ } }, "@farmmaps/common-map": { - "version": "0.0.1-prerelease.180", - "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common-map/-/common-map-0.0.1-prerelease.180.tgz", - "integrity": "sha512-w2kDYiAf/cCbLdeBf24zSWzwPinjtAz2/tIsQm+vStGHICEDmj4eHkAphJuEefe0KIbu91N7pNcCc9ttI9ZOpQ==", + "version": "0.0.1-prerelease.183", + "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common-map/-/common-map-0.0.1-prerelease.183.tgz", + "integrity": "sha512-wRkXnpjvEInRbZL642GBCpgNuFMY8r1uoObftGbDHHL/t5CnWkF/F5cWA3kn+qSKvIeHqy6xshQnEo9SKK8lXA==", "requires": { "ngx-openlayers": "1.0.0-next.13", "ol": "6.1.1", diff --git a/package.json b/package.json index 18760ff..440fb3e 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,8 @@ "@angular/platform-browser-dynamic": "~8.2.14", "@angular/router": "~8.2.14", "@aspnet/signalr": "^1.1.4", - "@farmmaps/common": ">=0.0.1-prerelease.180 <0.0.1", - "@farmmaps/common-map": ">=0.0.1-prerelease.180 <0.0.1", + "@farmmaps/common": ">=0.0.1-prerelease.183 <0.0.1", + "@farmmaps/common-map": ">=0.0.1-prerelease.183 <0.0.1", "@ng-bootstrap/ng-bootstrap": "^4.2.1", "@ngrx/effects": "^8.6.0", "@ngrx/router-store": "^8.6.0", diff --git a/projects/common/src/fm/effects/app-common.effects.ts b/projects/common/src/fm/effects/app-common.effects.ts index 701b07a..931e302 100644 --- a/projects/common/src/fm/effects/app-common.effects.ts +++ b/projects/common/src/fm/effects/app-common.effects.ts @@ -13,6 +13,8 @@ import { UserService } from '../services/user.service'; import { IItemTypes } from '../models/item.types'; import { IListItem } from '../models/list.item'; import { IUser } from '../models/user'; +import {IQueryState} from '../models/query.state'; +import {StateSerializerService} from '../services/state-serializer.service'; @Injectable() export class AppCommonEffects { @@ -101,7 +103,24 @@ export class AppCommonEffects { var a = action as appCommonActions.EditItem; var itemType = itemtypes[a.item.itemType]; var viewer = itemType.viewer; - this.router$.navigate(['/viewer', viewer, 'item', a.item.code]) + if(viewer == 'select_as_mapitem') { + let queryState = { + itemCode: a.item.code, + parentCode: null, + level: 1, + itemType: null, + bboxFilter: false, + query: null, + tags: null, + endDate: null, + startDate: null, + bbox: [] + }; + let query = this.stateSerializerService$.serialize(queryState); + this.router$.navigate(['/map', query ]) + } else { + this.router$.navigate(['/viewer', viewer, 'item', a.item.code]) + } return []; } )); @@ -116,7 +135,7 @@ export class AppCommonEffects { return null; })); - constructor(private actions$: Actions, private store$: Store, private oauthService$: OAuthService, private itemService$: ItemService, private folderService$:FolderService, private userService$: UserService, private router$: Router) { + constructor(private actions$: Actions, private store$: Store, private oauthService$: OAuthService, private itemService$: ItemService, private folderService$:FolderService, private userService$: UserService, private router$: Router, private stateSerializerService$:StateSerializerService) { store$.dispatch(new appCommonActions.LoadItemTypes()); } } diff --git a/src/app/menu/menu.component.ts b/src/app/menu/menu.component.ts index 4a9f0d1..79c0800 100644 --- a/src/app/menu/menu.component.ts +++ b/src/app/menu/menu.component.ts @@ -1,6 +1,7 @@ import { Component } from '@angular/core'; import {Router} from '@angular/router'; -import {mapReducers,StateSerializerService} from '@farmmaps/common-map'; +import {mapReducers} from '@farmmaps/common-map'; +import {StateSerializerService} from '@farmmaps/common'; import { tassign } from 'tassign'; @Component({