diff --git a/config/config.example.yml b/config/config.example.yml index ea38303fa3..7f18ccc5da 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -75,7 +75,7 @@ cache: anonymousCache: # Maximum number of pages to cache. Default is zero (0) which means anonymous user cache is disabled. # As all pages are cached in server memory, increasing this value will increase memory needs. - # Individual cached pages are usually small (<100KB), so a value of max=1000 would only require ~100MB of memory. + # Individual cached pages are usually small (<100KB), so a value of max=1000 would only require ~100MB of memory. max: 0 # Amount of time after which cached pages are considered stale (in ms). After becoming stale, the cached # copy is automatically refreshed on the next request. @@ -279,8 +279,17 @@ item: # settings menu. See pageSizeOptions in 'pagination-component-options.model.ts'. pageSize: 5 +# Community Page Config +community: + # Search tab config + searchSection: + showSidebar: true + # Collection Page Config collection: + # Search tab config + searchSection: + showSidebar: true edit: undoTimeout: 10000 # 10 seconds @@ -376,7 +385,7 @@ vocabularies: vocabulary: 'srsc' enabled: true -# Default collection/community sorting order at Advanced search, Create/update community and collection when there are not a query. +# Default collection/community sorting order at Advanced search, Create/update community and collection when there are not a query. comcolSelectionSort: sortField: 'dc.title' - sortDirection: 'ASC' \ No newline at end of file + sortDirection: 'ASC' diff --git a/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.html b/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.html index 9922857eee..348d50dfb6 100644 --- a/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.html +++ b/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.html @@ -1,4 +1,5 @@ diff --git a/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.spec.ts b/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.spec.ts index 53406c2cfc..6b1f9236b1 100644 --- a/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.spec.ts +++ b/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.spec.ts @@ -2,6 +2,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComcolSearchSectionComponent } from './comcol-search-section.component'; import { ActivatedRoute } from '@angular/router'; import { ActivatedRouteStub } from '../../../testing/active-router.stub'; +import { APP_CONFIG } from '../../../../../config/app-config.interface'; +import { environment } from '../../../../../environments/environment.test'; describe('ComcolSearchSectionComponent', () => { let component: ComcolSearchSectionComponent; @@ -17,6 +19,7 @@ describe('ComcolSearchSectionComponent', () => { ComcolSearchSectionComponent, ], providers: [ + { provide: APP_CONFIG, useValue: environment }, { provide: ActivatedRoute, useValue: route }, ], }).compileComponents(); diff --git a/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.ts b/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.ts index 297b8ab2c5..fe50147395 100644 --- a/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.ts +++ b/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Inject } from '@angular/core'; import { Observable } from 'rxjs'; import { ActivatedRoute, Data } from '@angular/router'; import { map } from 'rxjs/operators'; @@ -7,7 +7,12 @@ import { SearchConfigurationService } from '../../../../core/shared/search/searc import { RemoteData } from '../../../../core/data/remote-data'; import { Community } from '../../../../core/shared/community.model'; import { Collection } from '../../../../core/shared/collection.model'; +import { APP_CONFIG, AppConfig } from '../../../../../config/app-config.interface'; +import { hasValue } from '../../../empty.util'; +/** + * The search tab on community & collection pages + */ @Component({ selector: 'ds-comcol-search-section', templateUrl: './comcol-search-section.component.html', @@ -23,7 +28,10 @@ export class ComcolSearchSectionComponent implements OnInit { comcol$: Observable; + showSidebar$: Observable; + constructor( + @Inject(APP_CONFIG) public appConfig: AppConfig, protected route: ActivatedRoute, ) { } @@ -32,6 +40,9 @@ export class ComcolSearchSectionComponent implements OnInit { this.comcol$ = this.route.data.pipe( map((data: Data) => (data.dso as RemoteData).payload), ); + this.showSidebar$ = this.comcol$.pipe( + map((comcol: Community | Collection) => hasValue(comcol) && this.appConfig[comcol.type as any].searchSection.showSidebar), + ); } } diff --git a/src/config/app-config.interface.ts b/src/config/app-config.interface.ts index 84a30549a7..2a0c9445b8 100644 --- a/src/config/app-config.interface.ts +++ b/src/config/app-config.interface.ts @@ -8,6 +8,7 @@ import { SubmissionConfig } from './submission-config.interface'; import { FormConfig } from './form-config.interfaces'; import { LangConfig } from './lang-config.interface'; import { ItemConfig } from './item-config.interface'; +import { CommunityPageConfig } from './community-page-config.interface'; import { CollectionPageConfig } from './collection-page-config.interface'; import { ThemeConfig } from './theme.model'; import { AuthConfig } from './auth-config.interfaces'; @@ -39,6 +40,7 @@ interface AppConfig extends Config { communityList: CommunityListConfig; homePage: HomeConfig; item: ItemConfig; + community: CommunityPageConfig; collection: CollectionPageConfig; themes: ThemeConfig[]; mediaViewer: MediaViewerConfig; diff --git a/src/config/collection-page-config.interface.ts b/src/config/collection-page-config.interface.ts index c056df66ed..6b8352e686 100644 --- a/src/config/collection-page-config.interface.ts +++ b/src/config/collection-page-config.interface.ts @@ -1,7 +1,18 @@ import { Config } from './config.interface'; +/** + * Collection Page Config + */ export interface CollectionPageConfig extends Config { + searchSection: CollectionSearchSectionConfig; edit: { undoTimeout: number; }; } + +/** + * Config related to the collection's search tab + */ +export interface CollectionSearchSectionConfig { + showSidebar: boolean; +} diff --git a/src/config/community-page-config.interface.ts b/src/config/community-page-config.interface.ts new file mode 100644 index 0000000000..268f4d6a5e --- /dev/null +++ b/src/config/community-page-config.interface.ts @@ -0,0 +1,15 @@ +import { Config } from './config.interface'; + +/** + * Community Page Config + */ +export interface CommunityPageConfig extends Config { + searchSection: CommunitySearchSectionConfig; +} + +/** + * Config related to the community's search tab + */ +export interface CommunitySearchSectionConfig { + showSidebar: boolean; +} diff --git a/src/config/default-app-config.ts b/src/config/default-app-config.ts index a6e9e092e4..e7b79a7b73 100644 --- a/src/config/default-app-config.ts +++ b/src/config/default-app-config.ts @@ -22,6 +22,7 @@ import { HomeConfig } from './homepage-config.interface'; import { MarkdownConfig } from './markdown-config.interface'; import { FilterVocabularyConfig } from './filter-vocabulary-config'; import { DiscoverySortConfig } from './discovery-sort.config'; +import { CommunityPageConfig } from './community-page-config.interface'; export class DefaultAppConfig implements AppConfig { production = false; @@ -287,8 +288,18 @@ export class DefaultAppConfig implements AppConfig { } }; + // Community Page Config + community: CommunityPageConfig = { + searchSection: { + showSidebar: true, + }, + }; + // Collection Page Config collection: CollectionPageConfig = { + searchSection: { + showSidebar: true, + }, edit: { undoTimeout: 10000 // 10 seconds } diff --git a/src/environments/environment.test.ts b/src/environments/environment.test.ts index cb9d2c7130..0793104afa 100644 --- a/src/environments/environment.test.ts +++ b/src/environments/environment.test.ts @@ -257,7 +257,15 @@ export const environment: BuildConfig = { pageSize: 5 } }, + community: { + searchSection: { + showSidebar: true, + }, + }, collection: { + searchSection: { + showSidebar: true, + }, edit: { undoTimeout: 10000 // 10 seconds }