From 6bd188cecf1498ce6080d142979676b8e6a27c6b Mon Sep 17 00:00:00 2001 From: Andrea Barbasso <´andrea.barbasso@4science.com´> Date: Tue, 11 Jun 2024 08:44:06 +0200 Subject: [PATCH] [DSC-1747] restore thumbnails in search pages --- .../search-page/configuration-search-page.component.ts | 6 ++++-- src/app/shared/search/search.component.spec.ts | 6 ++++++ src/app/shared/search/search.component.ts | 8 ++++++-- src/app/shared/search/themed-search.component.ts | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/app/search-page/configuration-search-page.component.ts b/src/app/search-page/configuration-search-page.component.ts index 7c8f76e6487..bb558b1f14d 100644 --- a/src/app/search-page/configuration-search-page.component.ts +++ b/src/app/search-page/configuration-search-page.component.ts @@ -9,6 +9,7 @@ import { RouteService } from '../core/services/route.service'; import { SearchService } from '../core/shared/search/search.service'; import { Router } from '@angular/router'; import { SearchManager } from '../core/browse/search-manager'; +import { APP_CONFIG, AppConfig } from '../../config/app-config.interface'; /** * This component renders a search page using a configuration as input. @@ -35,7 +36,8 @@ export class ConfigurationSearchPageComponent extends SearchComponent { @Inject(PLATFORM_ID) public platformId: any, @Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService, protected routeService: RouteService, - protected router: Router) { - super(service, searchManager, sidebarService, windowService, searchConfigService, platformId, routeService, router); + protected router: Router, + @Inject(APP_CONFIG) protected appConfig: AppConfig,) { + super(service, searchManager, sidebarService, windowService, searchConfigService, platformId, routeService, router, appConfig); } } diff --git a/src/app/shared/search/search.component.spec.ts b/src/app/shared/search/search.component.spec.ts index 01f6f1c1884..6e7de413551 100644 --- a/src/app/shared/search/search.component.spec.ts +++ b/src/app/shared/search/search.component.spec.ts @@ -34,6 +34,8 @@ import { SearchFilterConfig } from './models/search-filter-config.model'; import { FilterType } from './models/filter-type.model'; import { getCommunityPageRoute } from '../../community-page/community-page-routing-paths'; import { getCollectionPageRoute } from '../../collection-page/collection-page-routing-paths'; +import { APP_CONFIG } from '../../../config/app-config.interface'; +import { environment } from '../../../environments/environment'; let comp: SearchComponent; let fixture: ComponentFixture; @@ -239,6 +241,10 @@ export function configureSearchComponentTestingModule(compType, additionalDeclar { provide: SEARCH_CONFIG_SERVICE, useValue: searchConfigurationServiceStub + }, + { + provide: APP_CONFIG, + useValue: environment } ], schemas: [NO_ERRORS_SCHEMA] diff --git a/src/app/shared/search/search.component.ts b/src/app/shared/search/search.component.ts index 158324b0b92..b7c3bbd473c 100644 --- a/src/app/shared/search/search.component.ts +++ b/src/app/shared/search/search.component.ts @@ -51,6 +51,7 @@ import { COMMUNITY_MODULE_PATH } from '../../community-page/community-page-routi import { SearchManager } from '../../core/browse/search-manager'; import { AlertType } from '../alert/alert-type'; import { isPlatformServer } from '@angular/common'; +import { APP_CONFIG } from '../../../config/app-config.interface'; @Component({ selector: 'ds-search', @@ -187,7 +188,7 @@ export class SearchComponent implements OnInit, OnDestroy { /** * Whether to show the thumbnail preview */ - @Input() showThumbnails; + @Input() showThumbnails: boolean; /** * Whether to show the view mode switch @@ -368,7 +369,8 @@ export class SearchComponent implements OnInit, OnDestroy { @Inject(PLATFORM_ID) public platformId: any, @Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService, protected routeService: RouteService, - protected router: Router,) { + protected router: Router, + @Inject(APP_CONFIG) protected appConfig: any,){ this.isXsOrSm$ = this.windowService.isXsOrSm(); } @@ -385,6 +387,8 @@ export class SearchComponent implements OnInit, OnDestroy { return; } + this.showThumbnails = this.showThumbnails ?? this.appConfig.browseBy.showThumbnails; + if (this.useUniquePageId) { // Create an unique pagination id related to the instance of the SearchComponent this.paginationId = uniqueId(this.paginationId); diff --git a/src/app/shared/search/themed-search.component.ts b/src/app/shared/search/themed-search.component.ts index 710bcc1071a..0463ed62aa2 100644 --- a/src/app/shared/search/themed-search.component.ts +++ b/src/app/shared/search/themed-search.component.ts @@ -68,7 +68,7 @@ export class ThemedSearchComponent extends ThemedComponent { @Input() showSidebar: boolean; - @Input() showThumbnails; + @Input() showThumbnails: boolean; @Input() showViewModes: boolean;