Skip to content

Commit

Permalink
refactor config QA
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescoMolinaro committed Dec 14, 2023
1 parent 7fe81ec commit f2be578
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import {environment} from '../../../../environments/environment';
*/
@Injectable()
export class SourceDataResolver implements Resolve<Observable<QualityAssuranceSourceObject[]>> {
private paginationStart = environment.qualityAssuranceConfig.defaultPaginationStart;
private paginationItemsCount = environment.qualityAssuranceConfig.defaultPaginationItemsCount;
private pageSize = environment.qualityAssuranceConfig.pageSize;
/**
* Initialize the effect class variables.
* @param {QualityAssuranceSourceService} qualityAssuranceSourceService
Expand All @@ -28,7 +27,7 @@ export class SourceDataResolver implements Resolve<Observable<QualityAssuranceSo
* @returns Observable<QualityAssuranceSourceObject[]>
*/
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<QualityAssuranceSourceObject[]> {
return this.qualityAssuranceSourceService.getSources(this.paginationItemsCount,this.paginationStart).pipe(
return this.qualityAssuranceSourceService.getSources(this.pageSize, 0).pipe(
map((sources: PaginatedList<QualityAssuranceSourceObject>) => {
if (sources.page.length === 1) {
this.router.navigate([this.getResolvedUrl(route) + '/' + sources.page[0].id]);
Expand Down
3 changes: 1 addition & 2 deletions src/config/default-app-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,6 @@ export class DefaultAppConfig implements AppConfig {

qualityAssuranceConfig: QualityAssuranceConfig = {
openAireUrl: 'https://explore.openaire.eu/search/project?projectId=',
defaultPaginationItemsCount: 5,
defaultPaginationStart: 0
pageSize: 5,
};
}
6 changes: 1 addition & 5 deletions src/config/quality-assurance.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,5 @@ export class QualityAssuranceConfig implements Config {
/**
* default count of QA sources to load
*/
public defaultPaginationItemsCount: number;
/**
* default starting point of pagination
*/
public defaultPaginationStart: number;
public pageSize: number;
}
3 changes: 1 addition & 2 deletions src/environments/environment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,7 @@ export const environment: BuildConfig = {
},
qualityAssuranceConfig: {
openAireUrl: 'https://explore.openaire.eu/search/project?projectId=',
defaultPaginationItemsCount: 5,
defaultPaginationStart: 0
pageSize: 5,
},

vocabularies: [
Expand Down

0 comments on commit f2be578

Please sign in to comment.