From 8e5f134bea29e23ecb7eb48abc3abfc6ee6d6b97 Mon Sep 17 00:00:00 2001 From: Olli Mannevaara Date: Thu, 29 Feb 2024 15:49:49 +0200 Subject: [PATCH] Hide unknown or missing values from being filter values --- .../publications2.component.html | 13 +++++++++++- .../publications2/publications2.component.ts | 20 +++++++++++++++++-- .../components/results/results.component.html | 8 +++----- .../search-bar2/search-bar2.component.html | 7 ++++++- .../search-bar2/search-bar2.component.ts | 3 +++ src/i18n/messages.en.xlf | 8 ++++++++ src/i18n/messages.sv.xlf | 8 ++++++++ src/i18n/messages.xlf | 7 +++++++ 8 files changed, 65 insertions(+), 9 deletions(-) diff --git a/src/app/portal/components/results/publications2/publications2.component.html b/src/app/portal/components/results/publications2/publications2.component.html index f16cfa089..3eaa02afb 100644 --- a/src/app/portal/components/results/publications2/publications2.component.html +++ b/src/app/portal/components/results/publications2/publications2.component.html @@ -565,7 +565,12 @@

Julkaisut - {{total$ | async}}

tulosta / sivu - Mitä julkaisutietoja palvelu sisältää? + + + Mitä julkaisutietoja palvelu sisältää? + + + @@ -783,6 +788,12 @@

Julkaisut - {{total$ | async}}

+ +
+
Tyhjennä rajaukset
+ +
+ diff --git a/src/app/portal/components/results/publications2/publications2.component.ts b/src/app/portal/components/results/publications2/publications2.component.ts index 812984f38..36141aa83 100644 --- a/src/app/portal/components/results/publications2/publications2.component.ts +++ b/src/app/portal/components/results/publications2/publications2.component.ts @@ -23,7 +23,7 @@ import { HighlightedPublication, Publication2Service, SearchParams } from '@portal/services/publication2.service'; -import { map, take, tap } from 'rxjs/operators'; +import { filter, map, take, tap } from 'rxjs/operators'; import { SharedModule } from '@shared/shared.module'; import { SearchBar2Component } from '@portal/search-bar2/search-bar2.component'; import { NgArrayPipesModule, NgMathPipesModule } from 'ngx-pipes'; @@ -127,6 +127,17 @@ export class Publications2Component implements OnDestroy { this.filterCount$.next(count); } + clearFilters() { + this.router.navigate([], { + relativeTo: this.route, + queryParams: { + q: this.keywords, + page: this.page.toString(), + size: this.size.toString(), + } + }); + } + displayedColumns: string[] = ['icon', 'publicationName', 'authorsText', 'publisherName', 'publicationYear']; highlights$ = this.publications2Service.getSearch(); // TODO: /*: Observable*/ @@ -192,6 +203,7 @@ export class Publications2Component implements OnDestroy { publicationFormatAdditions$ = this.aggregations$.pipe( map(aggs => getPublicationFormatAdditions(aggs).map((bucket: any) => ({ id: bucket.key, count: bucket.doc_count })) ?? []), + map(aggs => aggs.filter(publicationFormatAddition => publicationFormatAddition.id !== "-1")), map(aggs => aggs.sort((a, b) => b.count - a.count)) ); @@ -209,6 +221,7 @@ export class Publications2Component implements OnDestroy { publicationAudienceAdditions$ = this.aggregations$.pipe( map(aggs => getPublicationAudienceAdditions(aggs).map((bucket: any) => ({ id: bucket.key, count: bucket.doc_count })) ?? []), + map(aggs => aggs.filter(publicationAudienceAddition => publicationAudienceAddition.id !== "-1")), map(aggs => aggs.sort((a, b) => b.count - a.count)) ); @@ -224,7 +237,8 @@ export class Publications2Component implements OnDestroy { peerReviewedAdditions$ = this.aggregations$.pipe( map(aggs => getPeerReviewedAdditions(aggs).map((bucket: any) => ({ id: bucket.key, count: bucket.doc_count })) ?? []), - map(aggs => aggs.sort((a, b) => b.count - a.count)) + map(aggs => aggs.filter(peerReviewedAddition => ![' ', '-1'].includes(peerReviewedAddition.id))), + map(aggs => aggs.sort((a, b) => b.count - a.count)), ); peerReviewedNames$ = this.publications2Service.getPeerReviewedNames(); @@ -241,11 +255,13 @@ export class Publications2Component implements OnDestroy { parentPublicationTypeAdditions$ = this.aggregations$.pipe( map(aggs => getParentPublicationTypeAdditions(aggs).map((bucket: any) => ({ id: bucket.key, count: bucket.doc_count })) ?? []), + map(aggs => aggs.filter(parentPublicationTypeAddition => parentPublicationTypeAddition.id !== "-1")), map(aggs => aggs.sort((a, b) => b.count - a.count)) ); publisherInternationalityAdditions$ = this.aggregations$.pipe( map(aggs => getPublisherInternationalityAdditions(aggs).map((bucket: any) => ({ id: bucket.key.toString(), count: bucket.doc_count })) ?? []), + map(aggs => aggs.filter(internationalPublicationAddition => internationalPublicationAddition.id !== "9")), map(aggs => aggs.sort((a, b) => b.count - a.count)) ); diff --git a/src/app/portal/components/results/results.component.html b/src/app/portal/components/results/results.component.html index db7509bfd..2e9d583da 100644 --- a/src/app/portal/components/results/results.component.html +++ b/src/app/portal/components/results/results.component.html @@ -189,11 +189,9 @@

