diff --git a/config/config.example.yml b/config/config.example.yml index 83ca64819a..19129f93ee 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -175,6 +175,10 @@ browseBy: # The absolute lowest year to display in the dropdown (only used when no lowest date can be found for all items) defaultLowerLimit: 1900 +browseCommunities: + communityListPageSize: 20 + topLevelPageSize: 5 + # Item Config item: edit: diff --git a/src/app/community-list-page/community-list-service.ts b/src/app/community-list-page/community-list-service.ts index 89b68812ae..07080d712f 100644 --- a/src/app/community-list-page/community-list-service.ts +++ b/src/app/community-list-page/community-list-service.ts @@ -23,6 +23,7 @@ import { followLink } from '../shared/utils/follow-link-config.model'; import { FlatNode } from './flat-node.model'; import { ShowMoreFlatNode } from './show-more-flat-node.model'; import { FindListOptions } from '../core/data/find-list-options.model'; +import { environment } from 'src/environments/environment'; // Helper method to combine an flatten an array of observables of flatNode arrays export const combineAndFlatten = (obsList: Observable[]): Observable => @@ -80,7 +81,7 @@ const communityListStateSelector = (state: AppState) => state.communityList; const expandedNodesSelector = createSelector(communityListStateSelector, (communityList: CommunityListState) => communityList.expandedNodes); const loadingNodeSelector = createSelector(communityListStateSelector, (communityList: CommunityListState) => communityList.loadingNode); -export const MAX_COMCOLS_PER_PAGE = 20; +export const MAX_COMCOLS_PER_PAGE = environment.browseCommunities.communityListPageSize; /** * Service class for the community list, responsible for the creating of the flat list used by communityList dataSource diff --git a/src/app/home-page/top-level-community-list/top-level-community-list.component.ts b/src/app/home-page/top-level-community-list/top-level-community-list.component.ts index 5f6306649f..662e9361de 100644 --- a/src/app/home-page/top-level-community-list/top-level-community-list.component.ts +++ b/src/app/home-page/top-level-community-list/top-level-community-list.component.ts @@ -12,6 +12,7 @@ import { PaginationComponentOptions } from '../../shared/pagination/pagination-c import { hasValue } from '../../shared/empty.util'; import { switchMap } from 'rxjs/operators'; import { PaginationService } from '../../core/pagination/pagination.service'; +import { environment } from 'src/environments/environment'; /** * this component renders the Top-Level Community list @@ -54,7 +55,7 @@ export class TopLevelCommunityListComponent implements OnInit, OnDestroy { private paginationService: PaginationService) { this.config = new PaginationComponentOptions(); this.config.id = this.pageId; - this.config.pageSize = 5; + this.config.pageSize = environment.browseCommunities.topLevelPageSize; this.config.currentPage = 1; this.sortConfig = new SortOptions('dc.title', SortDirection.ASC); } diff --git a/src/config/app-config.interface.ts b/src/config/app-config.interface.ts index 6bca828a91..5794fe3ac1 100644 --- a/src/config/app-config.interface.ts +++ b/src/config/app-config.interface.ts @@ -31,6 +31,7 @@ interface AppConfig extends Config { defaultLanguage: string; languages: LangConfig[]; browseBy: BrowseByConfig; + browseCommunities: BrowseCommunitiesConfig; item: ItemConfig; collection: CollectionPageConfig; themes: ThemeConfig[]; diff --git a/src/config/browse-communities-config.interface.ts b/src/config/browse-communities-config.interface.ts new file mode 100644 index 0000000000..201a8235e0 --- /dev/null +++ b/src/config/browse-communities-config.interface.ts @@ -0,0 +1,12 @@ +import { Config } from './config.interface'; + +export interface BrowseCommunitiesConfig extends Config { + /** + * Number of entries in the expandable community list (per show more). + */ + communityListPageSize: number; + /** + * Number of entries in the paginated (home page) top level community list. + */ + topLevelPageSize: number; +} diff --git a/src/config/default-app-config.ts b/src/config/default-app-config.ts index 5eb4a4ee6b..81bb1b1ab5 100644 --- a/src/config/default-app-config.ts +++ b/src/config/default-app-config.ts @@ -210,6 +210,11 @@ export class DefaultAppConfig implements AppConfig { defaultLowerLimit: 1900 }; + browseCommunities: BrowseCommunitiesConfig = { + communityListPageSize: 20, + topLevelPageSize: 5 + } + // Item Config item: ItemConfig = { edit: { diff --git a/src/environments/environment.test.ts b/src/environments/environment.test.ts index 6d4545f21b..a0b382ec7c 100644 --- a/src/environments/environment.test.ts +++ b/src/environments/environment.test.ts @@ -204,6 +204,10 @@ 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, }, + browseCommunities: { + communityListPageSize: 20, + topLevelPageSize: 5 + }, item: { edit: { undoTimeout: 10000 // 10 seconds