Make no. of communities per pagination / expansion configurable

Adds new config settings for no. of communities to display on the
home page & community-list page.

Resolves #1749, resolves #1750
This commit is contained in:
Mark Cooper
2022-08-30 15:40:43 -07:00
parent 31167a3ce4
commit 3e803e8411
7 changed files with 30 additions and 2 deletions

View File

@@ -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) # The absolute lowest year to display in the dropdown (only used when no lowest date can be found for all items)
defaultLowerLimit: 1900 defaultLowerLimit: 1900
browseCommunities:
communityListPageSize: 20
topLevelPageSize: 5
# Item Config # Item Config
item: item:
edit: edit:

View File

@@ -23,6 +23,7 @@ import { followLink } from '../shared/utils/follow-link-config.model';
import { FlatNode } from './flat-node.model'; import { FlatNode } from './flat-node.model';
import { ShowMoreFlatNode } from './show-more-flat-node.model'; import { ShowMoreFlatNode } from './show-more-flat-node.model';
import { FindListOptions } from '../core/data/find-list-options.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 // Helper method to combine an flatten an array of observables of flatNode arrays
export const combineAndFlatten = (obsList: Observable<FlatNode[]>[]): Observable<FlatNode[]> => export const combineAndFlatten = (obsList: Observable<FlatNode[]>[]): Observable<FlatNode[]> =>
@@ -80,7 +81,7 @@ const communityListStateSelector = (state: AppState) => state.communityList;
const expandedNodesSelector = createSelector(communityListStateSelector, (communityList: CommunityListState) => communityList.expandedNodes); const expandedNodesSelector = createSelector(communityListStateSelector, (communityList: CommunityListState) => communityList.expandedNodes);
const loadingNodeSelector = createSelector(communityListStateSelector, (communityList: CommunityListState) => communityList.loadingNode); 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 * Service class for the community list, responsible for the creating of the flat list used by communityList dataSource

View File

@@ -12,6 +12,7 @@ import { PaginationComponentOptions } from '../../shared/pagination/pagination-c
import { hasValue } from '../../shared/empty.util'; import { hasValue } from '../../shared/empty.util';
import { switchMap } from 'rxjs/operators'; import { switchMap } from 'rxjs/operators';
import { PaginationService } from '../../core/pagination/pagination.service'; import { PaginationService } from '../../core/pagination/pagination.service';
import { environment } from 'src/environments/environment';
/** /**
* this component renders the Top-Level Community list * this component renders the Top-Level Community list
@@ -54,7 +55,7 @@ export class TopLevelCommunityListComponent implements OnInit, OnDestroy {
private paginationService: PaginationService) { private paginationService: PaginationService) {
this.config = new PaginationComponentOptions(); this.config = new PaginationComponentOptions();
this.config.id = this.pageId; this.config.id = this.pageId;
this.config.pageSize = 5; this.config.pageSize = environment.browseCommunities.topLevelPageSize;
this.config.currentPage = 1; this.config.currentPage = 1;
this.sortConfig = new SortOptions('dc.title', SortDirection.ASC); this.sortConfig = new SortOptions('dc.title', SortDirection.ASC);
} }

View File

@@ -31,6 +31,7 @@ interface AppConfig extends Config {
defaultLanguage: string; defaultLanguage: string;
languages: LangConfig[]; languages: LangConfig[];
browseBy: BrowseByConfig; browseBy: BrowseByConfig;
browseCommunities: BrowseCommunitiesConfig;
item: ItemConfig; item: ItemConfig;
collection: CollectionPageConfig; collection: CollectionPageConfig;
themes: ThemeConfig[]; themes: ThemeConfig[];

View File

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

View File

@@ -210,6 +210,11 @@ export class DefaultAppConfig implements AppConfig {
defaultLowerLimit: 1900 defaultLowerLimit: 1900
}; };
browseCommunities: BrowseCommunitiesConfig = {
communityListPageSize: 20,
topLevelPageSize: 5
}
// Item Config // Item Config
item: ItemConfig = { item: ItemConfig = {
edit: { edit: {

View File

@@ -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) // The absolute lowest year to display in the dropdown (only used when no lowest date can be found for all items)
defaultLowerLimit: 1900, defaultLowerLimit: 1900,
}, },
browseCommunities: {
communityListPageSize: 20,
topLevelPageSize: 5
},
item: { item: {
edit: { edit: {
undoTimeout: 10000 // 10 seconds undoTimeout: 10000 // 10 seconds