From f867b595cf1727cb2cd8c0dc6523a62b7002a37a Mon Sep 17 00:00:00 2001 From: Florent Gravin Date: Sat, 9 Dec 2023 09:59:17 +0100 Subject: [PATCH 01/10] refactor(fields): rename GnU1Translated to KeySearchField as we search on a key term, not on a simple term --- .../search/src/lib/utils/service/fields.service.ts | 12 ++++-------- .../search/src/lib/utils/service/fields.spec.ts | 8 ++------ libs/feature/search/src/lib/utils/service/fields.ts | 2 +- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/libs/feature/search/src/lib/utils/service/fields.service.ts b/libs/feature/search/src/lib/utils/service/fields.service.ts index 8ef7ae172e..b700f4195c 100644 --- a/libs/feature/search/src/lib/utils/service/fields.service.ts +++ b/libs/feature/search/src/lib/utils/service/fields.service.ts @@ -1,7 +1,7 @@ import { Injectable, Injector } from '@angular/core' import { AbstractSearchField, - GnUiTranslationSearchField, + KeySearchField, FieldValue, FullTextSearchField, IsSpatialSearchField, @@ -36,12 +36,8 @@ export class FieldsService { private fields = { publisher: new OrganizationSearchField(this.injector), format: new SimpleSearchField('format', 'asc', this.injector), - resourceType: new GnUiTranslationSearchField( - 'resourceType', - 'asc', - this.injector - ), - representationType: new GnUiTranslationSearchField( + resourceType: new KeySearchField('resourceType', 'asc', this.injector), + representationType: new KeySearchField( 'cl_spatialRepresentationType.key', 'asc', this.injector @@ -51,7 +47,7 @@ export class FieldsService { 'desc', this.injector ), - topic: new GnUiTranslationSearchField('cl_topic.key', 'asc', this.injector), + topic: new KeySearchField('cl_topic.key', 'asc', this.injector), inspireKeyword: new SimpleSearchField( 'th_httpinspireeceuropaeutheme-theme_tree.default', 'asc', diff --git a/libs/feature/search/src/lib/utils/service/fields.spec.ts b/libs/feature/search/src/lib/utils/service/fields.spec.ts index 01b5259af5..bb3f646740 100644 --- a/libs/feature/search/src/lib/utils/service/fields.spec.ts +++ b/libs/feature/search/src/lib/utils/service/fields.spec.ts @@ -3,7 +3,7 @@ import { lastValueFrom, of } from 'rxjs' import { AbstractSearchField, FullTextSearchField, - GnUiTranslationSearchField, + KeySearchField, IsSpatialSearchField, LicenseSearchField, OrganizationSearchField, @@ -292,11 +292,7 @@ describe('search fields implementations', () => { describe('TopicSearchField', () => { beforeEach(() => { - searchField = new GnUiTranslationSearchField( - 'cl_topic.key', - 'asc', - injector - ) + searchField = new KeySearchField('cl_topic.key', 'asc', injector) }) describe('#getAvailableValues', () => { let values diff --git a/libs/feature/search/src/lib/utils/service/fields.ts b/libs/feature/search/src/lib/utils/service/fields.ts index 41949fe408..0538c14e2a 100644 --- a/libs/feature/search/src/lib/utils/service/fields.ts +++ b/libs/feature/search/src/lib/utils/service/fields.ts @@ -87,7 +87,7 @@ export class SimpleSearchField implements AbstractSearchField { } } -export class GnUiTranslationSearchField extends SimpleSearchField { +export class KeySearchField extends SimpleSearchField { private toolsApiService = this.injector.get(ToolsApiService) allTranslations = this.toolsApiService.getTranslationsPackage1('gnui').pipe( catchError(() => { From 8f7caffd0b214ae20424a8a49634cffb3dcb79fd Mon Sep 17 00:00:00 2001 From: Florent Gravin Date: Sat, 9 Dec 2023 10:31:43 +0100 Subject: [PATCH 02/10] refactor(fields): remove gn4 ToolsApi dependency fields is in the domain and should not depend on gn4 repository implementation. this should pass through the platform interface abstraction --- .../gn4/platform/gn4-platform.service.spec.ts | 30 ++++++++++++++++ .../lib/gn4/platform/gn4-platform.service.ts | 24 ++++++++++--- .../src/lib/platform.service.interface.ts | 1 + .../src/lib/utils/service/fields.spec.ts | 34 +++++++++++-------- .../search/src/lib/utils/service/fields.ts | 29 ++++------------ 5 files changed, 77 insertions(+), 41 deletions(-) diff --git a/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.spec.ts b/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.spec.ts index 804b7698e5..de14119d8b 100644 --- a/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.spec.ts +++ b/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.spec.ts @@ -1,6 +1,7 @@ import { MeApiService, SiteApiService, + ToolsApiService, UsersApiService, } from '@geonetwork-ui/data-access/gn4' import { TestBed } from '@angular/core/testing' @@ -63,9 +64,20 @@ class UsersApiServiceMock { } } +class ToolsApiServiceMock { + getTranslationsPackage1 = jest.fn(() => + of({ + 'First value': 'Translated first value', + 'Second value': 'Hello', + 'Third value': 'Bla', + }) + ) +} + describe('Gn4PlatformService', () => { let service: Gn4PlatformService let meApiService: MeApiService + let toolsApiService: ToolsApiService beforeEach(() => { TestBed.configureTestingModule({ @@ -88,10 +100,15 @@ describe('Gn4PlatformService', () => { provide: AvatarServiceInterface, useClass: AvatarServiceInterfaceMock, }, + { + provide: ToolsApiService, + useClass: ToolsApiServiceMock, + }, ], }) service = TestBed.inject(Gn4PlatformService) meApiService = TestBed.inject(MeApiService) + toolsApiService = TestBed.inject(ToolsApiService) }) it('creates', () => { @@ -161,4 +178,17 @@ describe('Gn4PlatformService', () => { }) }) }) + describe('#translateKey', () => { + it('returns translation ', async () => { + const translation = await lastValueFrom( + service.translateKey('First value') + ) + expect(translation).toEqual('Translated first value') + }) + it('fetch api translations once ', async () => { + await lastValueFrom(service.translateKey('First value')) + await lastValueFrom(service.translateKey('Second value')) + expect(toolsApiService.getTranslationsPackage1).toHaveBeenCalledTimes(1) + }) + }) }) diff --git a/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts b/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts index e90c04759f..806709982b 100644 --- a/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts +++ b/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts @@ -1,9 +1,10 @@ import { Injectable } from '@angular/core' -import { Observable, of, switchMap } from 'rxjs' -import { map, shareReplay, tap } from 'rxjs/operators' +import { firstValueFrom, Observable, of, switchMap } from 'rxjs' +import { catchError, map, shareReplay, tap } from 'rxjs/operators' import { MeApiService, SiteApiService, + ToolsApiService, UsersApiService, } from '@geonetwork-ui/data-access/gn4' import { PlatformServiceInterface } from '@geonetwork-ui/common/domain/platform.service.interface' @@ -17,7 +18,17 @@ export class Gn4PlatformService implements PlatformServiceInterface { private readonly type = 'GeoNetwork' private me$: Observable private users$: Observable - isAnonymous$: Observable + private isAnonymous$: Observable + + private keyTranslations$ = this.toolsApiService + .getTranslationsPackage1('gnui') + .pipe( + catchError(() => { + console.warn('Error while loading gnui language package') + return of({}) + }), + shareReplay(1) + ) private settings$ = of(true).pipe( switchMap(() => this.siteApiService.getSiteOrPortalDescription()), @@ -42,7 +53,8 @@ export class Gn4PlatformService implements PlatformServiceInterface { private siteApiService: SiteApiService, private meApi: MeApiService, private usersApi: UsersApiService, - private mapper: Gn4PlatformMapper + private mapper: Gn4PlatformMapper, + private toolsApiService: ToolsApiService ) { this.me$ = this.meApi.getMe().pipe( switchMap((apiUser) => this.mapper.userFromMeApi(apiUser)), @@ -85,4 +97,8 @@ export class Gn4PlatformService implements PlatformServiceInterface { getUsers(): Observable { return this.users$ } + + translateKey(key: string): Observable { + return this.keyTranslations$.pipe(map((translations) => translations[key])) + } } diff --git a/libs/common/domain/src/lib/platform.service.interface.ts b/libs/common/domain/src/lib/platform.service.interface.ts index 7872c2d052..5e5aa30eb7 100644 --- a/libs/common/domain/src/lib/platform.service.interface.ts +++ b/libs/common/domain/src/lib/platform.service.interface.ts @@ -14,4 +14,5 @@ export abstract class PlatformServiceInterface { organisation: Organization ): Observable abstract getOrganizations(): Observable + abstract translateKey(key: string): Observable } diff --git a/libs/feature/search/src/lib/utils/service/fields.spec.ts b/libs/feature/search/src/lib/utils/service/fields.spec.ts index bb3f646740..ef98c70ae8 100644 --- a/libs/feature/search/src/lib/utils/service/fields.spec.ts +++ b/libs/feature/search/src/lib/utils/service/fields.spec.ts @@ -16,6 +16,7 @@ import { OrganizationsServiceInterface } from '@geonetwork-ui/common/domain/orga import { Organization } from '@geonetwork-ui/common/domain/model/record' import { ElasticsearchService } from '@geonetwork-ui/api/repository/gn4' import { RecordsRepositoryInterface } from '@geonetwork-ui/common/domain/repository/records-repository.interface' +import { PlatformServiceInterface } from '@geonetwork-ui/common/domain/platform.service.interface' class ElasticsearchServiceMock { registerRuntimeField = jest.fn() @@ -118,14 +119,19 @@ class RecordsRepositoryMock { }) } -class ToolsApiServiceMock { - getTranslationsPackage1 = jest.fn(() => - of({ - 'First value': 'Translated first value', - 'Second value': 'Hello', - 'Third value': 'Bla', - }) - ) +class PlatformInterfaceMock { + translateKey = jest.fn((key) => { + switch (key) { + case 'First value': + return of('Translated first value') + case 'Second value': + return of('Hello') + case 'Third value': + return of('Bla') + default: + return of(null) + } + }) } const sampleOrgs: Organization[] = [ @@ -164,7 +170,7 @@ describe('search fields implementations', () => { let searchField: AbstractSearchField let esService: ElasticsearchService let repository: RecordsRepositoryInterface - let toolsService: ToolsApiService + let platformService: PlatformServiceInterface let injector: Injector beforeEach(() => { @@ -180,8 +186,8 @@ describe('search fields implementations', () => { useClass: ElasticsearchServiceMock, }, { - provide: ToolsApiService, - useClass: ToolsApiServiceMock, + provide: PlatformServiceInterface, + useClass: PlatformInterfaceMock, }, { provide: TranslateService, @@ -195,7 +201,7 @@ describe('search fields implementations', () => { }) esService = TestBed.inject(ElasticsearchService) repository = TestBed.inject(RecordsRepositoryInterface) - toolsService = TestBed.inject(ToolsApiService) + platformService = TestBed.inject(PlatformServiceInterface) injector = TestBed.inject(Injector) }) @@ -317,8 +323,8 @@ describe('search fields implementations', () => { { label: 'Translated first value (5)', value: 'First value' }, ]) }) - it('only calls the translations service once', () => { - expect(toolsService.getTranslationsPackage1).toHaveBeenCalledTimes(1) + it('calls translations 4 times', () => { + expect(platformService.translateKey).toHaveBeenCalledTimes(4) }) }) }) diff --git a/libs/feature/search/src/lib/utils/service/fields.ts b/libs/feature/search/src/lib/utils/service/fields.ts index 0538c14e2a..739d03326c 100644 --- a/libs/feature/search/src/lib/utils/service/fields.ts +++ b/libs/feature/search/src/lib/utils/service/fields.ts @@ -1,10 +1,11 @@ import { firstValueFrom, Observable, of, switchMap } from 'rxjs' -import { ToolsApiService } from '@geonetwork-ui/data-access/gn4' -import { catchError, map, shareReplay } from 'rxjs/operators' +import { map } from 'rxjs/operators' import { Injector } from '@angular/core' import { TranslateService } from '@ngx-translate/core' import { marker } from '@biesbjerg/ngx-translate-extract-marker' import { OrganizationsServiceInterface } from '@geonetwork-ui/common/domain/organizations.service.interface' +import { RecordsRepositoryInterface } from '@geonetwork-ui/common/domain/repository/records-repository.interface' +import { PlatformServiceInterface } from '@geonetwork-ui/common/domain/platform.service.interface' import { AggregationBuckets, AggregationsParams, @@ -12,7 +13,6 @@ import { FieldFilters, TermBucket, } from '@geonetwork-ui/common/domain/model/search' -import { RecordsRepositoryInterface } from '@geonetwork-ui/common/domain/repository/records-repository.interface' import { ElasticsearchService } from '@geonetwork-ui/api/repository/gn4' export type FieldValue = string | number @@ -88,27 +88,10 @@ export class SimpleSearchField implements AbstractSearchField { } export class KeySearchField extends SimpleSearchField { - private toolsApiService = this.injector.get(ToolsApiService) - allTranslations = this.toolsApiService.getTranslationsPackage1('gnui').pipe( - catchError(() => { - console.warn('Error while loading gnui language package') - return of({}) - }), - shareReplay(1) - ) + private platformService = this.injector.get(PlatformServiceInterface) - constructor( - esFieldName: string, - order: 'asc' | 'desc' = 'asc', - injector: Injector - ) { - super(esFieldName, order, injector) - } - - private async getTranslation(topicKey: string) { - return firstValueFrom( - this.allTranslations.pipe(map((translations) => translations[topicKey])) - ) + private async getTranslation(key: string) { + return firstValueFrom(this.platformService.translateKey(key)) } protected async getBucketLabel(bucket: TermBucket) { From 116284517ab0ed2d1c48d48c95ef595bf04560c9 Mon Sep 17 00:00:00 2001 From: Florent Gravin Date: Sat, 9 Dec 2023 13:51:02 +0100 Subject: [PATCH 03/10] feat(platform): add getThesaurusByLang method to fetch all keywords in the requested language. Implementation done for gn4, note that it uses a search request, with a limit of 1000, will be an issue in the long run --- .../lib/gn4/platform/gn4-platform.mapper.ts | 11 +++ .../gn4/platform/gn4-platform.service.spec.ts | 70 +++++++++++++++++++ .../lib/gn4/platform/gn4-platform.service.ts | 18 ++++- .../src/lib/platform.service.interface.ts | 11 ++- 4 files changed, 105 insertions(+), 5 deletions(-) diff --git a/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.ts b/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.ts index 14c73492f0..e0ffeb5b02 100644 --- a/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.ts +++ b/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.ts @@ -7,6 +7,7 @@ import { Injectable } from '@angular/core' import { AvatarServiceInterface } from '../auth/avatar.service.interface' import { map } from 'rxjs/operators' import { Observable, of } from 'rxjs' +import { ThesaurusModel } from '@geonetwork-ui/common/domain/model/thesaurus/thesaurus.model' @Injectable() export class Gn4PlatformMapper { @@ -43,4 +44,14 @@ export class Gn4PlatformMapper { } = apiUser return { ...apiUser, id: id + '' } as UserModel } + + thesaurusFromApi(thesaurus: any[]): ThesaurusModel { + return thesaurus.map((keyword) => { + const { uri, value } = keyword + return { + key: uri, + label: value, + } + }) + } } diff --git a/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.spec.ts b/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.spec.ts index de14119d8b..1a0909150a 100644 --- a/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.spec.ts +++ b/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.spec.ts @@ -1,5 +1,6 @@ import { MeApiService, + RegistriesApiService, SiteApiService, ToolsApiService, UsersApiService, @@ -74,10 +75,52 @@ class ToolsApiServiceMock { ) } +class RegistriesApiServiceMock { + searchKeywords = jest.fn(() => + of([ + { + values: { + fre: 'Adresses', + }, + definitions: { + fre: 'Localisation des propriétés fondée sur les identifiants des adresses, habituellement le nom de la rue, le numéro de la maison et le code postal.', + }, + coordEast: '', + coordWest: '', + coordSouth: '', + coordNorth: '', + thesaurusKey: 'external.theme.httpinspireeceuropaeutheme-theme', + uri: 'http://inspire.ec.europa.eu/theme/ad', + definition: + 'Localisation des propriétés fondée sur les identifiants des adresses, habituellement le nom de la rue, le numéro de la maison et le code postal.', + value: 'Adresses', + }, + { + values: { + fre: 'Altitude', + }, + definitions: { + fre: "Modèles numériques pour l'altitude des surfaces terrestres, glaciaires et océaniques. Comprend l'altitude terrestre, la bathymétrie et la ligne de rivage.", + }, + coordEast: '', + coordWest: '', + coordSouth: '', + coordNorth: '', + thesaurusKey: 'external.theme.httpinspireeceuropaeutheme-theme', + uri: 'http://inspire.ec.europa.eu/theme/el', + definition: + "Modèles numériques pour l'altitude des surfaces terrestres, glaciaires et océaniques. Comprend l'altitude terrestre, la bathymétrie et la ligne de rivage.", + value: 'Altitude', + }, + ]) + ) +} + describe('Gn4PlatformService', () => { let service: Gn4PlatformService let meApiService: MeApiService let toolsApiService: ToolsApiService + let registriesApiService: RegistriesApiService beforeEach(() => { TestBed.configureTestingModule({ @@ -104,11 +147,16 @@ describe('Gn4PlatformService', () => { provide: ToolsApiService, useClass: ToolsApiServiceMock, }, + { + provide: RegistriesApiService, + useClass: RegistriesApiServiceMock, + }, ], }) service = TestBed.inject(Gn4PlatformService) meApiService = TestBed.inject(MeApiService) toolsApiService = TestBed.inject(ToolsApiService) + registriesApiService = TestBed.inject(RegistriesApiService) }) it('creates', () => { @@ -191,4 +239,26 @@ describe('Gn4PlatformService', () => { expect(toolsApiService.getTranslationsPackage1).toHaveBeenCalledTimes(1) }) }) + describe('#getThesaurusByLang', () => { + it('calls api service ', async () => { + service.getThesaurusByLang('inspire', 'fre') + expect(registriesApiService.searchKeywords).toHaveBeenCalledWith( + null, + 'fre', + 1000, + 0, + null, + ['inspire'] + ) + }) + it('returns mapped thesaurus ', async () => { + const thesaurusDomain = await lastValueFrom( + service.getThesaurusByLang('inspire', 'fre') + ) + expect(thesaurusDomain).toEqual([ + { key: 'http://inspire.ec.europa.eu/theme/ad', label: 'Adresses' }, + { key: 'http://inspire.ec.europa.eu/theme/el', label: 'Altitude' }, + ]) + }) + }) }) diff --git a/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts b/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts index 806709982b..d002901764 100644 --- a/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts +++ b/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts @@ -1,8 +1,9 @@ import { Injectable } from '@angular/core' -import { firstValueFrom, Observable, of, switchMap } from 'rxjs' +import { Observable, of, switchMap } from 'rxjs' import { catchError, map, shareReplay, tap } from 'rxjs/operators' import { MeApiService, + RegistriesApiService, SiteApiService, ToolsApiService, UsersApiService, @@ -11,6 +12,7 @@ import { PlatformServiceInterface } from '@geonetwork-ui/common/domain/platform. import { UserModel } from '@geonetwork-ui/common/domain/model/user/user.model' import { Organization } from '@geonetwork-ui/common/domain/model/record' import { Gn4PlatformMapper } from './gn4-platform.mapper' +import { ThesaurusModel } from '@geonetwork-ui/common/domain/model/thesaurus/thesaurus.model' const minApiVersion = '4.2.0' @Injectable() @@ -54,7 +56,8 @@ export class Gn4PlatformService implements PlatformServiceInterface { private meApi: MeApiService, private usersApi: UsersApiService, private mapper: Gn4PlatformMapper, - private toolsApiService: ToolsApiService + private toolsApiService: ToolsApiService, + private registriesApiService: RegistriesApiService ) { this.me$ = this.meApi.getMe().pipe( switchMap((apiUser) => this.mapper.userFromMeApi(apiUser)), @@ -101,4 +104,15 @@ export class Gn4PlatformService implements PlatformServiceInterface { translateKey(key: string): Observable { return this.keyTranslations$.pipe(map((translations) => translations[key])) } + + getThesaurusByLang( + thesaurusName: string, + lang: string + ): Observable { + return this.registriesApiService + .searchKeywords(null, lang, 1000, 0, null, [thesaurusName]) + .pipe( + map((thesaurus) => this.mapper.thesaurusFromApi(thesaurus as any[])) + ) + } } diff --git a/libs/common/domain/src/lib/platform.service.interface.ts b/libs/common/domain/src/lib/platform.service.interface.ts index 5e5aa30eb7..4d9e0579dc 100644 --- a/libs/common/domain/src/lib/platform.service.interface.ts +++ b/libs/common/domain/src/lib/platform.service.interface.ts @@ -1,6 +1,7 @@ -import { Observable } from 'rxjs' -import { UserModel } from './model/user/user.model' -import { Organization } from './model/record/organization.model' +import type { Observable } from 'rxjs' +import type { UserModel } from './model/user/user.model' +import type { Organization } from './model/record/organization.model' +import type { ThesaurusModel } from './model/thesaurus/' export abstract class PlatformServiceInterface { abstract getType(): string @@ -15,4 +16,8 @@ export abstract class PlatformServiceInterface { ): Observable abstract getOrganizations(): Observable abstract translateKey(key: string): Observable + abstract getThesaurusByLang( + thesaurusName: string, + lang: string + ): Observable } From fb7712ca5e36e49c5c26cdc6f1fbeb78ff866be8 Mon Sep 17 00:00:00 2001 From: Florent Gravin Date: Sat, 9 Dec 2023 13:51:30 +0100 Subject: [PATCH 04/10] feat(fields): add a thesaurus field for inspire --- .../lib/utils/service/fields.service.spec.ts | 27 ++++++++++++ .../src/lib/utils/service/fields.service.ts | 8 ++-- .../src/lib/utils/service/fields.spec.ts | 43 +++++++++++++++++-- .../search/src/lib/utils/service/fields.ts | 40 +++++++++++++++-- 4 files changed, 108 insertions(+), 10 deletions(-) diff --git a/libs/feature/search/src/lib/utils/service/fields.service.spec.ts b/libs/feature/search/src/lib/utils/service/fields.service.spec.ts index 138965ffba..ef0cb50883 100644 --- a/libs/feature/search/src/lib/utils/service/fields.service.spec.ts +++ b/libs/feature/search/src/lib/utils/service/fields.service.spec.ts @@ -6,6 +6,7 @@ import { TranslateModule } from '@ngx-translate/core' import { OrganizationsServiceInterface } from '@geonetwork-ui/common/domain/organizations.service.interface' import { RecordsRepositoryInterface } from '@geonetwork-ui/common/domain/repository/records-repository.interface' import { ElasticsearchService } from '@geonetwork-ui/api/repository/gn4' +import { PlatformServiceInterface } from '@geonetwork-ui/common/domain/platform.service.interface' class RecordsRepositoryMock { aggregate = jest.fn(() => EMPTY) @@ -27,6 +28,28 @@ class OrganisationsServiceMock { ) } +class PlatformServiceInterfaceMock { + translateKey = jest.fn((key) => { + switch (key) { + case 'First value': + return of('Translated first value') + case 'Second value': + return of('Hello') + case 'Third value': + return of('Bla') + default: + return of(null) + } + }) + getThesaurusByLang = jest.fn((thesaurusName: string, lang: string) => + of([ + { key: 'First value', label: 'Rivière' }, + { key: 'Second value', label: 'Forêt' }, + { key: 'Third value', label: 'Planète' }, + ]) + ) +} + describe('FieldsService', () => { let service: FieldsService @@ -50,6 +73,10 @@ describe('FieldsService', () => { provide: OrganizationsServiceInterface, useClass: OrganisationsServiceMock, }, + { + provide: PlatformServiceInterface, + useClass: PlatformServiceInterfaceMock, + }, ], }) }) diff --git a/libs/feature/search/src/lib/utils/service/fields.service.ts b/libs/feature/search/src/lib/utils/service/fields.service.ts index b700f4195c..0009fb737c 100644 --- a/libs/feature/search/src/lib/utils/service/fields.service.ts +++ b/libs/feature/search/src/lib/utils/service/fields.service.ts @@ -1,14 +1,15 @@ import { Injectable, Injector } from '@angular/core' import { AbstractSearchField, - KeySearchField, FieldValue, FullTextSearchField, IsSpatialSearchField, + KeySearchField, LicenseSearchField, OrganizationSearchField, OwnerSearchField, SimpleSearchField, + ThesaurusField, } from './fields' import { forkJoin, Observable, of } from 'rxjs' import { map } from 'rxjs/operators' @@ -48,8 +49,9 @@ export class FieldsService { this.injector ), topic: new KeySearchField('cl_topic.key', 'asc', this.injector), - inspireKeyword: new SimpleSearchField( - 'th_httpinspireeceuropaeutheme-theme_tree.default', + inspireKeyword: new ThesaurusField( + 'th_httpinspireeceuropaeutheme-theme.link', + 'external.theme.httpinspireeceuropaeutheme-theme', 'asc', this.injector ), diff --git a/libs/feature/search/src/lib/utils/service/fields.spec.ts b/libs/feature/search/src/lib/utils/service/fields.spec.ts index ef98c70ae8..4eb951fb92 100644 --- a/libs/feature/search/src/lib/utils/service/fields.spec.ts +++ b/libs/feature/search/src/lib/utils/service/fields.spec.ts @@ -1,13 +1,13 @@ -import { ToolsApiService } from '@geonetwork-ui/data-access/gn4' import { lastValueFrom, of } from 'rxjs' import { AbstractSearchField, FullTextSearchField, - KeySearchField, IsSpatialSearchField, + KeySearchField, LicenseSearchField, OrganizationSearchField, SimpleSearchField, + ThesaurusField, } from './fields' import { TestBed } from '@angular/core/testing' import { Injector } from '@angular/core' @@ -132,6 +132,13 @@ class PlatformInterfaceMock { return of(null) } }) + getThesaurusByLang = jest.fn((thesaurusName: string, lang: string) => + of([ + { key: 'First value', label: 'Rivière' }, + { key: 'Second value', label: 'Forêt' }, + { key: 'Third value', label: 'Planète' }, + ]) + ) } const sampleOrgs: Organization[] = [ @@ -296,7 +303,7 @@ describe('search fields implementations', () => { }) }) - describe('TopicSearchField', () => { + describe('KeySearchField', () => { beforeEach(() => { searchField = new KeySearchField('cl_topic.key', 'asc', injector) }) @@ -328,6 +335,36 @@ describe('search fields implementations', () => { }) }) }) + describe('ThesaurusField', () => { + beforeEach(() => { + searchField = new ThesaurusField( + 'th_inspire.link', + 'inspire', + 'asc', + injector + ) + }) + describe('#getAvailableValues', () => { + let values + beforeEach(async () => { + values = await lastValueFrom(searchField.getAvailableValues()) + }) + it('calls search with a simple unsorted terms', () => { + expect(platformService.getThesaurusByLang).toHaveBeenCalledWith( + 'inspire', + 'fre' + ) + }) + it('returns a list of values sorted by translated labels', () => { + expect(values).toEqual([ + { label: 'Forêt (3)', value: 'Second value' }, + { label: 'Fourth value (1)', value: 'Fourth value' }, + { label: 'Planète (12)', value: 'Third value' }, + { label: 'Rivière (5)', value: 'First value' }, + ]) + }) + }) + }) describe('FullTextSearchField', () => { beforeEach(() => { diff --git a/libs/feature/search/src/lib/utils/service/fields.ts b/libs/feature/search/src/lib/utils/service/fields.ts index 739d03326c..620816003d 100644 --- a/libs/feature/search/src/lib/utils/service/fields.ts +++ b/libs/feature/search/src/lib/utils/service/fields.ts @@ -1,5 +1,5 @@ -import { firstValueFrom, Observable, of, switchMap } from 'rxjs' -import { map } from 'rxjs/operators' +import { firstValueFrom, Observable, of, switchMap, tap } from 'rxjs' +import { catchError, map, shareReplay } from 'rxjs/operators' import { Injector } from '@angular/core' import { TranslateService } from '@ngx-translate/core' import { marker } from '@biesbjerg/ngx-translate-extract-marker' @@ -14,6 +14,7 @@ import { TermBucket, } from '@geonetwork-ui/common/domain/model/search' import { ElasticsearchService } from '@geonetwork-ui/api/repository/gn4' +import { LangService } from '@geonetwork-ui/util/i18n' export type FieldValue = string | number export interface FieldAvailableValue { @@ -88,9 +89,9 @@ export class SimpleSearchField implements AbstractSearchField { } export class KeySearchField extends SimpleSearchField { - private platformService = this.injector.get(PlatformServiceInterface) + protected platformService = this.injector.get(PlatformServiceInterface) - private async getTranslation(key: string) { + protected async getTranslation(key: string) { return firstValueFrom(this.platformService.translateKey(key)) } @@ -110,6 +111,37 @@ export class KeySearchField extends SimpleSearchField { } } +export class ThesaurusField extends KeySearchField { + private langService = this.injector.get(LangService) + private thesaurus$ = this.platformService + .getThesaurusByLang(this.thesaurusName, this.langService.iso3) + .pipe( + catchError(() => { + console.warn('Error while loading thesaurus language package') + return of([]) + }), + shareReplay(1) + ) + + constructor( + esFieldName: string, + protected thesaurusName: string, + order: 'asc' | 'desc' = 'asc', + injector: Injector + ) { + super(esFieldName, order, injector) + } + protected async getTranslation(key: string) { + return firstValueFrom( + this.thesaurus$.pipe( + map( + (thesaurus) => thesaurus.find((keyword) => keyword.key === key)?.label + ) + ) + ) + } +} + export class FullTextSearchField implements AbstractSearchField { getAvailableValues(): Observable { return of([]) From 4174c0b1a6772bb7a994735076f47b1e980c29ac Mon Sep 17 00:00:00 2001 From: Florent Gravin Date: Sat, 9 Dec 2023 14:52:24 +0100 Subject: [PATCH 05/10] fix(quality): handle i18n in quality widget items --- .../metadata-quality-item.component.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libs/ui/elements/src/lib/metadata-quality-item/metadata-quality-item.component.ts b/libs/ui/elements/src/lib/metadata-quality-item/metadata-quality-item.component.ts index 0f0e1d60d7..57c75a1bb0 100644 --- a/libs/ui/elements/src/lib/metadata-quality-item/metadata-quality-item.component.ts +++ b/libs/ui/elements/src/lib/metadata-quality-item/metadata-quality-item.component.ts @@ -1,4 +1,22 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core' +import { marker } from '@biesbjerg/ngx-translate-extract-marker' + +marker('record.metadata.quality.title.success') +marker('record.metadata.quality.title.failed') +marker('record.metadata.quality.description.success') +marker('record.metadata.quality.description.failed') +marker('record.metadata.quality.topic.success') +marker('record.metadata.quality.topic.failed') +marker('record.metadata.quality.keywords.success') +marker('record.metadata.quality.keywords.failed') +marker('record.metadata.quality.legalConstraints.success') +marker('record.metadata.quality.legalConstraints.failed') +marker('record.metadata.quality.contact.success') +marker('record.metadata.quality.contact.failed') +marker('record.metadata.quality.updateFrequency.success') +marker('record.metadata.quality.updateFrequency.failed') +marker('record.metadata.quality.organisation.success') +marker('record.metadata.quality.organisation.failed') export interface MetadataQualityItem { name: string From 54398b4f3f4cc1c8f24988067d0683cd45946ea1 Mon Sep 17 00:00:00 2001 From: Florent Gravin Date: Sat, 9 Dec 2023 14:53:26 +0100 Subject: [PATCH 06/10] fix(figures): handle i18n for titles --- .../app/home/news-page/key-figures/key-figures.component.html | 4 ++-- .../app/home/news-page/key-figures/key-figures.component.ts | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/datahub/src/app/home/news-page/key-figures/key-figures.component.html b/apps/datahub/src/app/home/news-page/key-figures/key-figures.component.html index 943dab7b50..3bc2976030 100644 --- a/apps/datahub/src/app/home/news-page/key-figures/key-figures.component.html +++ b/apps/datahub/src/app/home/news-page/key-figures/key-figures.component.html @@ -4,7 +4,7 @@ class="py-[37px] pl-[47px] rounded-lg border bg-white mb-5 card-shadow cursor-pointer" [figure]="recordsCount$ | async" [icon]="'folder_open'" - [title]="'catalog.figures.datasets'" + title="catalog.figures.datasets" [color]="'secondary'" > @@ -13,7 +13,7 @@ class="py-[37px] pl-[47px] rounded-lg bg-white border card-shadow cursor-pointer" [figure]="orgsCount$ | async" [icon]="'corporate_fare'" - [title]="'catalog.figures.organisations'" + title="catalog.figures.organisations" [color]="'secondary'" > diff --git a/apps/datahub/src/app/home/news-page/key-figures/key-figures.component.ts b/apps/datahub/src/app/home/news-page/key-figures/key-figures.component.ts index a732d66ac9..bee90f8cfe 100644 --- a/apps/datahub/src/app/home/news-page/key-figures/key-figures.component.ts +++ b/apps/datahub/src/app/home/news-page/key-figures/key-figures.component.ts @@ -4,6 +4,10 @@ import { RecordsService } from '@geonetwork-ui/feature/catalog' import { ROUTER_ROUTE_SEARCH } from '@geonetwork-ui/feature/router' import { ROUTER_ROUTE_ORGANISATIONS } from '../../../router/constants' import { OrganizationsServiceInterface } from '@geonetwork-ui/common/domain/organizations.service.interface' +import { marker } from '@biesbjerg/ngx-translate-extract-marker' + +marker('catalog.figures.datasets') +marker('catalog.figures.organisations') @Component({ selector: 'datahub-key-figures', From a121dd15252f403f573c9649a0a229b13606d602 Mon Sep 17 00:00:00 2001 From: Florent Gravin Date: Sat, 9 Dec 2023 14:54:57 +0100 Subject: [PATCH 07/10] fix(i18n): regenerate translations, from fixes --- translations/de.json | 25 +++++++++++++++++--- translations/en.json | 44 ++++++++++++++++++------------------ translations/es.json | 44 ++++++++++++++++++------------------ translations/fr.json | 44 ++++++++++++++++++------------------ translations/it.json | 44 ++++++++++++++++++------------------ translations/nl.json | 44 ++++++++++++++++++------------------ translations/pt.json | 44 ++++++++++++++++++------------------ translations/sk.json | 54 +++++++++++++++++++++++++++++++++++++++++++- 8 files changed, 207 insertions(+), 136 deletions(-) diff --git a/translations/de.json b/translations/de.json index 8755763492..265c7765d6 100644 --- a/translations/de.json +++ b/translations/de.json @@ -26,10 +26,10 @@ "dashboard.records.noUser": "", "dashboard.records.publishedRecords": "", "dashboard.records.search": "", - "dashboard.records.users": "", - "dashboard.records.username": "", "dashboard.records.userDetail": "", "dashboard.records.userEmail": "", + "dashboard.records.username": "", + "dashboard.records.users": "", "datafeeder.analysisProgressBar.illustration.fileFormatDetection": "Dateiformat-Erkennung", "datafeeder.analysisProgressBar.illustration.gatheringDatasetInformation": "Sammeln von Datensatzinformationen", "datafeeder.analysisProgressBar.illustration.samplingData": "Datenauswahl", @@ -207,6 +207,24 @@ "record.metadata.origin": "Über die Daten", "record.metadata.preview": "Vorschau", "record.metadata.publications": "Veröffentlichungen", + "record.metadata.quality": "", + "record.metadata.quality.contact.failed": "", + "record.metadata.quality.contact.success": "", + "record.metadata.quality.description.failed": "", + "record.metadata.quality.description.success": "", + "record.metadata.quality.details": "", + "record.metadata.quality.keywords.failed": "", + "record.metadata.quality.keywords.success": "", + "record.metadata.quality.legalConstraints.failed": "", + "record.metadata.quality.legalConstraints.success": "", + "record.metadata.quality.organisation.failed": "", + "record.metadata.quality.organisation.success": "", + "record.metadata.quality.title.failed": "", + "record.metadata.quality.title.success": "", + "record.metadata.quality.topic.failed": "", + "record.metadata.quality.topic.success": "", + "record.metadata.quality.updateFrequency.failed": "", + "record.metadata.quality.updateFrequency.success": "", "record.metadata.related": "Ähnliche Datensätze", "record.metadata.sheet": "Weitere Informationen erhalten Sie unter :", "record.metadata.title": "Titel", @@ -228,6 +246,7 @@ "results.showMore": "Mehr Ergebnisse anzeigen...", "results.sortBy.dateStamp": "Letzte Aktualisierungen", "results.sortBy.popularity": "Beliebtheit", + "results.sortBy.qualityScore": "", "results.sortBy.relevancy": "Relevanz", "search.autocomplete.error": "Vorschläge konnten nicht abgerufen werden:", "search.error.couldNotReachApi": "Die API konnte nicht erreicht werden", @@ -253,10 +272,10 @@ "search.filters.license.unknown": "Unbekannt oder nicht vorhanden", "search.filters.maximize": "Erweitern", "search.filters.minimize": "Minimieren", - "search.filters.publicationYear": "Veröffentlichungsjahr", "search.filters.myRecords": "", "search.filters.myRecordsHelp": "", "search.filters.otherRecords": "", + "search.filters.publicationYear": "Veröffentlichungsjahr", "search.filters.publisher": "Organisationen", "search.filters.representationType": "", "search.filters.resourceType": "", diff --git a/translations/en.json b/translations/en.json index 19c040d9d0..75c87eb7bf 100644 --- a/translations/en.json +++ b/translations/en.json @@ -26,10 +26,10 @@ "dashboard.records.noUser": "No users for this organization", "dashboard.records.publishedRecords": "published records", "dashboard.records.search": "Search for \"{searchText}\"", - "dashboard.records.users": "users", - "dashboard.records.username": "Username", "dashboard.records.userDetail": "Name", "dashboard.records.userEmail": "Email", + "dashboard.records.username": "Username", + "dashboard.records.users": "users", "datafeeder.analysisProgressBar.illustration.fileFormatDetection": "File format \n detection", "datafeeder.analysisProgressBar.illustration.gatheringDatasetInformation": "Gathering dataset \n information", "datafeeder.analysisProgressBar.illustration.samplingData": "Sampling \n data", @@ -207,6 +207,24 @@ "record.metadata.origin": "About the data", "record.metadata.preview": "Preview", "record.metadata.publications": "publications", + "record.metadata.quality": "Metadata Quality", + "record.metadata.quality.contact.failed": "Contact is not completed", + "record.metadata.quality.contact.success": "Contact is completed", + "record.metadata.quality.description.failed": "Description is not completed", + "record.metadata.quality.description.success": "Description is completed", + "record.metadata.quality.details": "Details", + "record.metadata.quality.keywords.failed": "Keywords are not completed", + "record.metadata.quality.keywords.success": "Keywords are completed", + "record.metadata.quality.legalConstraints.failed": "Legal constraints are not completed", + "record.metadata.quality.legalConstraints.success": "Legal constraints are completed", + "record.metadata.quality.organisation.failed": "Organisation is not completed", + "record.metadata.quality.organisation.success": "Organisation is completed", + "record.metadata.quality.title.failed": "Title is not completed", + "record.metadata.quality.title.success": "Title is completed", + "record.metadata.quality.topic.failed": "Topic is not completed", + "record.metadata.quality.topic.success": "Topic is completed", + "record.metadata.quality.updateFrequency.failed": "Update frequency is not completed", + "record.metadata.quality.updateFrequency.success": "Update frequency is completed", "record.metadata.related": "Related records", "record.metadata.sheet": "More information available from:", "record.metadata.title": "Title", @@ -214,24 +232,6 @@ "record.metadata.updateStatus": "Data Update Status", "record.metadata.updatedOn": "Last Data Information Update", "record.metadata.usage": "Usage & constraints", - "record.metadata.quality": "Metadata Quality", - "record.metadata.quality.details": "Details", - "record.metadata.quality.title.success": "Title is completed", - "record.metadata.quality.title.failed": "Title is not completed", - "record.metadata.quality.description.success": "Description is completed", - "record.metadata.quality.description.failed": "Description is not completed", - "record.metadata.quality.topic.success": "Topic is completed", - "record.metadata.quality.topic.failed": "Topic is not completed", - "record.metadata.quality.keywords.success": "Keywords are completed", - "record.metadata.quality.keywords.failed": "Keywords are not completed", - "record.metadata.quality.legalConstraints.success": "Legal constraints are completed", - "record.metadata.quality.legalConstraints.failed": "Legal constraints are not completed", - "record.metadata.quality.contact.success": "Contact is completed", - "record.metadata.quality.contact.failed": "Contact is not completed", - "record.metadata.quality.updateFrequency.success": "Update frequency is completed", - "record.metadata.quality.updateFrequency.failed": "Update frequency is not completed", - "record.metadata.quality.organisation.success": "Organisation is completed", - "record.metadata.quality.organisation.failed": "Organisation is not completed", "record.more.details": "Read more", "record.tab.chart": "Chart", "record.tab.data": "Table", @@ -246,8 +246,8 @@ "results.showMore": "Show more results...", "results.sortBy.dateStamp": "Most recent", "results.sortBy.popularity": "Popularity", - "results.sortBy.relevancy": "Relevancy", "results.sortBy.qualityScore": "Quality score", + "results.sortBy.relevancy": "Relevancy", "search.autocomplete.error": "Suggestions could not be fetched:", "search.error.couldNotReachApi": "The API could not be reached", "search.error.receivedError": "An error was received", @@ -272,10 +272,10 @@ "search.filters.license.unknown": "Unknown or absent", "search.filters.maximize": "Expand", "search.filters.minimize": "Minimize", - "search.filters.publicationYear": "Publication year", "search.filters.myRecords": "Show only my records", "search.filters.myRecordsHelp": "When this is enabled, records only created by myself are shown; records created by others will not show up.", "search.filters.otherRecords": "Showing records from another person", + "search.filters.publicationYear": "Publication year", "search.filters.publisher": "Organizations", "search.filters.representationType": "Representation type", "search.filters.resourceType": "Resource type", diff --git a/translations/es.json b/translations/es.json index d35079a512..f789aeecc9 100644 --- a/translations/es.json +++ b/translations/es.json @@ -26,10 +26,10 @@ "dashboard.records.noUser": "", "dashboard.records.publishedRecords": "", "dashboard.records.search": "Buscar \"{searchText}\"", - "dashboard.records.users": "", - "dashboard.records.username": "", "dashboard.records.userDetail": "", "dashboard.records.userEmail": "", + "dashboard.records.username": "", + "dashboard.records.users": "", "datafeeder.analysisProgressBar.illustration.fileFormatDetection": "", "datafeeder.analysisProgressBar.illustration.gatheringDatasetInformation": "", "datafeeder.analysisProgressBar.illustration.samplingData": "", @@ -207,6 +207,24 @@ "record.metadata.origin": "", "record.metadata.preview": "", "record.metadata.publications": "", + "record.metadata.quality": "", + "record.metadata.quality.contact.failed": "", + "record.metadata.quality.contact.success": "", + "record.metadata.quality.description.failed": "", + "record.metadata.quality.description.success": "", + "record.metadata.quality.details": "", + "record.metadata.quality.keywords.failed": "", + "record.metadata.quality.keywords.success": "", + "record.metadata.quality.legalConstraints.failed": "", + "record.metadata.quality.legalConstraints.success": "", + "record.metadata.quality.organisation.failed": "", + "record.metadata.quality.organisation.success": "", + "record.metadata.quality.title.failed": "", + "record.metadata.quality.title.success": "", + "record.metadata.quality.topic.failed": "", + "record.metadata.quality.topic.success": "", + "record.metadata.quality.updateFrequency.failed": "", + "record.metadata.quality.updateFrequency.success": "", "record.metadata.related": "", "record.metadata.sheet": "", "record.metadata.title": "", @@ -214,24 +232,6 @@ "record.metadata.updateStatus": "", "record.metadata.updatedOn": "", "record.metadata.usage": "", - "record.metadata.quality": "", - "record.metadata.quality.details": "", - "record.metadata.quality.title.success": "", - "record.metadata.quality.title.failed": "", - "record.metadata.quality.description.success": "", - "record.metadata.quality.description.failed": "", - "record.metadata.quality.topic.success": "", - "record.metadata.quality.topic.failed": "", - "record.metadata.quality.keywords.success": "", - "record.metadata.quality.keywords.failed": "", - "record.metadata.quality.legalConstraints.success": "", - "record.metadata.quality.legalConstraints.failed": "", - "record.metadata.quality.contact.success": "", - "record.metadata.quality.contact.failed": "", - "record.metadata.quality.updateFrequency.success": "", - "record.metadata.quality.updateFrequency.failed": "", - "record.metadata.quality.organisation.success": "", - "record.metadata.quality.organisation.failed": "", "record.more.details": "", "record.tab.chart": "", "record.tab.data": "", @@ -246,8 +246,8 @@ "results.showMore": "", "results.sortBy.dateStamp": "", "results.sortBy.popularity": "", - "results.sortBy.relevancy": "", "results.sortBy.qualityScore": "", + "results.sortBy.relevancy": "", "search.autocomplete.error": "", "search.error.couldNotReachApi": "", "search.error.receivedError": "", @@ -272,10 +272,10 @@ "search.filters.license.unknown": "", "search.filters.maximize": "", "search.filters.minimize": "", - "search.filters.publicationYear": "", "search.filters.myRecords": "", "search.filters.myRecordsHelp": "", "search.filters.otherRecords": "", + "search.filters.publicationYear": "", "search.filters.publisher": "", "search.filters.representationType": "", "search.filters.resourceType": "", diff --git a/translations/fr.json b/translations/fr.json index c32b0b18d1..98a7d23c5b 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -26,10 +26,10 @@ "dashboard.records.noUser": "Aucun utilisateur pour cette organisation", "dashboard.records.publishedRecords": "données publiées", "dashboard.records.search": "Résultats pour \"{searchText}\"", - "dashboard.records.users": "utilisateurs", - "dashboard.records.username": "Nom d'utilisateur", "dashboard.records.userDetail": "Nom", "dashboard.records.userEmail": "Email", + "dashboard.records.username": "Nom d'utilisateur", + "dashboard.records.users": "utilisateurs", "datafeeder.analysisProgressBar.illustration.fileFormatDetection": "Détection du \n format de fichier", "datafeeder.analysisProgressBar.illustration.gatheringDatasetInformation": "Récupération des informations \n sur le jeu de données", "datafeeder.analysisProgressBar.illustration.samplingData": "Sampling \n des données", @@ -207,6 +207,24 @@ "record.metadata.origin": "À propos des données", "record.metadata.preview": "Aperçu", "record.metadata.publications": "données", + "record.metadata.quality": "Qualité des métadonnées", + "record.metadata.quality.contact.failed": "Contact n'est pas renseigné", + "record.metadata.quality.contact.success": "Contact est renseigné", + "record.metadata.quality.description.failed": "Description n'est pas renseignée", + "record.metadata.quality.description.success": "Description est renseignée", + "record.metadata.quality.details": "Détails", + "record.metadata.quality.keywords.failed": "Mots clés ne sont pas renseignés", + "record.metadata.quality.keywords.success": "Mots clés sont renseignés", + "record.metadata.quality.legalConstraints.failed": "Contraintes légales ne sont pas renseignées", + "record.metadata.quality.legalConstraints.success": "Contraintes légales sont renseignées", + "record.metadata.quality.organisation.failed": "Producteur n'est pas renseigné", + "record.metadata.quality.organisation.success": "Producteur est renseigné", + "record.metadata.quality.title.failed": "Titre n'est pas renseigné", + "record.metadata.quality.title.success": "Titre est renseigné", + "record.metadata.quality.topic.failed": "Thème n'est pas renseigné", + "record.metadata.quality.topic.success": "Thème est renseigné", + "record.metadata.quality.updateFrequency.failed": "Fréquence de mise à jour n'est pas renseignée", + "record.metadata.quality.updateFrequency.success": "Fréquence de mise à jour est renseignée", "record.metadata.related": "Voir aussi", "record.metadata.sheet": "Plus d'informations à l'adresse suivante :", "record.metadata.title": "Titre", @@ -214,24 +232,6 @@ "record.metadata.updateStatus": "Statut de mise à jour des données", "record.metadata.updatedOn": "Dernière mise à jour des informations sur les données", "record.metadata.usage": "Conditions d'utilisation", - "record.metadata.quality": "Qualité des métadonnées", - "record.metadata.quality.details": "Détails", - "record.metadata.quality.title.success": "Titre est renseigné", - "record.metadata.quality.title.failed": "Titre n'est pas renseigné", - "record.metadata.quality.description.success": "Description est renseignée", - "record.metadata.quality.description.failed": "Description n'est pas renseignée", - "record.metadata.quality.topic.success": "Thème est renseigné", - "record.metadata.quality.topic.failed": "Thème n'est pas renseigné", - "record.metadata.quality.keywords.success": "Mots clés sont renseignés", - "record.metadata.quality.keywords.failed": "Mots clés ne sont pas renseignés", - "record.metadata.quality.legalConstraints.success": "Contraintes légales sont renseignées", - "record.metadata.quality.legalConstraints.failed": "Contraintes légales ne sont pas renseignées", - "record.metadata.quality.contact.success": "Contact est renseigné", - "record.metadata.quality.contact.failed": "Contact n'est pas renseigné", - "record.metadata.quality.updateFrequency.success": "Fréquence de mise à jour est renseignée", - "record.metadata.quality.updateFrequency.failed": "Fréquence de mise à jour n'est pas renseignée", - "record.metadata.quality.organisation.success": "Producteur est renseigné", - "record.metadata.quality.organisation.failed": "Producteur n'est pas renseigné", "record.more.details": "Détails", "record.tab.chart": "Graphique", "record.tab.data": "Tableau", @@ -246,8 +246,8 @@ "results.showMore": "Plus de résultats...", "results.sortBy.dateStamp": "Plus récent", "results.sortBy.popularity": "Popularité", - "results.sortBy.relevancy": "Pertinence", "results.sortBy.qualityScore": "Indicateur de qualité", + "results.sortBy.relevancy": "Pertinence", "search.autocomplete.error": "Les suggestions ne peuvent pas être récupérées", "search.error.couldNotReachApi": "Problème de connexion à l'API", "search.error.receivedError": "Erreur retournée", @@ -272,10 +272,10 @@ "search.filters.license.unknown": "Non-reconnue ou absente", "search.filters.maximize": "Agrandir", "search.filters.minimize": "Réduire", - "search.filters.publicationYear": "Année de publication", "search.filters.myRecords": "Voir mes données", "search.filters.myRecordsHelp": "Quand activé, n'affiche que les données créées avec mon utilisateur. Les données créées par les autres utilisateurs ne sont pas affichées.", "search.filters.otherRecords": "Affichage des données d'un autre utilisateur", + "search.filters.publicationYear": "Année de publication", "search.filters.publisher": "Organisations", "search.filters.representationType": "Type de représentation", "search.filters.resourceType": "Type de ressource", diff --git a/translations/it.json b/translations/it.json index 73c62af3af..73fb4b89c3 100644 --- a/translations/it.json +++ b/translations/it.json @@ -26,10 +26,10 @@ "dashboard.records.noUser": "", "dashboard.records.publishedRecords": "", "dashboard.records.search": "Cerca \"{searchText}\"", - "dashboard.records.users": "", - "dashboard.records.username": "", "dashboard.records.userDetail": "", "dashboard.records.userEmail": "", + "dashboard.records.username": "", + "dashboard.records.users": "", "datafeeder.analysisProgressBar.illustration.fileFormatDetection": "", "datafeeder.analysisProgressBar.illustration.gatheringDatasetInformation": "", "datafeeder.analysisProgressBar.illustration.samplingData": "", @@ -207,6 +207,24 @@ "record.metadata.origin": "", "record.metadata.preview": "", "record.metadata.publications": "", + "record.metadata.quality": "", + "record.metadata.quality.contact.failed": "", + "record.metadata.quality.contact.success": "", + "record.metadata.quality.description.failed": "", + "record.metadata.quality.description.success": "", + "record.metadata.quality.details": "", + "record.metadata.quality.keywords.failed": "", + "record.metadata.quality.keywords.success": "", + "record.metadata.quality.legalConstraints.failed": "", + "record.metadata.quality.legalConstraints.success": "", + "record.metadata.quality.organisation.failed": "", + "record.metadata.quality.organisation.success": "", + "record.metadata.quality.title.failed": "", + "record.metadata.quality.title.success": "", + "record.metadata.quality.topic.failed": "", + "record.metadata.quality.topic.success": "", + "record.metadata.quality.updateFrequency.failed": "", + "record.metadata.quality.updateFrequency.success": "", "record.metadata.related": "", "record.metadata.sheet": "", "record.metadata.title": "", @@ -214,24 +232,6 @@ "record.metadata.updateStatus": "", "record.metadata.updatedOn": "", "record.metadata.usage": "", - "record.metadata.quality": "", - "record.metadata.quality.details": "", - "record.metadata.quality.title.success": "", - "record.metadata.quality.title.failed": "", - "record.metadata.quality.description.success": "", - "record.metadata.quality.description.failed": "", - "record.metadata.quality.topic.success": "", - "record.metadata.quality.topic.failed": "", - "record.metadata.quality.keywords.success": "", - "record.metadata.quality.keywords.failed": "", - "record.metadata.quality.legalConstraints.success": "", - "record.metadata.quality.legalConstraints.failed": "", - "record.metadata.quality.contact.success": "", - "record.metadata.quality.contact.failed": "", - "record.metadata.quality.updateFrequency.success": "", - "record.metadata.quality.updateFrequency.failed": "", - "record.metadata.quality.organisation.success": "", - "record.metadata.quality.organisation.failed": "", "record.more.details": "", "record.tab.chart": "", "record.tab.data": "", @@ -246,8 +246,8 @@ "results.showMore": "", "results.sortBy.dateStamp": "", "results.sortBy.popularity": "", - "results.sortBy.relevancy": "", "results.sortBy.qualityScore": "", + "results.sortBy.relevancy": "", "search.autocomplete.error": "", "search.error.couldNotReachApi": "", "search.error.receivedError": "", @@ -272,10 +272,10 @@ "search.filters.license.unknown": "", "search.filters.maximize": "", "search.filters.minimize": "", - "search.filters.publicationYear": "", "search.filters.myRecords": "", "search.filters.myRecordsHelp": "", "search.filters.otherRecords": "", + "search.filters.publicationYear": "", "search.filters.publisher": "", "search.filters.representationType": "", "search.filters.resourceType": "", diff --git a/translations/nl.json b/translations/nl.json index 00087862f2..158d53d3f8 100644 --- a/translations/nl.json +++ b/translations/nl.json @@ -26,10 +26,10 @@ "dashboard.records.noUser": "", "dashboard.records.publishedRecords": "", "dashboard.records.search": "Zoeken naar \"{searchText}\"", - "dashboard.records.users": "", - "dashboard.records.username": "", "dashboard.records.userDetail": "", "dashboard.records.userEmail": "", + "dashboard.records.username": "", + "dashboard.records.users": "", "datafeeder.analysisProgressBar.illustration.fileFormatDetection": "", "datafeeder.analysisProgressBar.illustration.gatheringDatasetInformation": "", "datafeeder.analysisProgressBar.illustration.samplingData": "", @@ -207,6 +207,24 @@ "record.metadata.origin": "", "record.metadata.preview": "", "record.metadata.publications": "", + "record.metadata.quality": "", + "record.metadata.quality.contact.failed": "", + "record.metadata.quality.contact.success": "", + "record.metadata.quality.description.failed": "", + "record.metadata.quality.description.success": "", + "record.metadata.quality.details": "", + "record.metadata.quality.keywords.failed": "", + "record.metadata.quality.keywords.success": "", + "record.metadata.quality.legalConstraints.failed": "", + "record.metadata.quality.legalConstraints.success": "", + "record.metadata.quality.organisation.failed": "", + "record.metadata.quality.organisation.success": "", + "record.metadata.quality.title.failed": "", + "record.metadata.quality.title.success": "", + "record.metadata.quality.topic.failed": "", + "record.metadata.quality.topic.success": "", + "record.metadata.quality.updateFrequency.failed": "", + "record.metadata.quality.updateFrequency.success": "", "record.metadata.related": "", "record.metadata.sheet": "", "record.metadata.title": "", @@ -214,24 +232,6 @@ "record.metadata.updateStatus": "", "record.metadata.updatedOn": "", "record.metadata.usage": "", - "record.metadata.quality": "", - "record.metadata.quality.details": "", - "record.metadata.quality.title.success": "", - "record.metadata.quality.title.failed": "", - "record.metadata.quality.description.success": "", - "record.metadata.quality.description.failed": "", - "record.metadata.quality.topic.success": "", - "record.metadata.quality.topic.failed": "", - "record.metadata.quality.keywords.success": "", - "record.metadata.quality.keywords.failed": "", - "record.metadata.quality.legalConstraints.success": "", - "record.metadata.quality.legalConstraints.failed": "", - "record.metadata.quality.contact.success": "", - "record.metadata.quality.contact.failed": "", - "record.metadata.quality.updateFrequency.success": "", - "record.metadata.quality.updateFrequency.failed": "", - "record.metadata.quality.organisation.success": "", - "record.metadata.quality.organisation.failed": "", "record.more.details": "", "record.tab.chart": "", "record.tab.data": "", @@ -246,8 +246,8 @@ "results.showMore": "", "results.sortBy.dateStamp": "", "results.sortBy.popularity": "", - "results.sortBy.relevancy": "", "results.sortBy.qualityScore": "", + "results.sortBy.relevancy": "", "search.autocomplete.error": "", "search.error.couldNotReachApi": "", "search.error.receivedError": "", @@ -272,10 +272,10 @@ "search.filters.license.unknown": "", "search.filters.maximize": "", "search.filters.minimize": "", - "search.filters.publicationYear": "", "search.filters.myRecords": "", "search.filters.myRecordsHelp": "", "search.filters.otherRecords": "", + "search.filters.publicationYear": "", "search.filters.publisher": "", "search.filters.representationType": "", "search.filters.resourceType": "", diff --git a/translations/pt.json b/translations/pt.json index 83a73859c8..d4b16f8ad4 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -26,10 +26,10 @@ "dashboard.records.noUser": "", "dashboard.records.publishedRecords": "", "dashboard.records.search": "Buscar por \"{searchText}\"", - "dashboard.records.users": "", - "dashboard.records.username": "", "dashboard.records.userDetail": "", "dashboard.records.userEmail": "", + "dashboard.records.username": "", + "dashboard.records.users": "", "datafeeder.analysisProgressBar.illustration.fileFormatDetection": "", "datafeeder.analysisProgressBar.illustration.gatheringDatasetInformation": "", "datafeeder.analysisProgressBar.illustration.samplingData": "", @@ -207,6 +207,24 @@ "record.metadata.origin": "", "record.metadata.preview": "", "record.metadata.publications": "", + "record.metadata.quality": "", + "record.metadata.quality.contact.failed": "", + "record.metadata.quality.contact.success": "", + "record.metadata.quality.description.failed": "", + "record.metadata.quality.description.success": "", + "record.metadata.quality.details": "", + "record.metadata.quality.keywords.failed": "", + "record.metadata.quality.keywords.success": "", + "record.metadata.quality.legalConstraints.failed": "", + "record.metadata.quality.legalConstraints.success": "", + "record.metadata.quality.organisation.failed": "", + "record.metadata.quality.organisation.success": "", + "record.metadata.quality.title.failed": "", + "record.metadata.quality.title.success": "", + "record.metadata.quality.topic.failed": "", + "record.metadata.quality.topic.success": "", + "record.metadata.quality.updateFrequency.failed": "", + "record.metadata.quality.updateFrequency.success": "", "record.metadata.related": "", "record.metadata.sheet": "", "record.metadata.title": "", @@ -214,24 +232,6 @@ "record.metadata.updateStatus": "", "record.metadata.updatedOn": "", "record.metadata.usage": "", - "record.metadata.quality": "", - "record.metadata.quality.details": "", - "record.metadata.quality.title.success": "", - "record.metadata.quality.title.failed": "", - "record.metadata.quality.description.success": "", - "record.metadata.quality.description.failed": "", - "record.metadata.quality.topic.success": "", - "record.metadata.quality.topic.failed": "", - "record.metadata.quality.keywords.success": "", - "record.metadata.quality.keywords.failed": "", - "record.metadata.quality.legalConstraints.success": "", - "record.metadata.quality.legalConstraints.failed": "", - "record.metadata.quality.contact.success": "", - "record.metadata.quality.contact.failed": "", - "record.metadata.quality.updateFrequency.success": "", - "record.metadata.quality.updateFrequency.failed": "", - "record.metadata.quality.organisation.success": "", - "record.metadata.quality.organisation.failed": "", "record.more.details": "", "record.tab.chart": "", "record.tab.data": "", @@ -246,8 +246,8 @@ "results.showMore": "", "results.sortBy.dateStamp": "", "results.sortBy.popularity": "", - "results.sortBy.relevancy": "", "results.sortBy.qualityScore": "", + "results.sortBy.relevancy": "", "search.autocomplete.error": "", "search.error.couldNotReachApi": "", "search.error.receivedError": "", @@ -272,10 +272,10 @@ "search.filters.license.unknown": "", "search.filters.maximize": "", "search.filters.minimize": "", - "search.filters.publicationYear": "", "search.filters.myRecords": "", "search.filters.myRecordsHelp": "", "search.filters.otherRecords": "", + "search.filters.publicationYear": "", "search.filters.publisher": "", "search.filters.representationType": "", "search.filters.resourceType": "", diff --git a/translations/sk.json b/translations/sk.json index 55a57fd795..51dbf4130e 100644 --- a/translations/sk.json +++ b/translations/sk.json @@ -22,7 +22,14 @@ "dashboard.records.myLibrary": "Moja knižnica", "dashboard.records.myOrg": "Organizácia", "dashboard.records.myRecords": "Moje záznamy", + "dashboard.records.noRecord": "", + "dashboard.records.noUser": "", + "dashboard.records.publishedRecords": "", "dashboard.records.search": "Hľadať \"{searchText}\"", + "dashboard.records.userDetail": "", + "dashboard.records.userEmail": "", + "dashboard.records.username": "", + "dashboard.records.users": "", "datafeeder.analysisProgressBar.illustration.fileFormatDetection": "Detekcia formátu súboru", "datafeeder.analysisProgressBar.illustration.gatheringDatasetInformation": "Zbieranie informácií o datasete", "datafeeder.analysisProgressBar.illustration.samplingData": "Vzorkovanie dát", @@ -201,7 +208,23 @@ "record.metadata.preview": "Náhľad", "record.metadata.publications": "publikácie", "record.metadata.quality": "Kvalita metadát", + "record.metadata.quality.contact.failed": "", + "record.metadata.quality.contact.success": "", + "record.metadata.quality.description.failed": "", + "record.metadata.quality.description.success": "", "record.metadata.quality.details": "Detaily", + "record.metadata.quality.keywords.failed": "", + "record.metadata.quality.keywords.success": "", + "record.metadata.quality.legalConstraints.failed": "", + "record.metadata.quality.legalConstraints.success": "", + "record.metadata.quality.organisation.failed": "", + "record.metadata.quality.organisation.success": "", + "record.metadata.quality.title.failed": "", + "record.metadata.quality.title.success": "", + "record.metadata.quality.topic.failed": "", + "record.metadata.quality.topic.success": "", + "record.metadata.quality.updateFrequency.failed": "", + "record.metadata.quality.updateFrequency.success": "", "record.metadata.related": "Súvisiace záznamy", "record.metadata.sheet": "Ďalšie metadáta sú k dispozícii na:", "record.metadata.title": "Názov", @@ -219,6 +242,7 @@ "results.records.hits.displayedOn": "{displayed, plural, =0{Žiadny záznam.} one{1 záznam} other{{displayed} záznamov }} {hits, plural, other{zobrazených z {hits} celkovo.}}", "results.records.hits.empty.help.html": "Návrhy:
  • Vyskúšajte iné slová
  • Uveďte menej slov
", "results.records.hits.found": "{hits, plural, =0{Žiadne dokumenty nezodpovedajú zadanému vyhľadávaniu.} one{1 záznam nájdený.} other{{hits} záznamov nájdených.}}", + "results.records.hits.selected": "", "results.showMore": "Zobraziť viac výsledkov...", "results.sortBy.dateStamp": "Najnovšie", "results.sortBy.popularity": "Popularita", @@ -244,5 +268,33 @@ "search.filters.license.etalab-v2": "Open Licence v2.0 (Etalab)", "search.filters.license.odbl": "Open Data Commons ODbL", "search.filters.license.odc-by": "Open Data Commons ODC-By", - "search.filters.license.pddl": "Open Data Commons" + "search.filters.license.pddl": "Open Data Commons", + "search.filters.license.unknown": "", + "search.filters.maximize": "", + "search.filters.minimize": "", + "search.filters.myRecords": "", + "search.filters.myRecordsHelp": "", + "search.filters.otherRecords": "", + "search.filters.publicationYear": "", + "search.filters.publisher": "", + "search.filters.representationType": "", + "search.filters.resourceType": "", + "search.filters.standard": "", + "search.filters.title": "", + "search.filters.topic": "", + "search.filters.useSpatialFilter": "", + "search.filters.useSpatialFilterHelp": "", + "share.tab.permalink": "", + "share.tab.webComponent": "", + "table.loading.data": "", + "table.object.count": "", + "table.select.data": "", + "tooltip.html.copy": "", + "tooltip.url.copy": "", + "tooltip.url.open": "", + "wfs.featuretype.notfound": "", + "wfs.geojsongml.notsupported": "", + "wfs.unreachable.cors": "", + "wfs.unreachable.http": "", + "wfs.unreachable.unknown": "" } From d041fe5a2cf4681aae1ac221fa52bba1ca5a489c Mon Sep 17 00:00:00 2001 From: Florent Gravin Date: Sat, 9 Dec 2023 14:58:10 +0100 Subject: [PATCH 08/10] feat(filters): translate contact filter --- libs/feature/search/src/lib/utils/service/fields.service.ts | 1 + translations/de.json | 1 + translations/en.json | 1 + translations/es.json | 1 + translations/fr.json | 1 + translations/it.json | 1 + translations/nl.json | 1 + translations/pt.json | 1 + translations/sk.json | 1 + 9 files changed, 9 insertions(+) diff --git a/libs/feature/search/src/lib/utils/service/fields.service.ts b/libs/feature/search/src/lib/utils/service/fields.service.ts index 0009fb737c..a99ddfa0db 100644 --- a/libs/feature/search/src/lib/utils/service/fields.service.ts +++ b/libs/feature/search/src/lib/utils/service/fields.service.ts @@ -29,6 +29,7 @@ marker('search.filters.representationType') marker('search.filters.resourceType') marker('search.filters.standard') marker('search.filters.topic') +marker('search.filters.contact') @Injectable({ providedIn: 'root', diff --git a/translations/de.json b/translations/de.json index 265c7765d6..b1cb3219cc 100644 --- a/translations/de.json +++ b/translations/de.json @@ -255,6 +255,7 @@ "search.field.any.placeholder": "Suche nach Datensätzen ...", "search.field.sortBy": "Sortieren nach:", "search.filters.clear": "Zurücksetzen", + "search.filters.contact": "Kontakt", "search.filters.format": "Formate", "search.filters.inspireKeyword": "INSPIRE-Schlüsselwort", "search.filters.isSpatial": "Ist räumliche Daten", diff --git a/translations/en.json b/translations/en.json index 75c87eb7bf..d6aaeb0b89 100644 --- a/translations/en.json +++ b/translations/en.json @@ -255,6 +255,7 @@ "search.field.any.placeholder": "Search datasets ...", "search.field.sortBy": "Sort by:", "search.filters.clear": "Reset", + "search.filters.contact": "Contacts", "search.filters.format": "Formats", "search.filters.inspireKeyword": "INSPIRE keyword", "search.filters.isSpatial": "Is spatial data", diff --git a/translations/es.json b/translations/es.json index f789aeecc9..a9be25643d 100644 --- a/translations/es.json +++ b/translations/es.json @@ -255,6 +255,7 @@ "search.field.any.placeholder": "", "search.field.sortBy": "", "search.filters.clear": "", + "search.filters.contact": "", "search.filters.format": "", "search.filters.inspireKeyword": "", "search.filters.isSpatial": "", diff --git a/translations/fr.json b/translations/fr.json index 98a7d23c5b..88bf7fa157 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -255,6 +255,7 @@ "search.field.any.placeholder": "Rechercher une donnée...", "search.field.sortBy": "Trier par :", "search.filters.clear": "Réinitialiser", + "search.filters.contact": "Contacts", "search.filters.format": "Formats", "search.filters.inspireKeyword": "Mot-clé INSPIRE", "search.filters.isSpatial": "Données spatiales", diff --git a/translations/it.json b/translations/it.json index 73fb4b89c3..83caee58a4 100644 --- a/translations/it.json +++ b/translations/it.json @@ -255,6 +255,7 @@ "search.field.any.placeholder": "", "search.field.sortBy": "", "search.filters.clear": "", + "search.filters.contact": "", "search.filters.format": "", "search.filters.inspireKeyword": "", "search.filters.isSpatial": "", diff --git a/translations/nl.json b/translations/nl.json index 158d53d3f8..bf47237a21 100644 --- a/translations/nl.json +++ b/translations/nl.json @@ -255,6 +255,7 @@ "search.field.any.placeholder": "", "search.field.sortBy": "", "search.filters.clear": "", + "search.filters.contact": "", "search.filters.format": "", "search.filters.inspireKeyword": "", "search.filters.isSpatial": "", diff --git a/translations/pt.json b/translations/pt.json index d4b16f8ad4..6156d65526 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -255,6 +255,7 @@ "search.field.any.placeholder": "", "search.field.sortBy": "", "search.filters.clear": "", + "search.filters.contact": "", "search.filters.format": "", "search.filters.inspireKeyword": "", "search.filters.isSpatial": "", diff --git a/translations/sk.json b/translations/sk.json index 51dbf4130e..1128d73bba 100644 --- a/translations/sk.json +++ b/translations/sk.json @@ -255,6 +255,7 @@ "search.field.any.placeholder": "Hľadať datasety ...", "search.field.sortBy": "Zoradiť podľa:", "search.filters.clear": "Obnoviť", + "search.filters.contact": "", "search.filters.format": "Formáty", "search.filters.inspireKeyword": "Kľúčové slová INSPIRE", "search.filters.isSpatial": "Je priestorový údaj", From a65b3bbc7ec4c9537a87757f9b0bef608faf459e Mon Sep 17 00:00:00 2001 From: Florent Gravin Date: Sat, 9 Dec 2023 21:38:35 +0100 Subject: [PATCH 09/10] feat(thesaurus): add model --- libs/common/domain/src/lib/model/thesaurus/index.ts | 1 + .../domain/src/lib/model/thesaurus/thesaurus.model.ts | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 libs/common/domain/src/lib/model/thesaurus/index.ts create mode 100644 libs/common/domain/src/lib/model/thesaurus/thesaurus.model.ts diff --git a/libs/common/domain/src/lib/model/thesaurus/index.ts b/libs/common/domain/src/lib/model/thesaurus/index.ts new file mode 100644 index 0000000000..de433d542c --- /dev/null +++ b/libs/common/domain/src/lib/model/thesaurus/index.ts @@ -0,0 +1 @@ +export * from './thesaurus.model' diff --git a/libs/common/domain/src/lib/model/thesaurus/thesaurus.model.ts b/libs/common/domain/src/lib/model/thesaurus/thesaurus.model.ts new file mode 100644 index 0000000000..48aa153751 --- /dev/null +++ b/libs/common/domain/src/lib/model/thesaurus/thesaurus.model.ts @@ -0,0 +1,6 @@ +export interface ThesaurusItemModel { + key: string + label: string +} + +export type ThesaurusModel = ThesaurusItemModel[] From 7d3e1e112480501b3c57c7473ae4b6429d923f22 Mon Sep 17 00:00:00 2001 From: Florent Gravin Date: Mon, 11 Dec 2023 10:44:29 +0100 Subject: [PATCH 10/10] fix(sources): use back /sources request as /sourceS/harvester is not compatible in 4.2.2 --- libs/feature/catalog/src/lib/sources/sources.service.spec.ts | 2 +- libs/feature/catalog/src/lib/sources/sources.service.ts | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libs/feature/catalog/src/lib/sources/sources.service.spec.ts b/libs/feature/catalog/src/lib/sources/sources.service.spec.ts index a71da69906..287defed53 100644 --- a/libs/feature/catalog/src/lib/sources/sources.service.spec.ts +++ b/libs/feature/catalog/src/lib/sources/sources.service.spec.ts @@ -8,7 +8,7 @@ import { Observable } from 'rxjs' import { LangService } from '@geonetwork-ui/util/i18n' class SourcesApiServiceMock { - getSourcesByType = jest.fn(function () { + getSubPortals1 = jest.fn(function () { return new Observable((observer) => { observer.next(SOURCES_FIXTURE) }) diff --git a/libs/feature/catalog/src/lib/sources/sources.service.ts b/libs/feature/catalog/src/lib/sources/sources.service.ts index 0bffe71fa8..490423e514 100644 --- a/libs/feature/catalog/src/lib/sources/sources.service.ts +++ b/libs/feature/catalog/src/lib/sources/sources.service.ts @@ -10,9 +10,7 @@ import { CatalogSource } from './sources.model' }) export class SourcesService { sources$: Observable = ( - this.sourcesApiService.getSourcesByType('harvester') as Observable< - CatalogSource[] - > + this.sourcesApiService.getSubPortals1() as Observable ).pipe(shareReplay()) constructor(