From 09b61ddf02f279db912f5c8d5778cba5182c9a04 Mon Sep 17 00:00:00 2001 From: "Gantner, Florian Klaus" Date: Fri, 28 Apr 2023 18:56:43 +0200 Subject: [PATCH] use routerLink for counters section use routerLink for counter section component --- .../counters-section.component.html | 12 ++++++------ .../counters-section.component.ts | 19 ++++++++++++------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/app/shared/explore/section-component/counters-section/counters-section.component.html b/src/app/shared/explore/section-component/counters-section/counters-section.component.html index ac433476d86..7466e796c8d 100644 --- a/src/app/shared/explore/section-component/counters-section/counters-section.component.html +++ b/src/app/shared/explore/section-component/counters-section/counters-section.component.html @@ -6,18 +6,18 @@
-
-
{{'explore.counters-section.' + counter.label | translate}}
-
{{counter.count}}
diff --git a/src/app/shared/explore/section-component/counters-section/counters-section.component.ts b/src/app/shared/explore/section-component/counters-section/counters-section.component.ts index f4ed8adb04f..9ea126101de 100644 --- a/src/app/shared/explore/section-component/counters-section/counters-section.component.ts +++ b/src/app/shared/explore/section-component/counters-section/counters-section.component.ts @@ -1,9 +1,8 @@ -import { Component, Inject, Input, OnInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { BehaviorSubject, forkJoin, Observable } from 'rxjs'; import { map } from 'rxjs/operators'; -import { NativeWindowRef, NativeWindowService } from '../../../../core/services/window.service'; import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; import { SearchObjects } from '../../../search/models/search-objects.model'; import { getFirstSucceededRemoteDataPayload } from '../../../../core/shared/operators'; @@ -11,6 +10,7 @@ import { PaginationComponentOptions } from '../../../pagination/pagination-compo import { SectionComponent } from '../../../../core/layout/models/section.model'; import { SearchService } from '../../../../core/shared/search/search.service'; import { PaginatedSearchOptions } from '../../../search/models/paginated-search-options.model'; +import { Router } from '@angular/router'; import { hasValue } from '../../../empty.util'; @Component({ @@ -25,7 +25,6 @@ export class CountersSectionComponent implements OnInit { @Input() countersSection: CountersSection; - counterData: CounterData[] = []; counterData$: Observable; isLoading$ = new BehaviorSubject(true); @@ -36,7 +35,7 @@ export class CountersSectionComponent implements OnInit { }); - constructor(private searchService: SearchService, @Inject(NativeWindowService) protected _window: NativeWindowRef,) { + constructor(private searchService: SearchService, private router: Router) { } @@ -61,11 +60,17 @@ export class CountersSectionComponent implements OnInit { this.counterData$.subscribe(() => this.isLoading$.next(false)); } - goToLink(link: string) { - if (hasValue(link)) { - this._window.nativeWindow.location.href = link; + getLinkQueryParams(link: string): any { + return this.router.parseUrl(link).queryParams || null; + } + + getLinkSegment(link: string): string { + if (hasValue(link) && link.includes('?')) { + return link.split('?')[0]; } + return link; } + }