diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000000..1c70cb2457 --- /dev/null +++ b/TODO.md @@ -0,0 +1,62 @@ +# TODO : + +- [ ] contact: organisation ou individualname + +Contact filter : + +- Organisation (translated) +- Individual name + +Add filter along others : +Map with ES (elastic search) +Add individualName to retrieve in the request to index + +Json retrieved from index + +```json +"contactForResource": [ + { + "individual": "Beat Tschumi", + "organisationObject": { + "default": "Office fédéral de l'agriculture", + "langger": "Bundesamt für Landwirtschaft", + "langeng": "Federal Office for Agriculture", + "langroh": "Bundesamt für Landwirtschaft", + "langita": "Ufficio federale dell'agricoltura", + "langfre": "Office fédéral de l'agriculture" + }, + "email": "info@blw.admin.ch" + } + ], +``` + +## Questions for Florent: + +- contact or contact for resource? +- where is the codelist ? Do we import it with geonetwork API ? + +```ts +export const RoleValues = [ + 'unspecified', + 'other', + 'author', // Party who authored the resource + 'collaborator', // party who assists with the generation of the resource other than the principal investigator + 'contributor', // party contributing to the resource + 'custodian', // Party that accepts accountability and responsibility for the data and ensures appropriate care and maintenance of the resource + 'distributor', // Party who distributes the resource + 'editor', // party who reviewed or modified the resource to improve the content + 'funder', // party providing monetary support for the resource + 'mediator', // a class of entity that mediates access to the resource and for whom the resource is intended or useful + 'originator', // Party who created the resource + 'owner', // Party that owns the resource + 'point_of_contact', // Party who can be contacted for acquiring knowledge about or acquisition of the resource + 'principal_investigator', // Key party responsible for gathering information and conducting research + 'processor', // Party who has processed the data in a manner such that the resource has been modified + 'publisher', // Party who published the resource + 'resource_provider', // Party that supplies the resource + 'rights_holder', // party owning or managing rights over the resource + 'sponsor', // party that sponsors the resource + 'stakeholder', // party who has an interest in the resource or the use of the resource + 'user', // Party who uses the resource +] +``` diff --git a/apps/datahub/src/app/home/search/search-filters/search-filters.component.spec.ts b/apps/datahub/src/app/home/search/search-filters/search-filters.component.spec.ts index 6256fa1dd1..65ce16e08d 100644 --- a/apps/datahub/src/app/home/search/search-filters/search-filters.component.spec.ts +++ b/apps/datahub/src/app/home/search/search-filters/search-filters.component.spec.ts @@ -34,6 +34,7 @@ jest.mock('@geonetwork-ui/util/app-config', () => ({ 'license', 'topic', 'publicationYear', + 'contact', ], }), })) @@ -99,6 +100,7 @@ class FieldsServiceMock { 'license', 'topic', 'publicationYear', + 'contact', ] } } @@ -300,6 +302,7 @@ describe('SearchFiltersComponent', () => { filter_license: {}, filter_documentStandard: {}, filter_inspireKeyword: {}, + filter_contact: {}, }) }) }) diff --git a/apps/datahub/src/app/home/search/search-filters/search-filters.component.ts b/apps/datahub/src/app/home/search/search-filters/search-filters.component.ts index 49d1991ea8..7b7d237c0a 100644 --- a/apps/datahub/src/app/home/search/search-filters/search-filters.component.ts +++ b/apps/datahub/src/app/home/search/search-filters/search-filters.component.ts @@ -59,6 +59,7 @@ export class SearchFiltersComponent implements OnInit { 'topic', 'isSpatial', 'license', + 'inspireKeyword', ] ) .filter((adv_filter) => { diff --git a/apps/datahub/src/assets/img/geocat-logo.png b/apps/datahub/src/assets/img/geocat-logo.png new file mode 100644 index 0000000000..99abeb2bca Binary files /dev/null and b/apps/datahub/src/assets/img/geocat-logo.png differ diff --git a/conf/default.toml b/conf/default.toml index e47ec6f9af..67b80dc877 100644 --- a/conf/default.toml +++ b/conf/default.toml @@ -13,9 +13,8 @@ datahub_url = "/datahub" proxy_path = "" # This optional parameter defines, in which language metadata should be queried in elasticsearch. # Use ISO 639-2/B (https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format to indicate the language of the metadata. -# Setting to "current" will use the current language of the User Interface. # If not indicated, a wildcard is used and no language preference is applied for the search. -# metadata_language = "current" +metadata_language = "current" # This optional URL should point to the login page that allows authentication to the datahub. # If not indicated, the default geonetwork login page is used. # The following three placeholders can be part of this URL: @@ -32,7 +31,7 @@ proxy_path = "" # This optional parameter defines the languages that will be provided in a dropdown for the user to translate the UI. # Available languages are listed here: (https://github.com/geonetwork/geonetwork-ui/blob/main/libs/util/i18n/src/lib/i18n.constants.ts). # More information about the translation can be found in the docs (https://geonetwork.github.io/geonetwork-ui/main/docs/reference/i18n.html) -# languages = ['en', 'fr', 'de'] +languages = ['en', 'fr', 'de', 'it'] ### VISUAL THEME @@ -41,16 +40,16 @@ proxy_path = "" # - for font families: https://developer.mozilla.org/en-US/docs/Web/CSS/font-family # - for background: https://developer.mozilla.org/en-US/docs/Web/CSS/background [theme] -primary_color = "#c82850" -secondary_color = "#001638" -main_color = "#555" # All-purpose text color +primary_color = "#f19330" +secondary_color = "#0071ae" +main_color = "#212029" # All-purpose text color background_color = "#fdfbff" # These optional parameters indicate which background should be used for the main header and the text color used # on top of the background. The color should be chosen to contrast well with the background (defaults to white). # Note: The search header does not use the header_foreground_color as it allows futher customisation via HTML. -# header_background = "center /cover url('assets/img/header_bg.webp')" or "var(--color-gray-500)" -# header_foreground_color = 'white' +header_background = "linear-gradient(to bottom, #fff 0%, 37%, #fff 37%, 70%, var(--color-secondary) 100%)" +header_foreground_color = 'inherit' # This optional parameter allows to override the fallback image that should be used for thumbnails, # if the metadata record has no thumbnail image url or it is broken. @@ -65,7 +64,6 @@ background_color = "#fdfbff" # This section contains settings used for fine-tuning the search experience [search] - # Optional; specify a GeoJSON object to be used as filter: all records contained inside the geometry will be boosted on top, # all records which do not intersect with the geometry will be shown with lower priority; can be specified as URL or inline # Note: if the GeoJSON object contains multiple features, only the geometry of the first one will be kept! @@ -75,11 +73,11 @@ background_color = "#fdfbff" # The advanced search filters available to the user can be customized with this setting. # The following fields can be used for filtering: 'publisher', 'format', 'publicationYear', 'standard', 'inspireKeyword', 'topic', 'isSpatial', 'license' # any other field will be ignored -# advanced_filters = ['publisher', 'format', 'publicationYear', 'topic', 'isSpatial', 'license'] +advanced_filters = ['topic', 'publisher', 'contact', 'inspireKeyword', 'resourceType', 'representationType', 'format'] # One or several search presets can be defined here; every search preset is composed of: # - a name (which can be a translation key) -# - a sort criteria: either `createDate`, `userSavedCount` or `_score` (prepend with `-` for descending sort) (optionnal) +# - a sort criteria: either `createDate`, `userSavedCount` or `_score` (prepend with `-` for descending sort) # - filters which can be expressed like so: # [[search_preset]] # name = 'filterByName' @@ -92,7 +90,6 @@ background_color = "#fdfbff" # filters.publicationYear = ['2023', '2022'] # filters.isSpatial = ['yes'] # filters.license = ['unknown'] -# sort = 'createDate' # [[search_preset]] # name = 'otherFilterName' # filters.q = 'Other Full text search' @@ -100,35 +97,13 @@ background_color = "#fdfbff" # Search presets will be advertised to the user along the main search field. - -### METADATA QUALITY SETTINGS - -# This section contains settings used for fine-tuning the metadata quality experience -[metadata-quality] -# By default the widget is not activated to enable it, just add this parameter. -# enabled = true -# If u want to use metadata quality widget this configuration is required - -# if you add an indexed field to calculate the qualityScore, the datahub search allow you to sort on this field with this parameter -# sortable = true - -# by default the widget appears in 2 locations in the search list and in the detail page -# allow you to hide the widget in detail -# display_widget_in_detail = false -# allow you to hide the widget in search list -# display_widget_in_search = false -# If you want see the widget in the two locations, don't fill theses configurations - -# By default the window popup all fields to view if they are filled or not but you can hide some -# display_title = false -# display_description = false -# display_topic = false -# display_keywords = false -# display_legal_constraints = false -# display_contact = false -# display_update_frequency = false -# display_organisation = false -# If you want see all fields, don't fill theses configurations +# [[search_preset]] +# sort = "-createDate" +# name = 'filterByOrgs' +# filters.publisher = ['DREAL', 'atmo Hauts-de-France', 'blargz'] +# [[search_preset]] +# name = 'Wind turbines' +# filters.q = 'wind' ### MAP SETTINGS @@ -201,3 +176,31 @@ background_color = "#fdfbff" # Welcome to Organization's
# wonderful data catalogue # """ +[translations.fr] +datahub.header.title.html = '
' +search.field.location.placeholder = 'ex: Berne' +datahub.header.organisations = 'Catalogues' +search.filters.publisher = 'Catalogues' +datahub.header.documentation = 'Documentation' +datahub.header.admin = 'Admin' +[translations.en] +datahub.header.title.html = '
' +search.field.location.placeholder = 'ex: Berne' +datahub.header.organisations = 'Catalogues' +search.filters.publisher = 'Catalogues' +datahub.header.documentation = 'Documentation' +datahub.header.admin = 'Admin' +[translations.de] +datahub.header.title.html = '
' +search.field.location.placeholder = 'ex: Berne' +datahub.header.organisations = 'Katalogen' +search.filters.publisher = 'Katalogen' +datahub.header.documentation = 'Dokumentation' +datahub.header.admin = 'Admin' +[translations.it] +datahub.header.title.html = '
' +search.field.location.placeholder = 'ex: Berne' +datahub.header.organisations = 'Cataloghi' +search.filters.publisher = 'Cataloghi' +datahub.header.documentation = "Documentazione" +datahub.header.admin = 'Admin' diff --git a/libs/feature/search/src/lib/constants.ts b/libs/feature/search/src/lib/constants.ts index 72ff6f05ae..13f1c346a2 100644 --- a/libs/feature/search/src/lib/constants.ts +++ b/libs/feature/search/src/lib/constants.ts @@ -14,6 +14,7 @@ export const FIELDS_SUMMARY: FieldName[] = [ 'codelist_status_text', 'linkProtocol', 'contactForResource*.organisation*', + 'contactForResource*.individual*', 'contact*.organisation*', 'contact*.email', 'userSavedCount', 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 d2b8d9b669..a5e34227f0 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 @@ -78,6 +78,7 @@ describe('FieldsService', () => { 'q', 'license', 'owner', + 'contact', ]) }) }) @@ -158,6 +159,7 @@ describe('FieldsService', () => { resourceType: [], topic: [], owner: [], + contact: [], }) }) }) 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 8c2bed40ae..7e1c07d5b0 100644 --- a/libs/feature/search/src/lib/utils/service/fields.service.ts +++ b/libs/feature/search/src/lib/utils/service/fields.service.ts @@ -9,6 +9,8 @@ import { OrganizationSearchField, OwnerSearchField, SimpleSearchField, + ContactSearchField, + //GnUiTranslationSearchFieldArray, } from './fields' import { forkJoin, Observable, of } from 'rxjs' import { map } from 'rxjs/operators' @@ -52,11 +54,16 @@ export class FieldsService { this.injector ), topic: new GnUiTranslationSearchField('cl_topic.key', 'asc', this.injector), - inspireKeyword: new SimpleSearchField( - 'th_httpinspireeceuropaeutheme-theme_tree.default', + inspireKeyword: new GnUiTranslationSearchField( + 'th_httpinspireeceuropaeutheme-theme.link', 'asc', this.injector ), + /*inspireKeyword: new SimpleSearchField( + 'th_httpinspireeceuropaeutheme-theme_tree.key', //todo remove default + 'asc', + this.injector + ),*/ documentStandard: new SimpleSearchField( 'documentStandard', 'asc', @@ -66,6 +73,7 @@ export class FieldsService { q: new FullTextSearchField(), license: new LicenseSearchField(this.injector), owner: new OwnerSearchField(this.injector), + contact: new ContactSearchField(this.injector), // || organization } as Record get supportedFields() { diff --git a/libs/feature/search/src/lib/utils/service/fields.ts b/libs/feature/search/src/lib/utils/service/fields.ts index 272fb73362..89b979d8be 100644 --- a/libs/feature/search/src/lib/utils/service/fields.ts +++ b/libs/feature/search/src/lib/utils/service/fields.ts @@ -1,6 +1,6 @@ import { firstValueFrom, Observable, of, switchMap } from 'rxjs' import { ToolsApiService } from '@geonetwork-ui/data-access/gn4' -import { catchError, map, shareReplay } from 'rxjs/operators' +import { catchError, map, shareReplay, tap } from 'rxjs/operators' import { Injector } from '@angular/core' import { TranslateService } from '@ngx-translate/core' import { marker } from '@biesbjerg/ngx-translate-extract-marker' @@ -107,7 +107,10 @@ export class GnUiTranslationSearchField extends SimpleSearchField { private async getTranslation(topicKey: string) { return firstValueFrom( - this.allTranslations.pipe(map((translations) => translations[topicKey])) + this.allTranslations.pipe( + tap((val) => console.log(topicKey, val)), + map((translations) => translations[topicKey]) + ) ) } @@ -117,13 +120,13 @@ export class GnUiTranslationSearchField extends SimpleSearchField { getAvailableValues(): Observable { // sort values by alphabetical order - return super - .getAvailableValues() - .pipe( - map((values) => - values.sort((a, b) => new Intl.Collator().compare(a.label, b.label)) - ) - ) + return super.getAvailableValues().pipe( + tap((val) => console.log(val)), + map((values) => + values.sort((a, b) => new Intl.Collator().compare(a.label, b.label)) + ), + tap((val) => console.log('after', val)) + ) } } @@ -272,6 +275,27 @@ if(unknown) emit('unknown');` } } +export class ContactSearchField implements AbstractSearchField { + private orgsService = this.injector.get(OrganizationsServiceInterface) + + constructor(private injector: Injector) {} + + getFiltersForValues(values: FieldValue[]): Observable { + //todo + return of() + } + + getValuesForFilter(filters: FieldFilters): Observable { + //todo + return of() + } + + getAvailableValues(): Observable { + //todo + return of() + } +} + // This will use the OrganizationsServiceInterface // Field values are the organization names export class OrganizationSearchField implements AbstractSearchField { diff --git a/libs/util/app-config/src/lib/app-config.spec.ts b/libs/util/app-config/src/lib/app-config.spec.ts index f6bc4cdb31..14efbfde02 100644 --- a/libs/util/app-config/src/lib/app-config.spec.ts +++ b/libs/util/app-config/src/lib/app-config.spec.ts @@ -178,6 +178,7 @@ describe('app config utils', () => { 'inspireKeyword', 'topic', 'license', + 'contact', ], }) }) diff --git a/libs/util/app-config/src/lib/fixtures.ts b/libs/util/app-config/src/lib/fixtures.ts index 343595bd67..b172647ad0 100644 --- a/libs/util/app-config/src/lib/fixtures.ts +++ b/libs/util/app-config/src/lib/fixtures.ts @@ -37,7 +37,7 @@ fonts_stylesheet_url = "https://fonts.googleapis.com/css2?family=Open+Sans" [search] filter_geometry_url = 'https://my.domain.org/geom.json' -advanced_filters = ['publicationYear', 'documentStandard', 'inspireKeyword', 'topic', 'license'] +advanced_filters = ['publicationYear', 'documentStandard', 'inspireKeyword', 'topic', 'license', 'contact'] [[search_preset]] sort = "-createDate"