From 7547c792e3873277b539852021a81936f3580073 Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Mon, 18 Sep 2023 13:24:34 +0200 Subject: [PATCH] geocat: add location filter in search & location input in home page --- apps/datahub/src/app/app.module.ts | 9 +- .../home-header/home-header.component.html | 34 +++-- .../home/home-header/home-header.component.ts | 22 ++- .../elasticsearch.service.spec.ts | 27 ++-- .../elasticsearch/elasticsearch.service.ts | 33 ++--- .../router/src/lib/default/constants.ts | 2 + .../services/router-search.service.spec.ts | 57 +++++++- .../default/services/router-search.service.ts | 21 ++- .../lib/default/state/router.effects.spec.ts | 51 ++++--- .../src/lib/default/state/router.effects.ts | 37 ++++- libs/feature/search/src/index.ts | 4 + .../fuzzy-search.component.spec.ts | 3 +- .../fuzzy-search/fuzzy-search.component.ts | 20 ++- .../location-search-result.model.ts | 27 ++++ .../location-search.component.css | 0 .../location-search.component.html | 11 ++ .../location-search.component.spec.ts | 128 ++++++++++++++++++ .../location-search.component.ts | 96 +++++++++++++ .../location-search.service.spec.ts | 118 ++++++++++++++++ .../location-search.service.ts | 44 ++++++ libs/feature/search/src/lib/state/actions.ts | 23 ++++ .../search/src/lib/state/effects.spec.ts | 61 ++++++++- libs/feature/search/src/lib/state/effects.ts | 34 ++++- .../search/src/lib/state/reducer.spec.ts | 27 ++++ libs/feature/search/src/lib/state/reducer.ts | 25 ++++ .../search/src/lib/state/search.facade.ts | 26 ++++ .../feature/search/src/lib/state/selectors.ts | 9 ++ .../lib/utils/service/search.service.spec.ts | 32 +++++ .../src/lib/utils/service/search.service.ts | 11 ++ .../autocomplete/autocomplete.component.html | 2 +- .../autocomplete.component.stories.ts | 18 ++- .../autocomplete/autocomplete.component.ts | 1 + 32 files changed, 935 insertions(+), 78 deletions(-) create mode 100644 libs/feature/search/src/lib/location-search/location-search-result.model.ts create mode 100644 libs/feature/search/src/lib/location-search/location-search.component.css create mode 100644 libs/feature/search/src/lib/location-search/location-search.component.html create mode 100644 libs/feature/search/src/lib/location-search/location-search.component.spec.ts create mode 100644 libs/feature/search/src/lib/location-search/location-search.component.ts create mode 100644 libs/feature/search/src/lib/location-search/location-search.service.spec.ts create mode 100644 libs/feature/search/src/lib/location-search/location-search.service.ts diff --git a/apps/datahub/src/app/app.module.ts b/apps/datahub/src/app/app.module.ts index ba063cb92..d7a5ade21 100644 --- a/apps/datahub/src/app/app.module.ts +++ b/apps/datahub/src/app/app.module.ts @@ -13,8 +13,8 @@ import { EXTERNAL_VIEWER_URL_TEMPLATE, FeatureRecordModule, GN_UI_VERSION, - WEB_COMPONENT_EMBEDDER_URL, RecordMetaComponent, + WEB_COMPONENT_EMBEDDER_URL, } from '@geonetwork-ui/feature/record' import { DefaultRouterModule, @@ -27,6 +27,7 @@ import { import { FeatureSearchModule, FILTER_GEOMETRY, + LocationSearchComponent, RECORD_URL_TOKEN, } from '@geonetwork-ui/feature/search' import { @@ -102,6 +103,7 @@ import { matStarOutline, } from '@ng-icons/material-icons/outline' import { NgIconsModule, provideNgIconsConfig } from '@ng-icons/core' +import { ORGANIZATIONS_STRATEGY } from '@geonetwork-ui/api/repository/gn4' export const metaReducers: MetaReducer[] = !environment.production ? [] : [] @@ -173,6 +175,7 @@ export const metaReducers: MetaReducer[] = !environment.production ? [] : [] }), OrganisationsComponent, LanguageSwitcherComponent, + LocationSearchComponent, ], providers: [ provideNgIconsConfig({ @@ -237,6 +240,10 @@ export const metaReducers: MetaReducer[] = !environment.production ? [] : [] provide: ORGANIZATION_URL_TOKEN, useValue: `${ROUTER_ROUTE_SEARCH}?${ROUTE_PARAMS.PUBLISHER}=\${name}`, }, + { + provide: ORGANIZATIONS_STRATEGY, + useValue: 'groups', + }, { provide: DO_NOT_USE_DEFAULT_BASEMAP, useFactory: () => getOptionalMapConfig()?.DO_NOT_USE_DEFAULT_BASEMAP, diff --git a/apps/datahub/src/app/home/home-header/home-header.component.html b/apps/datahub/src/app/home/home-header/home-header.component.html index 9591fa2da..8231d5c26 100644 --- a/apps/datahub/src/app/home/home-header/home-header.component.html +++ b/apps/datahub/src/app/home/home-header/home-header.component.html @@ -14,19 +14,27 @@ [style.opacity]="expandRatio" [innerHTML]="'datahub.header.title.html' | translate" > - -