diff --git a/src/app/admin/admin-notifications/admin-quality-assurance-source-page-component/admin-quality-assurance-source-data.resolver.ts b/src/app/admin/admin-notifications/admin-quality-assurance-source-page-component/admin-quality-assurance-source-data.resolver.ts index 6201e0a7435..261ef95b88d 100644 --- a/src/app/admin/admin-notifications/admin-quality-assurance-source-page-component/admin-quality-assurance-source-data.resolver.ts +++ b/src/app/admin/admin-notifications/admin-quality-assurance-source-page-component/admin-quality-assurance-source-data.resolver.ts @@ -5,11 +5,14 @@ import { map } from 'rxjs/operators'; import { PaginatedList } from '../../../core/data/paginated-list.model'; import { QualityAssuranceSourceObject } from '../../../core/notifications/qa/models/quality-assurance-source.model'; import { QualityAssuranceSourceService } from '../../../notifications/qa/source/quality-assurance-source.service'; +import {environment} from '../../../../environments/environment'; /** * This class represents a resolver that retrieve the route data before the route is activated. */ @Injectable() export class SourceDataResolver implements Resolve> { + private paginationStart = environment.qualityAssuranceConfig.defaultPaginationStart; + private paginationItemsCount = environment.qualityAssuranceConfig.defaultPaginationItemsCount; /** * Initialize the effect class variables. * @param {QualityAssuranceSourceService} qualityAssuranceSourceService @@ -25,7 +28,7 @@ export class SourceDataResolver implements Resolve */ resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable { - return this.qualityAssuranceSourceService.getSources(5,0).pipe( + return this.qualityAssuranceSourceService.getSources(this.paginationItemsCount,this.paginationStart).pipe( map((sources: PaginatedList) => { if (sources.page.length === 1) { this.router.navigate([this.getResolvedUrl(route) + '/' + sources.page[0].id]); diff --git a/src/app/notifications/qa/events/quality-assurance-events.component.ts b/src/app/notifications/qa/events/quality-assurance-events.component.ts index a0e328538e1..2594df46688 100644 --- a/src/app/notifications/qa/events/quality-assurance-events.component.ts +++ b/src/app/notifications/qa/events/quality-assurance-events.component.ts @@ -30,6 +30,7 @@ import { getFirstCompletedRemoteData } from '../../../core/shared/operators'; import { PaginationService } from '../../../core/pagination/pagination.service'; import { Item } from '../../../core/shared/item.model'; import { FindListOptions } from '../../../core/data/find-list-options.model'; +import {environment} from '../../../../environments/environment'; /** * Component to display the Quality Assurance event list. @@ -98,7 +99,7 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy { /** * The Open Aire base url for project search */ - public openAireUrl = 'https://explore.openaire.eu/search/project?projectId='; + public openAireUrl = environment.qualityAssuranceConfig.openAireUrl; /** * The FindListOptions object */ diff --git a/src/config/app-config.interface.ts b/src/config/app-config.interface.ts index 84a30549a72..cd8926f1c13 100644 --- a/src/config/app-config.interface.ts +++ b/src/config/app-config.interface.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 {QualityAssuranceConfig} from './quality-assurance.config'; interface AppConfig extends Config { ui: UIServerConfig; @@ -48,6 +49,7 @@ interface AppConfig extends Config { markdown: MarkdownConfig; vocabularies: FilterVocabularyConfig[]; comcolSelectionSort: DiscoverySortConfig; + qualityAssuranceConfig: QualityAssuranceConfig; } /** diff --git a/src/config/default-app-config.ts b/src/config/default-app-config.ts index a6e9e092e46..094bd9080a3 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 {QualityAssuranceConfig} from './quality-assurance.config'; export class DefaultAppConfig implements AppConfig { production = false; @@ -432,4 +433,10 @@ export class DefaultAppConfig implements AppConfig { sortField:'dc.title', sortDirection:'ASC', }; + + qualityAssuranceConfig: QualityAssuranceConfig = { + openAireUrl: 'https://explore.openaire.eu/search/project?projectId=', + defaultPaginationItemsCount: 5, + defaultPaginationStart: 0 + }; } diff --git a/src/config/quality-assurance.config.ts b/src/config/quality-assurance.config.ts new file mode 100644 index 00000000000..46e11fbdd51 --- /dev/null +++ b/src/config/quality-assurance.config.ts @@ -0,0 +1,21 @@ +import { Config } from './config.interface'; + +/** + * Config that determines a metadata sorting config. + * It's created mainly to sort by metadata community and collection edition and creation + */ +export class QualityAssuranceConfig implements Config { + + /** + * Url for OAIRE resources + */ + public openAireUrl: string; + /** + * default count of QA sources to load + */ + public defaultPaginationItemsCount: number; + /** + * default starting point of pagination + */ + public defaultPaginationStart: number; +} diff --git a/src/environments/environment.test.ts b/src/environments/environment.test.ts index cb9d2c71303..dd1dbf58c13 100644 --- a/src/environments/environment.test.ts +++ b/src/environments/environment.test.ts @@ -306,6 +306,11 @@ export const environment: BuildConfig = { sortField:'dc.title', sortDirection:'ASC', }, + qualityAssuranceConfig: { + openAireUrl: 'https://explore.openaire.eu/search/project?projectId=', + defaultPaginationItemsCount: 5, + defaultPaginationStart: 0 + }, vocabularies: [ {