From 9e2e3176d66b7c40ef5c04a1551236c0825a5748 Mon Sep 17 00:00:00 2001 From: Florian Necas Date: Tue, 3 Oct 2023 12:09:01 +0200 Subject: [PATCH] feat: add other records --- .../search-filters.component.html | 17 ++++++++++++++++- .../search-filters/search-filters.component.ts | 11 ++++++++--- translations/en.json | 1 + 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/apps/datahub/src/app/home/search/search-filters/search-filters.component.html b/apps/datahub/src/app/home/search/search-filters/search-filters.component.html index d682aeeca8..03e0a68d97 100644 --- a/apps/datahub/src/app/home/search/search-filters/search-filters.component.html +++ b/apps/datahub/src/app/home/search/search-filters/search-filters.component.html @@ -63,7 +63,7 @@

(toggled)="toggleSpatialFilter($event)" > -
+
(toggled)="toggleMyRecordsFilter($event)" >
+
+ + {{ 'search.filters.otherRecords' | translate }} + close + +
searchConfig: { fieldName: string; title: string }[] isOpen = false - private userId: string + userId: string constructor( public searchFacade: SearchFacade, @@ -38,7 +38,7 @@ export class SearchFiltersComponent implements OnInit { ) {} ngOnInit(): void { - this.authService.user$.subscribe((user) => (this.userId = user.id)) + this.authService.user$.subscribe((user) => (this.userId = user?.id)) this.searchConfig = ( getOptionalSearchConfig().ADVANCED_FILTERS || [ 'publisher', @@ -130,7 +130,12 @@ export class SearchFiltersComponent implements OnInit { switchMap((filters) => { return this.fieldsService.readFieldValuesFromFilters(filters) }), - map((fieldValues) => !!fieldValues['owner']) + map((fieldValues) => { + if (fieldValues['owner'] && Array.isArray(fieldValues['owner'])) { + return fieldValues['owner'].length > 0 + } + return !!fieldValues['owner'] + }) ) } diff --git a/translations/en.json b/translations/en.json index c7934e9393..91782836ec 100644 --- a/translations/en.json +++ b/translations/en.json @@ -236,6 +236,7 @@ "search.filters.minimize": "Minimize", "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.title": "Filter your results", "search.filters.useSpatialFilter": "Show records in the area of interest first", "search.filters.useSpatialFilterHelp": "When this is enabled, records situated in the catalog's area of interest are shown first; records outside of this area will not show up.",