From 8d20dbca112e10695f67f8a98bee336ced2dc40d Mon Sep 17 00:00:00 2001 From: Angelika Kinas Date: Wed, 22 May 2024 09:17:07 +0200 Subject: [PATCH 1/5] feat(keywords): Change keywords on dataset page to categories (first level thesaurus), change keywords on search card to second level thesaurus keywords --- apps/datahub-e2e/src/e2e/search.cy.ts | 6 ++++++ .../dataset-information.component.html | 4 ++-- .../dataset-information/dataset-information.component.ts | 8 ++++++++ .../lib/results-list-item/results-list-item.component.ts | 5 ++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/apps/datahub-e2e/src/e2e/search.cy.ts b/apps/datahub-e2e/src/e2e/search.cy.ts index a031a7e9..a67a092a 100644 --- a/apps/datahub-e2e/src/e2e/search.cy.ts +++ b/apps/datahub-e2e/src/e2e/search.cy.ts @@ -29,6 +29,12 @@ describe('search', () => { .find('.mel-badge-button-primary') .should('not.contain', 'HAUTS-DE-FRANCE') }) + it('should not dislay any place keywords (which are already displayed as categories)', () => { + cy.get('mel-datahub-results-card-search') + .eq(6) + .find('.mel-badge-button-primary') + .should('not.contain', 'Administration, action publique') + }) it('should not dislay html in abstract', () => { cy.get('mel-datahub-results-card-search') .eq(5) diff --git a/apps/datahub/src/app/dataset/dataset-information/dataset-information.component.html b/apps/datahub/src/app/dataset/dataset-information/dataset-information.component.html index 13aa72f3..ef1150ec 100644 --- a/apps/datahub/src/app/dataset/dataset-information/dataset-information.component.html +++ b/apps/datahub/src/app/dataset/dataset-information/dataset-information.component.html @@ -13,11 +13,11 @@ mel.dataset.updatedOn
{{ lastUpdate }}
- } @if(record.topics?.length) { + } @if(displayCategories?.length) {
mel.dataset.categories
- @for(topic of record.topics; track $index) { + @for(topic of displayCategories; track $index) { {{ topic }} diff --git a/apps/datahub/src/app/dataset/dataset-information/dataset-information.component.ts b/apps/datahub/src/app/dataset/dataset-information/dataset-information.component.ts index 0cc8feef..7a4aacec 100644 --- a/apps/datahub/src/app/dataset/dataset-information/dataset-information.component.ts +++ b/apps/datahub/src/app/dataset/dataset-information/dataset-information.component.ts @@ -23,4 +23,12 @@ export class DatasetInformationComponent { get territories() { return this.record?.keywords?.filter((keyword) => keyword.type === 'place') } + + get displayCategories() { + const categoryKeywords = this.record?.keywords?.filter( + (keyword) => keyword.thesaurus?.name === 'Catégories' + ) + + return categoryKeywords?.map((keyword) => keyword.label) + } } diff --git a/libs/mel/src/lib/results-list-item/results-list-item.component.ts b/libs/mel/src/lib/results-list-item/results-list-item.component.ts index 69514247..3ae22fe2 100644 --- a/libs/mel/src/lib/results-list-item/results-list-item.component.ts +++ b/libs/mel/src/lib/results-list-item/results-list-item.component.ts @@ -22,7 +22,10 @@ export class ResultsListItemComponent { } get keywords() { - return this.record?.keywords?.filter((keyword) => keyword.type !== 'place') + return this.record?.keywords?.filter( + (keyword) => + keyword.type !== 'place' && keyword.thesaurus?.name !== 'Catégories' + ) } onKeywordClick(keyword: Keyword, event: Event) { From 96a426cd9b29a3688ee8b03167b0427d220d3162 Mon Sep 17 00:00:00 2001 From: Angelika Kinas Date: Wed, 22 May 2024 09:47:10 +0200 Subject: [PATCH 2/5] fix(e2e): Fix failing tests on dataset page --- apps/datahub-e2e/src/e2e/dataset.cy.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/datahub-e2e/src/e2e/dataset.cy.ts b/apps/datahub-e2e/src/e2e/dataset.cy.ts index 3d08d8c3..c9a18e6a 100644 --- a/apps/datahub-e2e/src/e2e/dataset.cy.ts +++ b/apps/datahub-e2e/src/e2e/dataset.cy.ts @@ -156,7 +156,7 @@ describe('datasets', () => { it('should display the territories', () => { cy.get('@mainInfo') .children('div') - .eq(2) + .eq(1) .find('div') .children('span') .should('have.length.gt', 0) @@ -174,7 +174,7 @@ describe('datasets', () => { it('should display the producer', () => { cy.get('@mainInfo') .children('div') - .eq(4) + .eq(3) .find('span') .eq(1) .should('have.text', 'Région Hauts-de-France') From 606bfdfdd1e5055495ee01ea60a0ce2af1826f71 Mon Sep 17 00:00:00 2001 From: Angelika Kinas Date: Wed, 22 May 2024 15:04:37 +0200 Subject: [PATCH 3/5] feat(search): Implement category filter and extend FieldsService to support categories --- apps/datahub/src/app/app.module.ts | 3 + .../search-filters.component.ts | 15 +- .../src/app/search/service/fields.service.ts | 23 +++ package-lock.json | 146 ++++++++++-------- package.json | 2 +- resources/translations/fr_MEL.json | 2 +- 6 files changed, 116 insertions(+), 75 deletions(-) create mode 100644 apps/datahub/src/app/search/service/fields.service.ts diff --git a/apps/datahub/src/app/app.module.ts b/apps/datahub/src/app/app.module.ts index 794c3ff0..c5ba9b9e 100644 --- a/apps/datahub/src/app/app.module.ts +++ b/apps/datahub/src/app/app.module.ts @@ -22,6 +22,7 @@ import { UiMapModule, GN_UI_VERSION, WEB_COMPONENT_EMBEDDER_URL, + FieldsService, } from 'geonetwork-ui' import { TranslateLoader, @@ -60,6 +61,7 @@ import { MelMapViewComponent } from './dataset/dataset-visualisation/map-view/ma import { MelDataViewComponent } from './dataset/dataset-visualisation/data-view/data-view.component' import { environment } from '../environments/environnment' import { MelModule, MelEmbeddedTranslateLoader } from '@mel-dataplatform/mel' +import { MelFieldsService } from './search/service/fields.service' @NgModule({ declarations: [ @@ -147,6 +149,7 @@ import { MelModule, MelEmbeddedTranslateLoader } from '@mel-dataplatform/mel' provide: LOGIN_URL, useFactory: () => '${current_url}?login', }, + { provide: FieldsService, useClass: MelFieldsService }, ], bootstrap: [AppComponent], }) diff --git a/apps/datahub/src/app/search/search-filters/search-filters.component.ts b/apps/datahub/src/app/search/search-filters/search-filters.component.ts index 82fac811..cccfde08 100644 --- a/apps/datahub/src/app/search/search-filters/search-filters.component.ts +++ b/apps/datahub/src/app/search/search-filters/search-filters.component.ts @@ -13,10 +13,13 @@ marker('mel.datahub.search.filters.license') changeDetection: ChangeDetectionStrategy.OnPush, }) export class SearchFiltersComponent { - searchConfig = ['topic', 'publisher', 'publicationYear', 'license'].map( - (filter) => ({ - fieldName: filter, - title: `mel.datahub.search.filters.${filter}`, - }) - ) + searchConfig = [ + 'categoryKeyword', + 'publisher', + 'publicationYear', + 'license', + ].map((filter) => ({ + fieldName: filter, + title: `mel.datahub.search.filters.${filter}`, + })) } diff --git a/apps/datahub/src/app/search/service/fields.service.ts b/apps/datahub/src/app/search/service/fields.service.ts new file mode 100644 index 00000000..b6e13949 --- /dev/null +++ b/apps/datahub/src/app/search/service/fields.service.ts @@ -0,0 +1,23 @@ +import { Injectable, Injector } from '@angular/core' +import { marker } from '@biesbjerg/ngx-translate-extract-marker' +import { FieldsService } from 'geonetwork-ui' +import { TranslatedSearchField } from 'geonetwork-ui' + +marker('search.filters.categoryKeyword') +@Injectable({ + providedIn: 'root', +}) +export class MelFieldsService extends FieldsService { + override fields = { + ...this.fields, + categoryKeyword: new TranslatedSearchField( + 'th_thesaurus_mot_cle_thematique_categories.link', + this.injector, + 'asc' + ), + } + + constructor(override injector: Injector) { + super(injector) + } +} diff --git a/package-lock.json b/package-lock.json index 97a430e6..5a976a89 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,7 @@ "@ngx-translate/core": "^15.0.0", "@nx/angular": "17.3.2", "@vendure/ngx-translate-extract": "^9.0.3", - "geonetwork-ui": "^2.3.0-dev.89188551", + "geonetwork-ui": "^2.3.0-dev.6b7e19cb", "rxjs": "~7.8.0", "tippy.js": "^6.3.7", "tslib": "^2.3.0", @@ -2281,22 +2281,6 @@ "semver": "bin/semver.js" } }, - "node_modules/@babel/helper-define-polyfill-provider": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.4.4.tgz", - "integrity": "sha512-QcJMILQCu2jm5TFPGA3lCpJJTeEP+mqeXooG/NZbg/h5FTFi6V0+99ahlRsW8/kRLyb24LZVCCiclDedhLKcBA==", - "peer": true, - "dependencies": { - "@babel/helper-compilation-targets": "^7.22.6", - "@babel/helper-plugin-utils": "^7.22.5", - "debug": "^4.1.1", - "lodash.debounce": "^4.0.8", - "resolve": "^1.14.2" - }, - "peerDependencies": { - "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" - } - }, "node_modules/@babel/helper-environment-visitor": { "version": "7.22.20", "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", @@ -2916,23 +2900,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-async-to-generator": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.22.5.tgz", - "integrity": "sha512-b1A8D8ZzE/VhNDoV1MSJTnpKkCG5bJo+19R4o4oy03zM7ws8yEMK755j61Dc3EyvdysbqH5BOOTquJ7ZX9C6vQ==", - "peer": true, - "dependencies": { - "@babel/helper-module-imports": "^7.22.5", - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/helper-remap-async-to-generator": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-transform-block-scoped-functions": { "version": "7.23.3", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.23.3.tgz", @@ -12425,19 +12392,6 @@ "semver": "bin/semver.js" } }, - "node_modules/babel-plugin-polyfill-corejs3": { - "version": "0.8.7", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.8.7.tgz", - "integrity": "sha512-KyDvZYxAzkC0Aj2dAPyDzi2Ym15e5JKZSK+maI7NAwSqofvuFglbSsxE7wUOvTg9oFVnHMzVzBKcqEb4PJgtOA==", - "peer": true, - "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.4.4", - "core-js-compat": "^3.33.1" - }, - "peerDependencies": { - "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" - } - }, "node_modules/babel-plugin-polyfill-regenerator": { "version": "0.5.5", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.5.5.tgz", @@ -14857,9 +14811,9 @@ "integrity": "sha512-gUI9nhI2iBGF0OaYYLKOaOtliFMl+Bt1rY7VmEjwxOxqoYLub/D9xmduPEhbw2imE6gYkJKhIE5it+KE2ulVxQ==" }, "node_modules/embla-carousel": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/embla-carousel/-/embla-carousel-8.1.0.tgz", - "integrity": "sha512-s6i450b1cppstIQB0RQ/eHzBGS57twsM09GiAE04w4QyLYzZkuosxpiAGxK6Cez6BIp0Vd/SCmD7yWliEP6XEw==" + "version": "8.1.3", + "resolved": "https://registry.npmjs.org/embla-carousel/-/embla-carousel-8.1.3.tgz", + "integrity": "sha512-GiRpKtzidV3v50oVMly8S+D7iE1r96ttt7fSlvtyKHoSkzrAnVcu8fX3c4j8Ol2hZSQlVfDqDIqdrFPs0u5TWQ==" }, "node_modules/emittery": { "version": "0.13.1", @@ -16374,9 +16328,9 @@ } }, "node_modules/geonetwork-ui": { - "version": "2.3.0-dev.89188551", - "resolved": "https://registry.npmjs.org/geonetwork-ui/-/geonetwork-ui-2.3.0-dev.89188551.tgz", - "integrity": "sha512-R4EDGADbW+S4aj+qq7STZeiGoMx9s2JjSr7DczzWmt6QM+m0Cbte+n2yaoYFAg6R/zZepk540Fn7o+auywyTyw==", + "version": "2.3.0-dev.6b7e19cb", + "resolved": "https://registry.npmjs.org/geonetwork-ui/-/geonetwork-ui-2.3.0-dev.6b7e19cb.tgz", + "integrity": "sha512-3pTVqXyRLcGBkbQySZc6YyQVwS9NoxWaAch0mV/fKfet5iSwKmdG3oZ1o6VWmxj6TjMT6utrop9p95dHWSSVng==", "dependencies": { "@biesbjerg/ngx-translate-extract-marker": "^1.0.0", "@camptocamp/ogc-client": "^1.1.0-RC.3", @@ -16617,6 +16571,22 @@ "semver": "bin/semver.js" } }, + "node_modules/geonetwork-ui/node_modules/@angular-devkit/build-angular/node_modules/@babel/helper-define-polyfill-provider": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.4.4.tgz", + "integrity": "sha512-QcJMILQCu2jm5TFPGA3lCpJJTeEP+mqeXooG/NZbg/h5FTFi6V0+99ahlRsW8/kRLyb24LZVCCiclDedhLKcBA==", + "peer": true, + "dependencies": { + "@babel/helper-compilation-targets": "^7.22.6", + "@babel/helper-plugin-utils": "^7.22.5", + "debug": "^4.1.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.14.2" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, "node_modules/geonetwork-ui/node_modules/@angular-devkit/build-angular/node_modules/@babel/plugin-proposal-async-generator-functions": { "version": "7.20.7", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.20.7.tgz", @@ -16653,6 +16623,23 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/geonetwork-ui/node_modules/@angular-devkit/build-angular/node_modules/@babel/plugin-transform-async-to-generator": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.22.5.tgz", + "integrity": "sha512-b1A8D8ZzE/VhNDoV1MSJTnpKkCG5bJo+19R4o4oy03zM7ws8yEMK755j61Dc3EyvdysbqH5BOOTquJ7ZX9C6vQ==", + "peer": true, + "dependencies": { + "@babel/helper-module-imports": "^7.22.5", + "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-remap-async-to-generator": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/geonetwork-ui/node_modules/@angular-devkit/build-angular/node_modules/@babel/plugin-transform-runtime": { "version": "7.22.9", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.22.9.tgz", @@ -17153,6 +17140,19 @@ "node": ">=12" } }, + "node_modules/geonetwork-ui/node_modules/@angular-devkit/build-angular/node_modules/babel-plugin-polyfill-corejs3": { + "version": "0.8.7", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.8.7.tgz", + "integrity": "sha512-KyDvZYxAzkC0Aj2dAPyDzi2Ym15e5JKZSK+maI7NAwSqofvuFglbSsxE7wUOvTg9oFVnHMzVzBKcqEb4PJgtOA==", + "peer": true, + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.4.4", + "core-js-compat": "^3.33.1" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, "node_modules/geonetwork-ui/node_modules/@angular-devkit/build-angular/node_modules/esbuild": { "version": "0.18.17", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.17.tgz", @@ -18920,11 +18920,6 @@ "node": ">=0.10.0" } }, - "node_modules/geonetwork-ui/node_modules/immutable": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.6.tgz", - "integrity": "sha512-Ju0+lEMyzMVZarkTn/gqRpdqd5dOPaz1mCZ0SH3JV6iFw81PldE/PEB1hWVEA288HPt4WXW8O7AWxB10M+03QQ==" - }, "node_modules/geonetwork-ui/node_modules/inquirer": { "version": "8.2.4", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.4.tgz", @@ -20187,6 +20182,11 @@ "node": ">=0.10.0" } }, + "node_modules/immutable": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.6.tgz", + "integrity": "sha512-Ju0+lEMyzMVZarkTn/gqRpdqd5dOPaz1mCZ0SH3JV6iFw81PldE/PEB1hWVEA288HPt4WXW8O7AWxB10M+03QQ==" + }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -26489,11 +26489,6 @@ } } }, - "node_modules/sass/node_modules/immutable": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.4.tgz", - "integrity": "sha512-fsXeu4J4i6WNWSikpI88v/PcVflZz+6kMhUfIwc5SY+poQRPnaf5V7qds6SUyUN3cVxEzuCab7QIoLOQ+DQ1wA==" - }, "node_modules/sax": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz", @@ -28466,12 +28461,12 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "node_modules/typeorm/node_modules/glob": { - "version": "10.3.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.15.tgz", - "integrity": "sha512-0c6RlJt1TICLyvJYIApxb8GsXoai0KUP7AxKKAtsYXdgJR1mGEUa7DgwShbdk1nly0PYoZj01xd4hzbq3fsjpw==", + "version": "10.3.16", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.16.tgz", + "integrity": "sha512-JDKXl1DiuuHJ6fVS2FXjownaavciiHNUU4mOvV/B793RLh05vZL1rcPnCSaOgv1hDT6RDlY7AB7ZUvFYAtPgAw==", "dependencies": { "foreground-child": "^3.1.0", - "jackspeak": "^2.3.6", + "jackspeak": "^3.1.2", "minimatch": "^9.0.1", "minipass": "^7.0.4", "path-scurry": "^1.11.0" @@ -28494,6 +28489,23 @@ "node": ">=8" } }, + "node_modules/typeorm/node_modules/jackspeak": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.1.2.tgz", + "integrity": "sha512-kWmLKn2tRtfYMF/BakihVVRzBKOxz4gJMiL2Rj91WnAB5TPZumSH99R/Yf1qE1u4uRimvCSJfm6hnxohXeEXjQ==", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, "node_modules/typeorm/node_modules/minimatch": { "version": "9.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", diff --git a/package.json b/package.json index cc8ca620..93516bcf 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@ngx-translate/core": "^15.0.0", "@nx/angular": "17.3.2", "@vendure/ngx-translate-extract": "^9.0.3", - "geonetwork-ui": "2.3.0-dev.89188551", + "geonetwork-ui": "^2.3.0-dev.6b7e19cb", "rxjs": "~7.8.0", "tippy.js": "^6.3.7", "tslib": "^2.3.0", diff --git a/resources/translations/fr_MEL.json b/resources/translations/fr_MEL.json index 5efe2157..5991ce6c 100644 --- a/resources/translations/fr_MEL.json +++ b/resources/translations/fr_MEL.json @@ -10,10 +10,10 @@ "mel.datahub.home.title": "Métropole Européenne de Lille", "mel.datahub.multiselect.filter.placeholder": "Rechercher", "mel.datahub.search.clear": "Effacer", + "mel.datahub.search.filters.categoryKeyword": "Catégorie", "mel.datahub.search.filters.license": "Licence", "mel.datahub.search.filters.publicationYear": "Date", "mel.datahub.search.filters.publisher": "Producteur", - "mel.datahub.search.filters.topic": "Thématique", "mel.datahub.search.form.description": "Vous pouvez utiliser la barre de recherche ou les différents filtres situés ci-dessous pour trouver un jeu de données plus rapidement.", "mel.datahub.search.form.title": "Trouver un jeu de données", "mel.datahub.search.hits.found": "{hits, plural, =0{Aucune correspondance.} one{1 enregistrement trouvé.} other{Ensemble des données: {hits}}}", From f861267fc07a55297f49e0fdf392be9885980ece Mon Sep 17 00:00:00 2001 From: Angelika Kinas Date: Thu, 23 May 2024 08:55:51 +0200 Subject: [PATCH 4/5] fix(e2e): Change tested filter to fix test --- apps/datahub-e2e/src/e2e/search.cy.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/datahub-e2e/src/e2e/search.cy.ts b/apps/datahub-e2e/src/e2e/search.cy.ts index a67a092a..7d087ff8 100644 --- a/apps/datahub-e2e/src/e2e/search.cy.ts +++ b/apps/datahub-e2e/src/e2e/search.cy.ts @@ -165,21 +165,21 @@ describe('search', () => { it('should display the search results in a grid', () => { cy.get('mel-datahub-results-list-grid').should('be.visible') }) - it('should filter the results when selecting a filter value (topic)', () => { - cy.get('@filters').first().click() + it('should filter the results when selecting a filter value (licence)', () => { + cy.get('@filters').eq(3).click() getFilterOptions() - cy.get('@options').first().click() + cy.get('@options').eq(1).click() cy.get('@result-cards').should('have.length', 2) cy.get('@result-cards') .first() .find('h1') - .should('have.text', ' Alpenkonvention ') + .should('have.text', ' Accroches vélos MEL ') cy.get('@result-cards') .eq(1) .find('h1') .should( 'have.text', - ' Patrimoine - Biens classés et zones de protection - Série ' + ' Mat éolien construit ou en projet dans les Hauts de France ' ) }) it('should filter the results when selecting multiple filter values (producer)', () => { From 39a4e80e0ee5c64c4d60fec505552171c5a0b514 Mon Sep 17 00:00:00 2001 From: Angelika Kinas Date: Thu, 23 May 2024 09:07:11 +0200 Subject: [PATCH 5/5] feat(search): Change date filter to use revisionYearForResource --- .../app/search/search-filters/search-filters.component.ts | 2 +- apps/datahub/src/app/search/service/fields.service.ts | 7 ++++++- resources/translations/en_MEL.json | 4 ++-- resources/translations/fr_MEL.json | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/datahub/src/app/search/search-filters/search-filters.component.ts b/apps/datahub/src/app/search/search-filters/search-filters.component.ts index cccfde08..cfabb4eb 100644 --- a/apps/datahub/src/app/search/search-filters/search-filters.component.ts +++ b/apps/datahub/src/app/search/search-filters/search-filters.component.ts @@ -16,7 +16,7 @@ export class SearchFiltersComponent { searchConfig = [ 'categoryKeyword', 'publisher', - 'publicationYear', + 'revisionYear', 'license', ].map((filter) => ({ fieldName: filter, diff --git a/apps/datahub/src/app/search/service/fields.service.ts b/apps/datahub/src/app/search/service/fields.service.ts index b6e13949..ec9b69d0 100644 --- a/apps/datahub/src/app/search/service/fields.service.ts +++ b/apps/datahub/src/app/search/service/fields.service.ts @@ -1,6 +1,6 @@ import { Injectable, Injector } from '@angular/core' import { marker } from '@biesbjerg/ngx-translate-extract-marker' -import { FieldsService } from 'geonetwork-ui' +import { FieldsService, SimpleSearchField } from 'geonetwork-ui' import { TranslatedSearchField } from 'geonetwork-ui' marker('search.filters.categoryKeyword') @@ -15,6 +15,11 @@ export class MelFieldsService extends FieldsService { this.injector, 'asc' ), + revisionYear: new SimpleSearchField( + 'revisionYearForResource', + this.injector, + 'desc' + ), } constructor(override injector: Injector) { diff --git a/resources/translations/en_MEL.json b/resources/translations/en_MEL.json index 67a2367e..71fa7a85 100644 --- a/resources/translations/en_MEL.json +++ b/resources/translations/en_MEL.json @@ -10,10 +10,10 @@ "mel.datahub.home.title": "Métropole Européenne de Lille", "mel.datahub.multiselect.filter.placeholder": "", "mel.datahub.search.clear": "", + "mel.datahub.search.filters.categoryKeyword": "Category", "mel.datahub.search.filters.license": "", - "mel.datahub.search.filters.publicationYear": "", "mel.datahub.search.filters.publisher": "", - "mel.datahub.search.filters.topic": "", + "mel.datahub.search.filters.revisionYear": "Date", "mel.datahub.search.form.description": "", "mel.datahub.search.form.title": "", "mel.datahub.search.hits.found": "", diff --git a/resources/translations/fr_MEL.json b/resources/translations/fr_MEL.json index 5991ce6c..a1c7dfb3 100644 --- a/resources/translations/fr_MEL.json +++ b/resources/translations/fr_MEL.json @@ -12,8 +12,8 @@ "mel.datahub.search.clear": "Effacer", "mel.datahub.search.filters.categoryKeyword": "Catégorie", "mel.datahub.search.filters.license": "Licence", - "mel.datahub.search.filters.publicationYear": "Date", "mel.datahub.search.filters.publisher": "Producteur", + "mel.datahub.search.filters.revisionYear": "Date", "mel.datahub.search.form.description": "Vous pouvez utiliser la barre de recherche ou les différents filtres situés ci-dessous pour trouver un jeu de données plus rapidement.", "mel.datahub.search.form.title": "Trouver un jeu de données", "mel.datahub.search.hits.found": "{hits, plural, =0{Aucune correspondance.} one{1 enregistrement trouvé.} other{Ensemble des données: {hits}}}",