Mitä rahoitushakutietoja palvelu sisältää? - Mitä {{ selectedTabData?.singular.toLowerCase() }} - tietoja palvelu sisältää? + Mitä + {{ selectedTabData?.singular.toLowerCase() }} + tietoja palvelu sisältää? diff --git a/src/app/portal/search-bar2/search-bar2.component.html b/src/app/portal/search-bar2/search-bar2.component.html index bf4830832..a48acaffc 100644 --- a/src/app/portal/search-bar2/search-bar2.component.html +++ b/src/app/portal/search-bar2/search-bar2.component.html @@ -21,7 +21,12 @@ tabindex='0' /> - + +
+ Hakuohje + +
diff --git a/src/app/portal/search-bar2/search-bar2.component.ts b/src/app/portal/search-bar2/search-bar2.component.ts index 3df1cfd4b..d1e21a992 100644 --- a/src/app/portal/search-bar2/search-bar2.component.ts +++ b/src/app/portal/search-bar2/search-bar2.component.ts @@ -22,6 +22,9 @@ export class SearchBar2Component { // search is pressed output @Output() search = new EventEmitter(); + // instruction button is pressed output + @Output() instructions = new EventEmitter(); + public keywords = this.route.snapshot.queryParams.q ?? ""; searchKeywords(keywords: string) { diff --git a/src/i18n/messages.en.xlf b/src/i18n/messages.en.xlf index 6279b2053..2b6dddb66 100644 --- a/src/i18n/messages.en.xlf +++ b/src/i18n/messages.en.xlf @@ -6730,6 +6730,14 @@ Haettaessa ISSN:ä: issn:"1234-1234" When searching for ISSN: issn:"1234-1234" + + + + + Mitä julkaisutietoja palvelu sisältää? + What publication information is included in the service? + + diff --git a/src/i18n/messages.sv.xlf b/src/i18n/messages.sv.xlf index 0b1f889f8..3a02d2038 100644 --- a/src/i18n/messages.sv.xlf +++ b/src/i18n/messages.sv.xlf @@ -6735,6 +6735,14 @@ uppgifter till datalagret för forskningsinformation. De gemensamma personuppgif Haettaessa ISSN:ä: issn:"1234-1234" När du söker efter ISSN: issn:"1234-1234" + + + + + Mitä julkaisutietoja palvelu sisältää? + Vilka publikationsuppgifter finns i tjänsten? + + diff --git a/src/i18n/messages.xlf b/src/i18n/messages.xlf index 611fe5be4..13c6f859a 100644 --- a/src/i18n/messages.xlf +++ b/src/i18n/messages.xlf @@ -2726,6 +2726,13 @@ Haettaessa ISSN:ä: issn:"1234-1234" + + + + + Mitä julkaisutietoja palvelu sisältää? + +