Merge branch 'main' into collection-thumbnail-embed

This commit is contained in:
Michael Spalti
2022-09-21 10:11:55 -07:00
12 changed files with 78 additions and 27 deletions

View File

@@ -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)

View File

@@ -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);
}

View File

@@ -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,

View File

@@ -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,10 +119,17 @@ 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 {
const sortConfig = new SortOptions('default', SortDirection.ASC);

View File

@@ -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<BrowseByTitlePageComponent>;

View File

@@ -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);
}

View File

@@ -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);
});
});

View File

@@ -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<SubmissionCcLicence> implements FindAllData<SubmissionCcLicence> {
protected linkPath = 'submissioncclicenses';
private findAllData: FindAllData<SubmissionCcLicence>;
constructor(
protected requestService: RequestService,
@@ -27,6 +28,8 @@ export class SubmissionCcLicenseDataService extends BaseDataService<SubmissionCc
protected halService: HALEndpointService,
) {
super('submissioncclicenses', requestService, rdbService, objectCache, halService);
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
}
/**
@@ -44,6 +47,6 @@ export class SubmissionCcLicenseDataService extends BaseDataService<SubmissionCc
* Return an observable that emits object list
*/
public findAll(options?: FindListOptions, useCachedVersionIfAvailable?: boolean, reRequestOnStale?: boolean, ...linksToFollow: FollowLinkConfig<SubmissionCcLicence>[]): Observable<RemoteData<PaginatedList<SubmissionCcLicence>>> {
return undefined;
return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
}
}

View File

@@ -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",

View File

@@ -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;
}

View File

@@ -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 = {

View File

@@ -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