Skip to content

Commit e2c42cc

Browse files
watch for search results of alkis search
1 parent 2be8a82 commit e2c42cc

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

packages/clients/dish/src/mapConfigurations/searchConfigParams.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from '../servicesConstants'
99

1010
const groupDenkmalsuche = 'groupDenkmalsuche'
11+
export const categoryIdAlkisSearch = 'categoryIdAlkisSearch'
1112

1213
export const searchMethods = {
1314
denkmalsucheAutocomplete: {
@@ -80,7 +81,7 @@ export const searchMethods = {
8081
},
8182
alkisSearch: {
8283
groupId: groupDenkmalsuche,
83-
categoryId: 'categoryIdAlkisSearch',
84+
categoryId: categoryIdAlkisSearch,
8485
type: 'wfs',
8586
// will be set later due to mode setting
8687
url: null,

packages/clients/dish/src/polar-client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { GeoJSON } from 'ol/format'
99
import packageInfo from '../package.json'
1010
import { navigateToDenkmal } from './utils/navigateToDenkmal'
1111
import { watchActiveMaskIds } from './utils/watchActiveMaksIds'
12+
import { watchSearchResultForAlkisSearch } from './utils/watchSearchResultForAlkisSearch'
1213
import { addPlugins } from './addPlugins'
1314
import { services } from './services'
1415
import { getMapConfiguration } from './mapConfigurations/mapConfig'
@@ -44,6 +45,7 @@ export default {
4445
subscribeToExportedMap(map)
4546
// watch for changes in activeMaskIds to update beschriftung layer
4647
watchActiveMaskIds(map)
48+
watchSearchResultForAlkisSearch(map)
4749
map.$store.commit('plugin/selectionObject/setObjectId', objektId)
4850
if (typeof objektId === 'string') {
4951
zoomToInternalFeature(map, objektId, urlParams)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { MapInstance } from '@polar/core'
2+
import { categoryIdAlkisSearch } from '../mapConfigurations/searchConfigParams'
3+
4+
export function watchSearchResultForAlkisSearch(instance: MapInstance) {
5+
instance.subscribe('plugin/addressSearch/chosenAddress', (chosenAddress) => {
6+
if (chosenAddress === null) {
7+
return
8+
}
9+
const configuration =
10+
instance.$store.getters['plugin/addressSearch/addressSearchConfiguration']
11+
const configPatternKeys = configuration.searchMethods?.find(
12+
(method) => method.categoryId === categoryIdAlkisSearch
13+
).queryParameters?.patternKeys
14+
const configPatternKeysArray = Object.keys(configPatternKeys || {})
15+
const patternKeysSearchResult = Object.keys(
16+
(chosenAddress as any)?.properties || {}
17+
)
18+
19+
if (
20+
configPatternKeysArray.every((item) =>
21+
patternKeysSearchResult.includes(item)
22+
)
23+
) {
24+
console.log('### ES KLAPPT')
25+
}
26+
})
27+
}

0 commit comments

Comments
 (0)