diff --git a/config/config.example.yml b/config/config.example.yml index fd639b81ae..89902c3fe3 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -176,6 +176,10 @@ browseBy: defaultLowerLimit: 1900 # If true, thumbnail images for items will be added to BOTH search and browse result lists. showThumbnails: true + # The number of entries in a paginated browse results list. + # Rounded to the nearest size in the list of selectable sizes on the + # settings menu. + pageSize: 20 communityList: # No. of communities to list per expansion (show more) diff --git a/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts b/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts index 317b3c45c2..c9ee669e51 100644 --- a/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts +++ b/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts @@ -17,7 +17,7 @@ import { map } from 'rxjs/operators'; import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model'; import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model'; import { isValidDate } from '../../shared/date.util'; -import { APP_CONFIG, AppConfig } from '../../../config/app-config.interface'; +import { AppConfig, APP_CONFIG } from '../../../config/app-config.interface'; @Component({ selector: 'ds-browse-by-date-page', @@ -43,7 +43,7 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent { protected router: Router, protected paginationService: PaginationService, protected cdRef: ChangeDetectorRef, - @Inject(APP_CONFIG) protected appConfig: AppConfig) { + @Inject(APP_CONFIG) public appConfig: AppConfig) { super(route, browseService, dsoService, paginationService, router, appConfig); } diff --git a/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.spec.ts b/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.spec.ts index 1b3d5d0664..2984642b73 100644 --- a/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.spec.ts +++ b/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.spec.ts @@ -48,9 +48,10 @@ describe('BrowseByMetadataPageComponent', () => { ] }); - const environmentUseThumbs = { + const environmentMock = { browseBy: { - showThumbnails: true + showThumbnails: true, + pageSize: 10 } }; @@ -109,7 +110,7 @@ describe('BrowseByMetadataPageComponent', () => { { provide: DSpaceObjectDataService, useValue: mockDsoService }, { provide: PaginationService, useValue: paginationService }, { provide: Router, useValue: new RouterMock() }, - { provide: APP_CONFIG, useValue: environmentUseThumbs } + { provide: APP_CONFIG, useValue: environmentMock } ], schemas: [NO_ERRORS_SCHEMA] }).compileComponents(); @@ -161,7 +162,7 @@ describe('BrowseByMetadataPageComponent', () => { }; const paginationOptions = Object.assign(new PaginationComponentOptions(), { currentPage: 5, - pageSize: 10, + pageSize: comp.appConfig.browseBy.pageSize, }); const sortOptions = { direction: SortDirection.ASC, @@ -192,7 +193,7 @@ describe('BrowseByMetadataPageComponent', () => { }; const paginationOptions = Object.assign(new PaginationComponentOptions(), { currentPage: 5, - pageSize: 10, + pageSize: comp.appConfig.browseBy.pageSize, }); const sortOptions = { direction: SortDirection.ASC, diff --git a/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.ts b/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.ts index 4892493d74..a95aea7c0a 100644 --- a/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.ts +++ b/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.ts @@ -27,9 +27,10 @@ export const BBM_PAGINATION_ID = 'bbm'; templateUrl: './browse-by-metadata-page.component.html' }) /** - * Component for browsing (items) by metadata definition - * A metadata definition (a.k.a. browse id) is a short term used to describe one or multiple metadata fields. - * An example would be 'author' for 'dc.contributor.*' + * Component for browsing (items) by metadata definition. + * A metadata definition (a.k.a. browse id) is a short term used to describe one + * or multiple metadata fields. An example would be 'author' for + * 'dc.contributor.*' */ @rendersBrowseBy(BrowseByDataType.Metadata) export class BrowseByMetadataPageComponent implements OnInit { @@ -52,11 +53,7 @@ export class BrowseByMetadataPageComponent implements OnInit { /** * The pagination config used to display the values */ - paginationConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), { - id: BBM_PAGINATION_ID, - currentPage: 1, - pageSize: 20 - }); + paginationConfig: PaginationComponentOptions; /** * The pagination observable @@ -122,9 +119,16 @@ export class BrowseByMetadataPageComponent implements OnInit { protected dsoService: DSpaceObjectDataService, protected paginationService: PaginationService, protected router: Router, - @Inject(APP_CONFIG) protected appConfig: AppConfig) { + @Inject(APP_CONFIG) public appConfig: AppConfig) { + this.fetchThumbnails = this.appConfig.browseBy.showThumbnails; - } + this.paginationConfig = Object.assign(new PaginationComponentOptions(), { + id: BBM_PAGINATION_ID, + currentPage: 1, + pageSize: this.appConfig.browseBy.pageSize, + }); + } + ngOnInit(): void { diff --git a/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.spec.ts b/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.spec.ts index dcee77a12b..e32c0ac430 100644 --- a/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.spec.ts +++ b/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.spec.ts @@ -23,6 +23,7 @@ import { PaginationServiceStub } from '../../shared/testing/pagination-service.s import { APP_CONFIG } from '../../../config/app-config.interface'; import { environment } from '../../../environments/environment'; + describe('BrowseByTitlePageComponent', () => { let comp: BrowseByTitlePageComponent; let fixture: ComponentFixture; diff --git a/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.ts b/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.ts index b2281efe97..85693ccecd 100644 --- a/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.ts +++ b/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.ts @@ -13,7 +13,7 @@ import { BrowseByDataType, rendersBrowseBy } from '../browse-by-switcher/browse- import { PaginationService } from '../../core/pagination/pagination.service'; import { map } from 'rxjs/operators'; import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model'; -import { APP_CONFIG, AppConfig } from '../../../config/app-config.interface'; +import { AppConfig, APP_CONFIG } from '../../../config/app-config.interface'; @Component({ selector: 'ds-browse-by-title-page', @@ -31,7 +31,7 @@ export class BrowseByTitlePageComponent extends BrowseByMetadataPageComponent { protected dsoService: DSpaceObjectDataService, protected paginationService: PaginationService, protected router: Router, - @Inject(APP_CONFIG) protected appConfig: AppConfig) { + @Inject(APP_CONFIG) public appConfig: AppConfig) { super(route, browseService, dsoService, paginationService, router, appConfig); } diff --git a/src/app/core/submission/submission-cc-license-data.service.spec.ts b/src/app/core/submission/submission-cc-license-data.service.spec.ts new file mode 100644 index 0000000000..b3650bac0a --- /dev/null +++ b/src/app/core/submission/submission-cc-license-data.service.spec.ts @@ -0,0 +1,17 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +import { SubmissionCcLicenseDataService } from './submission-cc-license-data.service'; +import { testFindAllDataImplementation } from '../data/base/find-all-data.spec'; + +describe('SubmissionCcLicenseDataService', () => { + + describe('composition', () => { + const initService = () => new SubmissionCcLicenseDataService(null, null, null, null); + testFindAllDataImplementation(initService); + }); +}); diff --git a/src/app/core/submission/submission-cc-license-data.service.ts b/src/app/core/submission/submission-cc-license-data.service.ts index 976f2acf90..e92de06a6b 100644 --- a/src/app/core/submission/submission-cc-license-data.service.ts +++ b/src/app/core/submission/submission-cc-license-data.service.ts @@ -6,7 +6,7 @@ import { RequestService } from '../data/request.service'; import { SUBMISSION_CC_LICENSE } from './models/submission-cc-licence.resource-type'; import { SubmissionCcLicence } from './models/submission-cc-license.model'; import { BaseDataService } from '../data/base/base-data.service'; -import { FindAllData } from '../data/base/find-all-data'; +import {FindAllData, FindAllDataImpl} from '../data/base/find-all-data'; import { FindListOptions } from '../data/find-list-options.model'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { Observable } from 'rxjs'; @@ -19,6 +19,7 @@ import { dataService } from '../data/base/data-service.decorator'; export class SubmissionCcLicenseDataService extends BaseDataService implements FindAllData { protected linkPath = 'submissioncclicenses'; + private findAllData: FindAllData; constructor( protected requestService: RequestService, @@ -27,6 +28,8 @@ export class SubmissionCcLicenseDataService extends BaseDataService[]): Observable>> { - return undefined; + return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); } } diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index e7f31350be..828740c215 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -1266,6 +1266,7 @@ "cookies.consent.purpose.statistical": "Statistical", + "curation-task.task.citationpage.label": "Generate Citation Page", "curation-task.task.checklinks.label": "Check Links in Metadata", diff --git a/src/config/browse-by-config.interface.ts b/src/config/browse-by-config.interface.ts index b029482edc..e82edacfdd 100644 --- a/src/config/browse-by-config.interface.ts +++ b/src/config/browse-by-config.interface.ts @@ -1,21 +1,25 @@ import { Config } from './config.interface'; /** - * Config that determines how the dropdown list of years are created for browse-by-date components + * Config that determines how the dropdown list of years are created for + * browse-by-date components. */ export interface BrowseByConfig extends Config { /** - * The max amount of years to display using jumps of one year (current year - oneYearLimit) + * The max amount of years to display using jumps of one year + * (current year - oneYearLimit) */ oneYearLimit: number; /** - * Limit for years to display using jumps of five years (current year - fiveYearLimit) + * Limit for years to display using jumps of five years + * (current year - fiveYearLimit) */ fiveYearLimit: number; /** - * The absolute lowest year to display in the dropdown when no lowest date can be found for all items + * The absolute lowest year to display in the dropdown when no lowest date can + * be found for all items. */ defaultLowerLimit: number; @@ -23,4 +27,12 @@ export interface BrowseByConfig extends Config { * If true, thumbnail images for items will be added to BOTH search and browse result lists. */ showThumbnails: boolean; + + /** + * Number of entries in the viewport of a paginated browse-by list. + * Rounded to the nearest size in the list of selectable sizes on the settings + * menu. See pageSizeOptions in 'pagination-component-options.model.ts'. + */ + pageSize: number; + } diff --git a/src/config/default-app-config.ts b/src/config/default-app-config.ts index 7250bb1489..c2c0b308e7 100644 --- a/src/config/default-app-config.ts +++ b/src/config/default-app-config.ts @@ -211,7 +211,11 @@ export class DefaultAppConfig implements AppConfig { // The absolute lowest year to display in the dropdown (only used when no lowest date can be found for all items) defaultLowerLimit: 1900, // Whether to add item thumbnail images to BOTH browse and search result lists. - showThumbnails: true + showThumbnails: true, + // The number of entries in a paginated browse results list. + // Rounded to the nearest size in the list of selectable sizes on the + // settings menu. See pageSizeOptions in 'pagination-component-options.model.ts'. + pageSize: 20 }; communityList: CommunityListConfig = { diff --git a/src/environments/environment.test.ts b/src/environments/environment.test.ts index 0e08f849aa..edbf33b79c 100644 --- a/src/environments/environment.test.ts +++ b/src/environments/environment.test.ts @@ -204,7 +204,11 @@ export const environment: BuildConfig = { // The absolute lowest year to display in the dropdown (only used when no lowest date can be found for all items) defaultLowerLimit: 1900, // Whether to add item thumbnail images to BOTH browse and search result lists. - showThumbnails: true + showThumbnails: true, + // The number of entries in a paginated browse results list. + // Rounded to the nearest size in the list of selectable sizes on the + // settings menu. See pageSizeOptions in 'pagination-component-options.model.ts'. + pageSize: 20, }, communityList: { pageSize: 20