From b05a07a17f5b0994c39ef4b35e2cd3bd52ed45f8 Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Mon, 18 Sep 2023 14:21:40 +0200 Subject: [PATCH 1/8] refactor: move auth and avatar services to gn4 repository libs/api --- apps/datahub/src/app/app.module.ts | 3 ++- .../home/home-header/home-header.component.spec.ts | 2 +- .../src/app/home/home-header/home-header.component.ts | 2 +- .../search-header/search-header.component.spec.ts | 8 ++++---- .../search-header/search-header.component.ts | 8 ++++---- .../my-org-records/my-org-records.component.spec.ts | 3 +-- .../my-org-records/my-org-records.component.ts | 2 +- .../repository/src/lib/gn4/auth}/auth.service.spec.ts | 2 +- .../repository/src/lib/gn4/auth}/auth.service.ts | 2 +- .../src/lib/gn4/auth}/avatar.service.interface.ts | 0 .../src/lib/gn4/auth}/gravatar.service.spec.ts | 3 +-- .../repository/src/lib/gn4/auth}/gravatar.service.ts | 2 +- libs/api/repository/src/lib/gn4/auth/index.ts | 3 +++ .../src/lib/gn4}/favorites/favorites.service.spec.ts | 11 +++++------ .../src/lib/gn4}/favorites/favorites.service.ts | 11 ++++++----- libs/api/repository/src/lib/gn4/gn4-repository.ts | 5 ++++- libs/api/repository/src/lib/gn4/index.ts | 2 ++ libs/common/domain/src/lib/search/search.model.ts | 1 + libs/feature/auth/src/index.ts | 3 --- libs/feature/auth/src/lib/feature-auth.module.ts | 6 ++++-- .../favorite-star/favorite-star.component.spec.ts | 6 ++++-- .../favorite-star/favorite-star.component.ts | 6 ++++-- libs/feature/search/src/lib/state/effects.spec.ts | 6 ++++-- libs/feature/search/src/lib/state/effects.ts | 7 ++++--- 24 files changed, 59 insertions(+), 45 deletions(-) rename libs/{feature/auth/src/lib => api/repository/src/lib/gn4/auth}/auth.service.spec.ts (98%) rename libs/{feature/auth/src/lib => api/repository/src/lib/gn4/auth}/auth.service.ts (97%) rename libs/{feature/auth/src/lib/avatar => api/repository/src/lib/gn4/auth}/avatar.service.interface.ts (100%) rename libs/{feature/auth/src/lib/avatar => api/repository/src/lib/gn4/auth}/gravatar.service.spec.ts (94%) rename libs/{feature/auth/src/lib/avatar => api/repository/src/lib/gn4/auth}/gravatar.service.ts (90%) create mode 100644 libs/api/repository/src/lib/gn4/auth/index.ts rename libs/{feature/search/src/lib => api/repository/src/lib/gn4}/favorites/favorites.service.spec.ts (95%) rename libs/{feature/search/src/lib => api/repository/src/lib/gn4}/favorites/favorites.service.ts (93%) diff --git a/apps/datahub/src/app/app.module.ts b/apps/datahub/src/app/app.module.ts index 50077d6cbc..89920806f9 100644 --- a/apps/datahub/src/app/app.module.ts +++ b/apps/datahub/src/app/app.module.ts @@ -41,7 +41,7 @@ import { UtilSharedModule, getGeometryFromGeoJSON, } from '@geonetwork-ui/util/shared' -import { FeatureAuthModule, LOGIN_URL } from '@geonetwork-ui/feature/auth' +import { FeatureAuthModule } from '@geonetwork-ui/feature/auth' import { EffectsModule } from '@ngrx/effects' import { MetaReducer, StoreModule } from '@ngrx/store' import { StoreDevtoolsModule } from '@ngrx/store-devtools' @@ -69,6 +69,7 @@ import { LANGUAGES_LIST, UiCatalogModule } from '@geonetwork-ui/ui/catalog' import { METADATA_LANGUAGE } from '@geonetwork-ui/api/repository' import { BrowserAnimationsModule } from '@angular/platform-browser/animations' import { GN_UI_VERSION } from '@geonetwork-ui/feature/record' +import { LOGIN_URL } from '@geonetwork-ui/api/repository/gn4' export const metaReducers: MetaReducer[] = !environment.production ? [] : [] // https://github.com/nrwl/nx/issues/191 diff --git a/apps/datahub/src/app/home/home-header/home-header.component.spec.ts b/apps/datahub/src/app/home/home-header/home-header.component.spec.ts index 0982f0315f..7d012a453a 100644 --- a/apps/datahub/src/app/home/home-header/home-header.component.spec.ts +++ b/apps/datahub/src/app/home/home-header/home-header.component.spec.ts @@ -1,7 +1,6 @@ import { NO_ERRORS_SCHEMA } from '@angular/core' import { ComponentFixture, TestBed } from '@angular/core/testing' import { By } from '@angular/platform-browser' -import { AuthService } from '@geonetwork-ui/feature/auth' import { RouterFacade, ROUTER_ROUTE_SEARCH, @@ -18,6 +17,7 @@ import { HeaderBadgeButtonComponent } from '../header-badge-button/header-badge- import { HomeHeaderComponent } from './home-header.component' import resetAllMocks = jest.resetAllMocks import { SortByEnum } from '@geonetwork-ui/common/domain/search' +import { AuthService } from '@geonetwork-ui/api/repository/gn4' import { _setLanguages } from '@geonetwork-ui/util/app-config' jest.mock('@geonetwork-ui/util/app-config', () => { diff --git a/apps/datahub/src/app/home/home-header/home-header.component.ts b/apps/datahub/src/app/home/home-header/home-header.component.ts index db8c8e7954..6504a2c489 100644 --- a/apps/datahub/src/app/home/home-header/home-header.component.ts +++ b/apps/datahub/src/app/home/home-header/home-header.component.ts @@ -1,6 +1,5 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core' import { marker } from '@biesbjerg/ngx-translate-extract-marker' -import { AuthService } from '@geonetwork-ui/feature/auth' import { RouterFacade, ROUTER_ROUTE_SEARCH, @@ -23,6 +22,7 @@ import { ROUTER_ROUTE_NEWS } from '../../router/constants' import { lastValueFrom } from 'rxjs' import { CatalogRecord } from '@geonetwork-ui/common/domain/record' import { sortByFromString } from '@geonetwork-ui/util/shared' +import { AuthService } from '@geonetwork-ui/api/repository/gn4' marker('datahub.header.myfavorites') marker('datahub.header.lastRecords') diff --git a/apps/metadata-editor/src/app/dashboard/search-header/search-header.component.spec.ts b/apps/metadata-editor/src/app/dashboard/search-header/search-header.component.spec.ts index a5adfd459e..8f58b62611 100644 --- a/apps/metadata-editor/src/app/dashboard/search-header/search-header.component.spec.ts +++ b/apps/metadata-editor/src/app/dashboard/search-header/search-header.component.spec.ts @@ -3,10 +3,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing' import { SearchHeaderComponent } from './search-header.component' import { BehaviorSubject, of } from 'rxjs' -import { - AuthService, - AvatarServiceInterface, -} from '@geonetwork-ui/feature/auth' import { summaryHits, USER_FIXTURE } from '@geonetwork-ui/common/fixtures' import { StoreModule } from '@ngrx/store' import { EffectsModule } from '@ngrx/effects' @@ -15,6 +11,10 @@ import { TRANSLATE_DEFAULT_CONFIG } from '@geonetwork-ui/util/i18n' import { Configuration } from '@geonetwork-ui/data-access/gn4' import { OrganizationsServiceInterface } from '@geonetwork-ui/common/domain/organizations.service.interface' import { SearchFacade, SearchService } from '@geonetwork-ui/feature/search' +import { + AuthService, + AvatarServiceInterface, +} from '@geonetwork-ui/api/repository/gn4' const user = USER_FIXTURE() class AuthServiceMock { diff --git a/apps/metadata-editor/src/app/dashboard/search-header/search-header.component.ts b/apps/metadata-editor/src/app/dashboard/search-header/search-header.component.ts index 0ee68b7d8a..c339c74fcc 100644 --- a/apps/metadata-editor/src/app/dashboard/search-header/search-header.component.ts +++ b/apps/metadata-editor/src/app/dashboard/search-header/search-header.component.ts @@ -1,13 +1,13 @@ import { CommonModule } from '@angular/common' import { ChangeDetectionStrategy, Component } from '@angular/core' import { MatIconModule } from '@angular/material/icon' -import { - AuthService, - AvatarServiceInterface, -} from '@geonetwork-ui/feature/auth' import { LetDirective } from '@ngrx/component' import { FeatureSearchModule } from '@geonetwork-ui/feature/search' import { UiElementsModule } from '@geonetwork-ui/ui/elements' +import { + AuthService, + AvatarServiceInterface, +} from '@geonetwork-ui/api/repository/gn4' @Component({ selector: 'md-editor-search-header', diff --git a/apps/metadata-editor/src/app/records/my-org-records/my-org-records.component.spec.ts b/apps/metadata-editor/src/app/records/my-org-records/my-org-records.component.spec.ts index a8a489d901..7ca9a17948 100644 --- a/apps/metadata-editor/src/app/records/my-org-records/my-org-records.component.spec.ts +++ b/apps/metadata-editor/src/app/records/my-org-records/my-org-records.component.spec.ts @@ -1,5 +1,4 @@ import { ComponentFixture, TestBed } from '@angular/core/testing' - import { MyOrgRecordsComponent } from './my-org-records.component' import { SearchFacade, SearchService } from '@geonetwork-ui/feature/search' import { Component, importProvidersFrom } from '@angular/core' @@ -10,8 +9,8 @@ import { USER_FIXTURE, } from '@geonetwork-ui/common/fixtures' import { BehaviorSubject, of } from 'rxjs' -import { AuthService } from '@geonetwork-ui/feature/auth' import { OrganizationsServiceInterface } from '@geonetwork-ui/common/domain/organizations.service.interface' +import { AuthService } from '@geonetwork-ui/api/repository/gn4' const user = USER_FIXTURE() const filters = FILTERS_AGGREGATION diff --git a/apps/metadata-editor/src/app/records/my-org-records/my-org-records.component.ts b/apps/metadata-editor/src/app/records/my-org-records/my-org-records.component.ts index f703c1ff07..7a2141398e 100644 --- a/apps/metadata-editor/src/app/records/my-org-records/my-org-records.component.ts +++ b/apps/metadata-editor/src/app/records/my-org-records/my-org-records.component.ts @@ -5,8 +5,8 @@ import { RecordsListComponent } from '../records-list.component' import { SearchFacade } from '@geonetwork-ui/feature/search' import { OrganizationsServiceInterface } from '@geonetwork-ui/common/domain/organizations.service.interface' import { Organization } from '@geonetwork-ui/common/domain/record' -import { AuthService } from '@geonetwork-ui/feature/auth' import { Subscription } from 'rxjs' +import { AuthService } from '@geonetwork-ui/api/repository/gn4' @Component({ selector: 'md-editor-my-org-records', diff --git a/libs/feature/auth/src/lib/auth.service.spec.ts b/libs/api/repository/src/lib/gn4/auth/auth.service.spec.ts similarity index 98% rename from libs/feature/auth/src/lib/auth.service.spec.ts rename to libs/api/repository/src/lib/gn4/auth/auth.service.spec.ts index 1dfde80377..cf31d96fc7 100644 --- a/libs/feature/auth/src/lib/auth.service.spec.ts +++ b/libs/api/repository/src/lib/gn4/auth/auth.service.spec.ts @@ -3,7 +3,7 @@ import { Subject } from 'rxjs' import { TestBed } from '@angular/core/testing' import { MeApiService } from '@geonetwork-ui/data-access/gn4' import { TranslateService } from '@ngx-translate/core' -import { AvatarServiceInterface } from './avatar/avatar.service.interface' +import { AvatarServiceInterface } from './avatar.service.interface' const userMock = { id: '21737', diff --git a/libs/feature/auth/src/lib/auth.service.ts b/libs/api/repository/src/lib/gn4/auth/auth.service.ts similarity index 97% rename from libs/feature/auth/src/lib/auth.service.ts rename to libs/api/repository/src/lib/gn4/auth/auth.service.ts index b9d75bc6f8..820c89107b 100644 --- a/libs/feature/auth/src/lib/auth.service.ts +++ b/libs/api/repository/src/lib/gn4/auth/auth.service.ts @@ -8,7 +8,7 @@ import { UserModel } from '@geonetwork-ui/common/domain/user.model' import { TranslateService } from '@ngx-translate/core' import { Observable } from 'rxjs' import { map, shareReplay } from 'rxjs/operators' -import { AvatarServiceInterface } from './avatar/avatar.service.interface' +import { AvatarServiceInterface } from './avatar.service.interface' export const DEFAULT_GN4_LOGIN_URL = `/geonetwork/srv/\${lang3}/catalog.signin?redirect=\${current_url}` export const LOGIN_URL = new InjectionToken('loginUrl') diff --git a/libs/feature/auth/src/lib/avatar/avatar.service.interface.ts b/libs/api/repository/src/lib/gn4/auth/avatar.service.interface.ts similarity index 100% rename from libs/feature/auth/src/lib/avatar/avatar.service.interface.ts rename to libs/api/repository/src/lib/gn4/auth/avatar.service.interface.ts diff --git a/libs/feature/auth/src/lib/avatar/gravatar.service.spec.ts b/libs/api/repository/src/lib/gn4/auth/gravatar.service.spec.ts similarity index 94% rename from libs/feature/auth/src/lib/avatar/gravatar.service.spec.ts rename to libs/api/repository/src/lib/gn4/auth/gravatar.service.spec.ts index 58b114a9f4..64c2d54b05 100644 --- a/libs/feature/auth/src/lib/avatar/gravatar.service.spec.ts +++ b/libs/api/repository/src/lib/gn4/auth/gravatar.service.spec.ts @@ -1,8 +1,7 @@ import { TestBed } from '@angular/core/testing' - import { GravatarService } from './gravatar.service' import { HttpClientTestingModule } from '@angular/common/http/testing' -import { Gn4SettingsService } from '@geonetwork-ui/api/repository/gn4' +import { Gn4SettingsService } from '../settings/gn4-settings.service' import { BehaviorSubject } from 'rxjs' class Gn4SettingsServiceMock { diff --git a/libs/feature/auth/src/lib/avatar/gravatar.service.ts b/libs/api/repository/src/lib/gn4/auth/gravatar.service.ts similarity index 90% rename from libs/feature/auth/src/lib/avatar/gravatar.service.ts rename to libs/api/repository/src/lib/gn4/auth/gravatar.service.ts index d6628af125..d7839f7e3d 100644 --- a/libs/feature/auth/src/lib/avatar/gravatar.service.ts +++ b/libs/api/repository/src/lib/gn4/auth/gravatar.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core' import { AvatarServiceInterface } from './avatar.service.interface' -import { Gn4SettingsService } from '@geonetwork-ui/api/repository/gn4' +import { Gn4SettingsService } from '../settings/gn4-settings.service' @Injectable({ providedIn: 'root', diff --git a/libs/api/repository/src/lib/gn4/auth/index.ts b/libs/api/repository/src/lib/gn4/auth/index.ts new file mode 100644 index 0000000000..febcba69b2 --- /dev/null +++ b/libs/api/repository/src/lib/gn4/auth/index.ts @@ -0,0 +1,3 @@ +export * from './auth.service' +export * from './avatar.service.interface' +export * from './gravatar.service' diff --git a/libs/feature/search/src/lib/favorites/favorites.service.spec.ts b/libs/api/repository/src/lib/gn4/favorites/favorites.service.spec.ts similarity index 95% rename from libs/feature/search/src/lib/favorites/favorites.service.spec.ts rename to libs/api/repository/src/lib/gn4/favorites/favorites.service.spec.ts index 908767166c..996f947f83 100644 --- a/libs/feature/search/src/lib/favorites/favorites.service.spec.ts +++ b/libs/api/repository/src/lib/gn4/favorites/favorites.service.spec.ts @@ -1,11 +1,10 @@ import { FavoritesService } from './favorites.service' -import { AuthService } from '@geonetwork-ui/feature/auth' +import { AuthService } from '../auth/auth.service' import { MeResponseApiModel, UserselectionsApiService, } from '@geonetwork-ui/data-access/gn4' -import { of, throwError } from 'rxjs' -import { readFirst } from '@nx/angular/testing' +import { firstValueFrom, of, throwError } from 'rxjs' import { delay } from 'rxjs/operators' import { fakeAsync, tick } from '@angular/core/testing' @@ -46,7 +45,7 @@ describe('FavoritesService', () => { service = new FavoritesService(userSelectionsService, authService) }) it('returns an empty array', async () => { - const uuids = await readFirst(service.myFavoritesUuid$) + const uuids = await firstValueFrom(service.myFavoritesUuid$) expect(uuids).toEqual([]) }) }) @@ -59,7 +58,7 @@ describe('FavoritesService', () => { it('throws an error', async () => { expect.assertions(2) try { - await readFirst(service.myFavoritesUuid$) + await firstValueFrom(service.myFavoritesUuid$) } catch (e: any) { expect(e.message).toContain('fetching favorite records') expect(e.message).toContain('blargz') @@ -67,7 +66,7 @@ describe('FavoritesService', () => { }) }) it('emits a list of saved record uuids', async () => { - const uuids = await readFirst(service.myFavoritesUuid$) + const uuids = await firstValueFrom(service.myFavoritesUuid$) expect(uuids).toEqual(['abcd', 'efgh', 'ijkl']) }) describe('when subscribing multiple times', () => { diff --git a/libs/feature/search/src/lib/favorites/favorites.service.ts b/libs/api/repository/src/lib/gn4/favorites/favorites.service.ts similarity index 93% rename from libs/feature/search/src/lib/favorites/favorites.service.ts rename to libs/api/repository/src/lib/gn4/favorites/favorites.service.ts index 90f4a6cec2..b6294ceb16 100644 --- a/libs/feature/search/src/lib/favorites/favorites.service.ts +++ b/libs/api/repository/src/lib/gn4/favorites/favorites.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core' -import { combineLatest, merge, Observable, of, Subject, throwError } from 'rxjs' +import { merge, Observable, of, Subject, throwError } from 'rxjs' import { UserselectionsApiService } from '@geonetwork-ui/data-access/gn4' -import { AuthService } from '@geonetwork-ui/feature/auth' +import { AuthService } from '../auth/auth.service' import { catchError, map, @@ -32,9 +32,10 @@ export class FavoritesService { ), catchError((e) => throwError( - new Error( - `An error occurred while fetching favorite records: ${e.message}` - ) + () => + new Error( + `An error occurred while fetching favorite records: ${e.message}` + ) ) ) ) diff --git a/libs/api/repository/src/lib/gn4/gn4-repository.ts b/libs/api/repository/src/lib/gn4/gn4-repository.ts index afd3435b6d..5c2925d1ce 100644 --- a/libs/api/repository/src/lib/gn4/gn4-repository.ts +++ b/libs/api/repository/src/lib/gn4/gn4-repository.ts @@ -32,6 +32,7 @@ export class Gn4Repository implements RecordsRepositoryInterface { offset, limit, sort, + uuids, }: SearchParams): Observable { return this.gn4SearchApi .search( @@ -43,7 +44,9 @@ export class Gn4Repository implements RecordsRepositoryInterface { offset, sort, fields, - filters + filters, + undefined, + uuids ) ) ) diff --git a/libs/api/repository/src/lib/gn4/index.ts b/libs/api/repository/src/lib/gn4/index.ts index 05f2a5b285..c1ec26cc35 100644 --- a/libs/api/repository/src/lib/gn4/index.ts +++ b/libs/api/repository/src/lib/gn4/index.ts @@ -2,3 +2,5 @@ export * from './gn4-repository' export * from './organizations' export * from './elasticsearch' export * from './settings/gn4-settings.service' +export * from './auth' +export * from './favorites/favorites.service' diff --git a/libs/common/domain/src/lib/search/search.model.ts b/libs/common/domain/src/lib/search/search.model.ts index 14ee145f69..c539f360e0 100644 --- a/libs/common/domain/src/lib/search/search.model.ts +++ b/libs/common/domain/src/lib/search/search.model.ts @@ -11,6 +11,7 @@ export interface SearchParams { limit: number sort?: SortByField fields?: FieldName[] + uuids?: string[] } export interface SearchResults { diff --git a/libs/feature/auth/src/index.ts b/libs/feature/auth/src/index.ts index de9ee94d77..3f0d16020b 100644 --- a/libs/feature/auth/src/index.ts +++ b/libs/feature/auth/src/index.ts @@ -1,4 +1 @@ export * from './lib/feature-auth.module' -export * from './lib/auth.service' -export * from './lib/avatar/avatar.service.interface' -export * from './lib/avatar/gravatar.service' diff --git a/libs/feature/auth/src/lib/feature-auth.module.ts b/libs/feature/auth/src/lib/feature-auth.module.ts index eab803304c..ab533507c8 100644 --- a/libs/feature/auth/src/lib/feature-auth.module.ts +++ b/libs/feature/auth/src/lib/feature-auth.module.ts @@ -1,7 +1,9 @@ import { NgModule } from '@angular/core' import { CommonModule } from '@angular/common' -import { AvatarServiceInterface } from './avatar/avatar.service.interface' -import { GravatarService } from './avatar/gravatar.service' +import { + AvatarServiceInterface, + GravatarService, +} from '@geonetwork-ui/api/repository/gn4' @NgModule({ imports: [CommonModule], diff --git a/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.spec.ts b/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.spec.ts index be4d268102..c2ca7e8216 100644 --- a/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.spec.ts +++ b/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.spec.ts @@ -1,14 +1,16 @@ import { ComponentFixture, TestBed } from '@angular/core/testing' import { FavoriteStarComponent } from './favorite-star.component' import { BehaviorSubject, of, throwError } from 'rxjs' -import { AuthService } from '@geonetwork-ui/feature/auth' -import { FavoritesService } from '../favorites.service' import { StarToggleComponent } from '@geonetwork-ui/ui/inputs' import { By } from '@angular/platform-browser' import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core' import { TranslateModule, TranslateService } from '@ngx-translate/core' import tippy from 'tippy.js' import { DATASET_RECORDS } from '@geonetwork-ui/common/fixtures' +import { + AuthService, + FavoritesService, +} from '@geonetwork-ui/api/repository/gn4' tippy = jest.fn() class AuthServiceMock { diff --git a/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.ts b/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.ts index e78d8b2021..3af7c24285 100644 --- a/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.ts +++ b/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.ts @@ -8,14 +8,16 @@ import { OnDestroy, ViewChild, } from '@angular/core' -import { FavoritesService } from '../favorites.service' import { map, pairwise } from 'rxjs/operators' -import { AuthService } from '@geonetwork-ui/feature/auth' import tippy from 'tippy.js' import { TranslateService } from '@ngx-translate/core' import { StarToggleComponent } from '@geonetwork-ui/ui/inputs' import { Subscription } from 'rxjs' import { CatalogRecord } from '@geonetwork-ui/common/domain/record' +import { + AuthService, + FavoritesService, +} from '@geonetwork-ui/api/repository/gn4' @Component({ selector: 'gn-ui-favorite-star', diff --git a/libs/feature/search/src/lib/state/effects.spec.ts b/libs/feature/search/src/lib/state/effects.spec.ts index 50fe4d1d01..96b9c2a45d 100644 --- a/libs/feature/search/src/lib/state/effects.spec.ts +++ b/libs/feature/search/src/lib/state/effects.spec.ts @@ -1,5 +1,4 @@ import { TestBed } from '@angular/core/testing' -import { AuthService } from '@geonetwork-ui/feature/auth' import { AddResults, ClearError, @@ -43,10 +42,13 @@ import { } from '@geonetwork-ui/common/fixtures' import { HttpErrorResponse } from '@angular/common/http' import { delay } from 'rxjs/operators' -import { FavoritesService } from '../favorites/favorites.service' import { FILTER_GEOMETRY } from '../feature-search.module' import { RecordsRepositoryInterface } from '@geonetwork-ui/common/domain/records-repository.interface' import { TestScheduler } from 'rxjs/internal/testing/TestScheduler' +import { + AuthService, + FavoritesService, +} from '@geonetwork-ui/api/repository/gn4' const defaultSearchState = initialState[DEFAULT_SEARCH_KEY] const stateWithSearches = { diff --git a/libs/feature/search/src/lib/state/effects.ts b/libs/feature/search/src/lib/state/effects.ts index 18747a5f95..21fcba83a0 100644 --- a/libs/feature/search/src/lib/state/effects.ts +++ b/libs/feature/search/src/lib/state/effects.ts @@ -1,5 +1,4 @@ import { Inject, Injectable, Optional } from '@angular/core' -import { AuthService } from '@geonetwork-ui/feature/auth' import { Actions, createEffect, ofType } from '@ngrx/effects' import { select, Store } from '@ngrx/store' import { combineLatestWith, debounceTime, from, of } from 'rxjs' @@ -32,7 +31,6 @@ import { SET_SPATIAL_FILTER_ENABLED, SetError, SetIncludeOnAggregation, - SetPageSize, SetResultsAggregations, SetResultsHits, UPDATE_FILTERS, @@ -41,10 +39,13 @@ import { SearchState, SearchStateSearch } from './reducer' import { getSearchStateSearch } from './selectors' import { HttpErrorResponse } from '@angular/common/http' import { switchMapWithSearchId } from '../utils/operators/search.operator' -import { FavoritesService } from '../favorites/favorites.service' import { Geometry } from 'geojson' import { FILTER_GEOMETRY } from '../feature-search.module' import { RecordsRepositoryInterface } from '@geonetwork-ui/common/domain/records-repository.interface' +import { + AuthService, + FavoritesService, +} from '@geonetwork-ui/api/repository/gn4' @Injectable() export class SearchEffects { From c63d3239279ef0382740a41dc2fc2fec49ca59dc Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Mon, 18 Sep 2023 14:22:03 +0200 Subject: [PATCH 2/8] feat(search): reactivate filter by favorites --- .../repository/src/lib/gn4/gn4-repository.ts | 4 ++-- .../domain/src/lib/search/search.model.ts | 2 +- .../search/src/lib/state/effects.spec.ts | 23 +++++++++++++------ libs/feature/search/src/lib/state/effects.ts | 1 + 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/libs/api/repository/src/lib/gn4/gn4-repository.ts b/libs/api/repository/src/lib/gn4/gn4-repository.ts index 5c2925d1ce..8fbbf419ce 100644 --- a/libs/api/repository/src/lib/gn4/gn4-repository.ts +++ b/libs/api/repository/src/lib/gn4/gn4-repository.ts @@ -32,7 +32,7 @@ export class Gn4Repository implements RecordsRepositoryInterface { offset, limit, sort, - uuids, + filterIds, }: SearchParams): Observable { return this.gn4SearchApi .search( @@ -46,7 +46,7 @@ export class Gn4Repository implements RecordsRepositoryInterface { fields, filters, undefined, - uuids + filterIds ) ) ) diff --git a/libs/common/domain/src/lib/search/search.model.ts b/libs/common/domain/src/lib/search/search.model.ts index c539f360e0..f1f8db9661 100644 --- a/libs/common/domain/src/lib/search/search.model.ts +++ b/libs/common/domain/src/lib/search/search.model.ts @@ -11,7 +11,7 @@ export interface SearchParams { limit: number sort?: SortByField fields?: FieldName[] - uuids?: string[] + filterIds?: string[] } export interface SearchResults { diff --git a/libs/feature/search/src/lib/state/effects.spec.ts b/libs/feature/search/src/lib/state/effects.spec.ts index 96b9c2a45d..e290502ff4 100644 --- a/libs/feature/search/src/lib/state/effects.spec.ts +++ b/libs/feature/search/src/lib/state/effects.spec.ts @@ -368,8 +368,17 @@ describe('Effects', () => { }) }) - // FIXME: REACTIVATE THIS TEST - describe.skip('when asking for favorites only', () => { + it('does not filter by favorites by default', async () => { + actions$ = of(new RequestMoreResults('main')) + await firstValueFrom(effects.loadResults$) + expect(repository.search).toHaveBeenCalledWith( + expect.objectContaining({ + filterIds: undefined, + }) + ) + }) + + describe('when asking for favorites only', () => { let store: Store beforeEach(() => { store = TestBed.inject(Store) @@ -380,10 +389,10 @@ describe('Effects', () => { a: new RequestMoreResults('main'), }) const expected = hot('-(abcd)-', { - a: new AddResults(DATASET_RECORDS, 'main'), - b: new SetResultsAggregations(SAMPLE_AGGREGATIONS_RESULTS, 'main'), - c: new SetResultsHits(123, 'main'), - d: new ClearError('main'), + a: new ClearError('main'), + b: new AddResults(DATASET_RECORDS, 'main'), + c: new SetResultsAggregations(SAMPLE_AGGREGATIONS_RESULTS, 'main'), + d: new SetResultsHits(123, 'main'), }) expect(effects.loadResults$).toBeObservable(expected) }) @@ -392,7 +401,7 @@ describe('Effects', () => { await firstValueFrom(effects.loadResults$) expect(repository.search).toHaveBeenCalledWith( expect.objectContaining({ - uuids: ['fav001', 'fav002', 'fav003'], + filterIds: ['fav001', 'fav002', 'fav003'], }) ) }) diff --git a/libs/feature/search/src/lib/state/effects.ts b/libs/feature/search/src/lib/state/effects.ts index 21fcba83a0..238775d9ba 100644 --- a/libs/feature/search/src/lib/state/effects.ts +++ b/libs/feature/search/src/lib/state/effects.ts @@ -135,6 +135,7 @@ export class SearchEffects { limit: pageSize, sort, fields: state.config.source, + uuids: favorites ?? undefined, }) const aggregations$ = this.recordsRepository.aggregate( state.config.aggregations From 26f7ef2639df99549025abca35f51e2ae2dc49f0 Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Mon, 18 Sep 2023 15:00:50 +0200 Subject: [PATCH 3/8] feat(search): reactivate filter by geometry --- .../src/lib/gn4/gn4-repository.spec.ts | 5 +++- .../repository/src/lib/gn4/gn4-repository.ts | 4 ++- .../domain/src/lib/search/search.model.ts | 2 ++ .../search/src/lib/state/effects.spec.ts | 30 +++++++------------ libs/feature/search/src/lib/state/effects.ts | 16 +++++++--- 5 files changed, 32 insertions(+), 25 deletions(-) diff --git a/libs/api/repository/src/lib/gn4/gn4-repository.spec.ts b/libs/api/repository/src/lib/gn4/gn4-repository.spec.ts index 636dfa0701..83801366bb 100644 --- a/libs/api/repository/src/lib/gn4/gn4-repository.spec.ts +++ b/libs/api/repository/src/lib/gn4/gn4-repository.spec.ts @@ -111,7 +111,10 @@ describe('Gn4Repository', () => { 4, ['asc', 'field1'], ['field1', 'field2', 'field3'], - { field1: '1234', field2: { abcd: true } } + { field1: '1234', field2: { abcd: true } }, + undefined, + undefined, + undefined ) }) it('returns the given results as records', () => { diff --git a/libs/api/repository/src/lib/gn4/gn4-repository.ts b/libs/api/repository/src/lib/gn4/gn4-repository.ts index 8fbbf419ce..dd04a23046 100644 --- a/libs/api/repository/src/lib/gn4/gn4-repository.ts +++ b/libs/api/repository/src/lib/gn4/gn4-repository.ts @@ -33,6 +33,7 @@ export class Gn4Repository implements RecordsRepositoryInterface { limit, sort, filterIds, + filterGeometry, }: SearchParams): Observable { return this.gn4SearchApi .search( @@ -46,7 +47,8 @@ export class Gn4Repository implements RecordsRepositoryInterface { fields, filters, undefined, - filterIds + filterIds, + filterGeometry ) ) ) diff --git a/libs/common/domain/src/lib/search/search.model.ts b/libs/common/domain/src/lib/search/search.model.ts index f1f8db9661..569936a6d2 100644 --- a/libs/common/domain/src/lib/search/search.model.ts +++ b/libs/common/domain/src/lib/search/search.model.ts @@ -1,5 +1,6 @@ import { FieldFilters } from './filter.model' import { CatalogRecord } from '../record' +import { Geometry } from 'geojson' type FieldSort = ['desc' | 'asc', FieldName] export type SortByField = FieldSort | FieldSort[] // several sort criteria can be used! @@ -12,6 +13,7 @@ export interface SearchParams { sort?: SortByField fields?: FieldName[] filterIds?: string[] + filterGeometry?: Geometry } export interface SearchResults { diff --git a/libs/feature/search/src/lib/state/effects.spec.ts b/libs/feature/search/src/lib/state/effects.spec.ts index e290502ff4..42ebe96891 100644 --- a/libs/feature/search/src/lib/state/effects.spec.ts +++ b/libs/feature/search/src/lib/state/effects.spec.ts @@ -407,13 +407,13 @@ describe('Effects', () => { }) }) - // FIXME: REACTIVATE THIS TEST - describe.skip('when providing a filter geometry', () => { + describe('when providing a filter geometry', () => { beforeEach(() => { - effects['filterGeometry'] = Promise.resolve({ + effects['filterGeometry$'] = of({ type: 'Polygon', coordinates: [], }) + effects = TestBed.inject(SearchEffects) }) describe('when useSpatialFilter is enabled', () => { beforeEach(() => { @@ -421,12 +421,12 @@ describe('Effects', () => { new SetSpatialFilterEnabled(true, 'main') ) }) - it('passes the geometry to the ES service', async () => { + it('passes the geometry to the repository', async () => { actions$ = of(new RequestMoreResults('main')) await firstValueFrom(effects.loadResults$) expect(repository.search).toHaveBeenCalledWith( expect.objectContaining({ - geometry: { type: 'Polygon', coordinates: [] }, + filterGeometry: { type: 'Polygon', coordinates: [] }, }) ) }) @@ -437,36 +437,28 @@ describe('Effects', () => { new SetSpatialFilterEnabled(false, 'main') ) }) - it('does not pass the geometry to the ES service', async () => { + it('does not pass the geometry to the repository', async () => { actions$ = of(new RequestMoreResults('main')) await firstValueFrom(effects.loadResults$) expect(repository.search).toHaveBeenCalledWith( - expect.anything(), - expect.anything(), - expect.anything(), - undefined, - expect.anything(), - expect.anything(), - expect.anything(), - null, - null + expect.objectContaining({ filterGeometry: undefined }) ) }) }) - describe('when providing a filter geometry', () => { + describe('when the geometry promise fails', () => { beforeEach(() => { - effects['filterGeometry'] = Promise.reject('blarg') + effects['filterGeometry$'] = throwError(() => 'blarg') TestBed.inject(Store).dispatch( new SetSpatialFilterEnabled(true, 'main') ) }) - it('does not pass the geometry to the ES service', async () => { + it('does not pass the geometry to the repository', async () => { actions$ = of(new RequestMoreResults('main')) await firstValueFrom(effects.loadResults$) expect(repository.search).toHaveBeenCalledWith( expect.objectContaining({ - geometry: null, + filterGeometry: undefined, }) ) }) diff --git a/libs/feature/search/src/lib/state/effects.ts b/libs/feature/search/src/lib/state/effects.ts index 238775d9ba..40bbd1c2c8 100644 --- a/libs/feature/search/src/lib/state/effects.ts +++ b/libs/feature/search/src/lib/state/effects.ts @@ -5,6 +5,7 @@ import { combineLatestWith, debounceTime, from, of } from 'rxjs' import { catchError, map, + shareReplay, switchMap, take, withLatestFrom, @@ -49,6 +50,10 @@ import { @Injectable() export class SearchEffects { + filterGeometry$ = this.filterGeometry + ? from(this.filterGeometry).pipe(shareReplay()) + : undefined + constructor( private actions$: Actions, private store$: Store, @@ -110,10 +115,10 @@ export class SearchEffects { ) ), switchMap(([state, favorites]) => { - if (!state.params.useSpatialFilter || !this.filterGeometry) { + if (!state.params.useSpatialFilter || !this.filterGeometry$) { return of([state, favorites, null]) } - return from(this.filterGeometry).pipe( + return this.filterGeometry$.pipe( map((geom) => [state, favorites, geom]), catchError(() => of([state, favorites, null])) // silently opt out of spatial filter if an error happens ) @@ -135,12 +140,15 @@ export class SearchEffects { limit: pageSize, sort, fields: state.config.source, - uuids: favorites ?? undefined, + filterIds: + state.params.favoritesOnly && favorites + ? favorites + : undefined, + filterGeometry: geometry ?? undefined, }) const aggregations$ = this.recordsRepository.aggregate( state.config.aggregations ) - // FIXME: favorites, geometry return results$.pipe(combineLatestWith(aggregations$)) } ), From 9fbdb454fd90aecf9b409f06b11675990727b747 Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Tue, 19 Sep 2023 00:59:13 +0200 Subject: [PATCH 4/8] e2e(datahub): add a test for showing favorites only --- apps/datahub-e2e/src/e2e/home.cy.ts | 38 ++++++++++++++++++- apps/datahub-e2e/src/support/commands.ts | 36 ++++++++++++++++++ .../record-preview-feed.component.html | 5 ++- 3 files changed, 77 insertions(+), 2 deletions(-) diff --git a/apps/datahub-e2e/src/e2e/home.cy.ts b/apps/datahub-e2e/src/e2e/home.cy.ts index edc26a0b67..cb1dbec2a2 100644 --- a/apps/datahub-e2e/src/e2e/home.cy.ts +++ b/apps/datahub-e2e/src/e2e/home.cy.ts @@ -1,7 +1,13 @@ +/* eslint-disable cypress/no-unnecessary-waiting */ +import 'cypress-real-events' + describe('header', () => { - beforeEach(() => cy.visit('/home/news')) + beforeEach(() => cy.visit('/')) describe('general display', () => { + it('should end up on the news page', () => { + cy.url().should('match', /^http:\/\/localhost:[0-9]+\/news$/) + }) it('should select the right tab', () => { cy.get('datahub-navigation-menu') .find('button') @@ -70,4 +76,34 @@ describe('header', () => { cy.url().should('include', '/organisations') }) }) + + describe('my favorites button', () => { + beforeEach(() => { + cy.login() + cy.clearFavorites() + cy.visit('/') + }) + beforeEach(() => { + // select the 6th record as the new favorite + cy.get('gn-ui-results-list-item').eq(6).as('favoriteItem') + cy.get('@favoriteItem') + .find('[data-cy=recordTitle]') + .invoke('text') + .as('favoriteTitle') + cy.get('@favoriteItem').find('gn-ui-favorite-star').click() + + // show my favorites only + cy.get('datahub-header-badge-button[label$=favorites]').realClick() + }) + it('only shows one record, same as the favorite one', () => { + cy.get('gn-ui-results-list-item').should('have.length', 1) + cy.get('gn-ui-results-list-item') + .eq(0) + .find('[data-cy=recordTitle]') + .invoke('text') + .then(function (resultTitle) { + expect(resultTitle).to.eql(this.favoriteTitle) + }) + }) + }) }) diff --git a/apps/datahub-e2e/src/support/commands.ts b/apps/datahub-e2e/src/support/commands.ts index dafc568616..8489226293 100644 --- a/apps/datahub-e2e/src/support/commands.ts +++ b/apps/datahub-e2e/src/support/commands.ts @@ -13,6 +13,7 @@ declare namespace Cypress { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Chainable { login(): void + clearFavorites(): void } } @@ -29,6 +30,41 @@ Cypress.Commands.add('login', () => { cy.get('[name="gnSigninForm"]').submit() }) +/** + * This will most likely fail if the user is not logged in! + */ +Cypress.Commands.add('clearFavorites', () => { + cy.request({ + url: '/geonetwork/srv/api/me', + headers: { accept: 'application/json' }, + }) + .its('body') + .its('id') + .as('myId') + + cy.window().then(function () { + cy.request({ + url: `/geonetwork/srv/api/userselections/0/${this.myId}`, + headers: { accept: 'application/json' }, + }) + .its('body') + .as('favoritesId') + }) + + cy.getCookie('XSRF-TOKEN') + .its('value') + .then(function (token) { + const favoritesId = this.favoritesId || [] + cy.request({ + url: `/geonetwork/srv/api/userselections/0/${ + this.myId + }?uuid=${favoritesId.join('&uuid=')}`, + method: 'DELETE', + headers: { accept: 'application/json', 'X-XSRF-TOKEN': token }, + }) + }) +}) + // -- This is a parent command -- // Cypress.Commands.add('login', (email, password) => { ... }) // diff --git a/libs/ui/search/src/lib/record-preview-feed/record-preview-feed.component.html b/libs/ui/search/src/lib/record-preview-feed/record-preview-feed.component.html index 46bb8443bc..25c60138fb 100644 --- a/libs/ui/search/src/lib/record-preview-feed/record-preview-feed.component.html +++ b/libs/ui/search/src/lib/record-preview-feed/record-preview-feed.component.html @@ -54,7 +54,10 @@ [ngTemplateOutletContext]="{ $implicit: record }" > -

