Skip to content

Commit

Permalink
add quality assurance configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescoMolinaro committed Dec 13, 2023
1 parent 922172d commit 7fe81ec
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Observable<QualityAssuranceSourceObject[]>> {
private paginationStart = environment.qualityAssuranceConfig.defaultPaginationStart;
private paginationItemsCount = environment.qualityAssuranceConfig.defaultPaginationItemsCount;
/**
* Initialize the effect class variables.
* @param {QualityAssuranceSourceService} qualityAssuranceSourceService
Expand All @@ -25,7 +28,7 @@ export class SourceDataResolver implements Resolve<Observable<QualityAssuranceSo
* @returns Observable<QualityAssuranceSourceObject[]>
*/
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<QualityAssuranceSourceObject[]> {
return this.qualityAssuranceSourceService.getSources(5,0).pipe(
return this.qualityAssuranceSourceService.getSources(this.paginationItemsCount,this.paginationStart).pipe(
map((sources: PaginatedList<QualityAssuranceSourceObject>) => {
if (sources.page.length === 1) {
this.router.navigate([this.getResolvedUrl(route) + '/' + sources.page[0].id]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
*/
Expand Down
2 changes: 2 additions & 0 deletions src/config/app-config.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -48,6 +49,7 @@ interface AppConfig extends Config {
markdown: MarkdownConfig;
vocabularies: FilterVocabularyConfig[];
comcolSelectionSort: DiscoverySortConfig;
qualityAssuranceConfig: QualityAssuranceConfig;
}

/**
Expand Down
7 changes: 7 additions & 0 deletions src/config/default-app-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
};
}
21 changes: 21 additions & 0 deletions src/config/quality-assurance.config.ts
Original file line number Diff line number Diff line change
@@ -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;
}
5 changes: 5 additions & 0 deletions src/environments/environment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down

0 comments on commit 7fe81ec

Please sign in to comment.