Skip to content

Commit

Permalink
feat(search): Implement category filter and
Browse files Browse the repository at this point in the history
extend FieldsService to support categories
  • Loading branch information
Angi-Kinas committed May 22, 2024
1 parent 96a426c commit 606bfdf
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 75 deletions.
3 changes: 3 additions & 0 deletions apps/datahub/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
UiMapModule,
GN_UI_VERSION,
WEB_COMPONENT_EMBEDDER_URL,
FieldsService,
} from 'geonetwork-ui'
import {
TranslateLoader,
Expand Down Expand Up @@ -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: [
Expand Down Expand Up @@ -147,6 +149,7 @@ import { MelModule, MelEmbeddedTranslateLoader } from '@mel-dataplatform/mel'
provide: LOGIN_URL,
useFactory: () => '${current_url}?login',
},
{ provide: FieldsService, useClass: MelFieldsService },
],
bootstrap: [AppComponent],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
}))
}
23 changes: 23 additions & 0 deletions apps/datahub/src/app/search/service/fields.service.ts
Original file line number Diff line number Diff line change
@@ -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)
}
}
146 changes: 79 additions & 67 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion resources/translations/fr_MEL.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}}}",
Expand Down

0 comments on commit 606bfdf

Please sign in to comment.