+

{{ record.title }}

{{ abstract }}

From ef13a257d068b0a47426d515834b17a564e2de70 Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Tue, 19 Sep 2023 09:56:12 +0200 Subject: [PATCH 5/8] feat(search): requestNewResults$ now aggregates actions by searchid Without this change, actions would be grouped together inc. with different search id, and that means this could break concurrent searches with different ids --- .../search/src/lib/state/effects.spec.ts | 18 ++++++++- libs/feature/search/src/lib/state/effects.ts | 39 ++++++++++++------- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/libs/feature/search/src/lib/state/effects.spec.ts b/libs/feature/search/src/lib/state/effects.spec.ts index 42ebe96891..1e5af29902 100644 --- a/libs/feature/search/src/lib/state/effects.spec.ts +++ b/libs/feature/search/src/lib/state/effects.spec.ts @@ -246,7 +246,7 @@ describe('Effects', () => { }) describe('several param changes in the same frame', () => { - it('only issues one new RequestNewResults action', () => { + it('only issues one new RequestNewResults action (same search id)', () => { testScheduler.run(({ hot, expectObservable }) => { actions$ = hot('-(abcd)-', { a: new SetSpatialFilterEnabled(true, 'main'), @@ -258,6 +258,22 @@ describe('Effects', () => { b: new RequestNewResults('main'), }) + expectObservable(effects.requestNewResults$).toEqual(expected) + }) + }) + it('issues one new RequestNewResults action per search id', () => { + testScheduler.run(({ hot, expectObservable }) => { + actions$ = hot('-(abcd)-', { + a: new SetSpatialFilterEnabled(true, 'main'), + b: new SetSortBy(['asc', 'fieldA'], 'main'), + c: new SetFilters({ any: 'abcd', other: 'ef' }, 'other'), + d: new Paginate(4, 'other'), + }) + const expected = hot('-(bc)', { + b: new RequestNewResults('main'), + c: new RequestNewResults('other'), + }) + expectObservable(effects.requestNewResults$).toEqual(expected) }) }) diff --git a/libs/feature/search/src/lib/state/effects.ts b/libs/feature/search/src/lib/state/effects.ts index 40bbd1c2c8..4272e79ff4 100644 --- a/libs/feature/search/src/lib/state/effects.ts +++ b/libs/feature/search/src/lib/state/effects.ts @@ -1,7 +1,7 @@ import { Inject, Injectable, Optional } from '@angular/core' import { Actions, createEffect, ofType } from '@ngrx/effects' import { select, Store } from '@ngrx/store' -import { combineLatestWith, debounceTime, from, of } from 'rxjs' +import { buffer, combineLatestWith, debounceTime, from, of } from 'rxjs' import { catchError, map, @@ -78,20 +78,31 @@ export class SearchEffects { ) ) + private actionsWithNewResults$ = this.actions$.pipe( + ofType( + SET_SORT_BY, + SET_FILTERS, + UPDATE_FILTERS, + SET_SEARCH, + SET_FAVORITES_ONLY, + SET_SPATIAL_FILTER_ENABLED, + PAGINATE, + SET_PAGE_SIZE + ) + ) + requestNewResults$ = createEffect(() => - this.actions$.pipe( - ofType( - SET_SORT_BY, - SET_FILTERS, - UPDATE_FILTERS, - SET_SEARCH, - SET_FAVORITES_ONLY, - SET_SPATIAL_FILTER_ENABLED, - PAGINATE, - SET_PAGE_SIZE - ), - debounceTime(0), - map((action: SearchActions) => new RequestNewResults(action.id)) + this.actionsWithNewResults$.pipe( + // this will aggregate actions until the debounceTime ticks + buffer(this.actionsWithNewResults$.pipe(debounceTime(0))), + switchMap((actions: SearchActions[]) => { + // once we have a list of actions emitted since last time, we can split them by search id + const requestNewResults = actions + .map((action) => action.id) + .filter((value, index, array) => array.indexOf(value) === index) + .map((searchId) => new RequestNewResults(searchId)) + return of(...requestNewResults) + }) ) ) From 2d502018df0bd129941084e2809fd5d8ca7f04eb Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Tue, 19 Sep 2023 14:08:49 +0200 Subject: [PATCH 6/8] e2e(datahub): add test for spatial filtering --- apps/datahub-e2e/src/e2e/datasets.cy.ts | 29 +++++++++++++++++++ .../src/fixtures/config-with-geometry.toml | 26 +++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 apps/datahub-e2e/src/fixtures/config-with-geometry.toml diff --git a/apps/datahub-e2e/src/e2e/datasets.cy.ts b/apps/datahub-e2e/src/e2e/datasets.cy.ts index 20a46593ca..f22f9f0e15 100644 --- a/apps/datahub-e2e/src/e2e/datasets.cy.ts +++ b/apps/datahub-e2e/src/e2e/datasets.cy.ts @@ -385,6 +385,33 @@ describe('datasets', () => { }) }) }) + + describe('filter by geometry', () => { + beforeEach(() => { + // this will enable spatial filtering + cy.intercept('GET', '/assets/configuration/default.toml', { + fixture: 'config-with-geometry.toml', + }) + cy.visit('/search') + }) + it('boosts records in the provided geometry', () => { + cy.get('gn-ui-results-list-item') + .eq(0) + .find('[data-cy=recordTitle]') + .invoke('text') + .invoke('trim') + .should( + 'eql', + 'Cartographie des sols agricoles de la plaine du Rhône' + ) + cy.get('gn-ui-results-list-item') + .eq(1) + .find('[data-cy=recordTitle]') + .invoke('text') + .invoke('trim') + .should('eql', 'Alpine Convention') + }) + }) }) describe('sorting results', () => { @@ -408,6 +435,8 @@ describe('datasets', () => { }) describe('sort by date', () => { beforeEach(() => { + // first sort by popularity + cy.get('@sortBy').find('select').select('desc,userSavedCount') cy.get('@results') .find('[data-cy="recordTitle"]') .then(($titles) => diff --git a/apps/datahub-e2e/src/fixtures/config-with-geometry.toml b/apps/datahub-e2e/src/fixtures/config-with-geometry.toml new file mode 100644 index 0000000000..6125eda6ba --- /dev/null +++ b/apps/datahub-e2e/src/fixtures/config-with-geometry.toml @@ -0,0 +1,26 @@ +[global] +geonetwork4_api_url = "/geonetwork/srv/api" +proxy_path = "" + +[theme] +primary_color = "#c82850" +secondary_color = "#001638" +main_color = "#212029" # All-purpose text color +background_color = "#fdfbff" + +[search] +filter_geometry_data = ''' +{ + "coordinates": + [[ + [6.465947342741936,46.80654432188126], + [6.465947342741936,45.65557605314669], + [8.74050023387097,45.65557605314669], + [8.74050023387097,46.80654432188126], + [6.465947342741936,46.80654432188126] + ]], + "type": "Polygon" +} +''' + +[map] From 26ed7d94046ceb7496a382a14a8214a1fab1c35d Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Tue, 19 Sep 2023 14:22:06 +0200 Subject: [PATCH 7/8] fix(ui): correctly style mat-icons in gn-ui-button --- libs/ui/inputs/src/lib/button/button.component.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/ui/inputs/src/lib/button/button.component.css b/libs/ui/inputs/src/lib/button/button.component.css index d458e57363..9287990da3 100644 --- a/libs/ui/inputs/src/lib/button/button.component.css +++ b/libs/ui/inputs/src/lib/button/button.component.css @@ -1,5 +1,5 @@ /* makes sure icons will not make the buttons grow vertically */ -mat-icon.mat-icon { - margin-top: -0.3em; - margin-bottom: -0.3em; +:host /deep/ mat-icon.mat-icon { + margin-top: -0.325em; + margin-bottom: -0.325em; } From d055be3ce0800d9904c208dddfbe391be13c5ec9 Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Tue, 19 Sep 2023 17:46:49 +0200 Subject: [PATCH 8/8] doc: better describe the effect of the filter_geometry setting --- conf/default.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/conf/default.toml b/conf/default.toml index 44903cbe7f..de4e40a1cf 100644 --- a/conf/default.toml +++ b/conf/default.toml @@ -63,11 +63,13 @@ background_color = "#fdfbff" # This section contains settings used for fine-tuning the search experience [search] + # Optional; specify a GeoJSON object to be used as filter: all records contained inside the geometry will be boosted on top, -# all records which _do not_ intersect with the geometry will be excluded; can be specified as URL or inline +# all records which do not intersect with the geometry will be shown with lower priority; can be specified as URL or inline # Note: if the GeoJSON object contains multiple features, only the geometry of the first one will be kept! # filter_geometry_url = "https://my.domain.org/assets/boundary.geojson" # filter_geometry_data = '{ "coordinates": [...], "type": "Polygon" }' + # The advanced search filters available to the user can be customized with this setting. # The following fields can be used for filtering: 'publisher', 'format', 'publicationYear', 'standard', 'inspireKeyword', 'topic', 'isSpatial', 'license' # any other field will be ignored