import {Component, Input} from '@angular/core'; import { FetchPublications } from '../../utils/fetchEntitiesClasses/fetchPublications.class'; import { FetchDatasets } from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; import { FetchSoftware } from '../../utils/fetchEntitiesClasses/fetchSoftware.class'; import { FetchOrps } from '../../utils/fetchEntitiesClasses/fetchOrps.class'; import { ErrorCodes} from '../../utils/properties/errorCodes'; import {RouterHelper} from '../../utils/routerHelper.class'; import { Observable } from 'rxjs/Observable'; import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'relatedDatasourcesTab', template: `
{{results.size | number}} related content providers, page {{page | number}} of {{totalPages(results.size) | number}}
Content Provider Name Number of Publications Number of Research Data Number of Software Number of Other Research Products
{{results.get(id).name}} {{results.get(id).countPublications | number}} - {{results.get(id).countDatasets | number}} - {{results.get(id).countSoftware | number}} - {{results.get(id).countOrps | number}} -
` }) export class RelatedDatasourcesTabComponent { @Input() dataproviderId: string; @Input() fetchPublications : FetchPublications; @Input() fetchDatasets : FetchDatasets; @Input() fetchSoftware : FetchSoftware; @Input() fetchOrps: FetchOrps; // true: preprocessing is not over @Input() loading: boolean = true; // Εvery content provider's id is a single key of a map @Input() results: Map; @Input() properties:EnvProperties ; public linkToSearchPublications: string = ""; public linkToSearchResearchData: string = ""; public linkToSearchSoftware: string = ""; public linkToSearchOrps: string = ""; public routerHelper:RouterHelper = new RouterHelper(); public errorCodes:ErrorCodes = new ErrorCodes(); public page: number = 1; public pageSize: number = 10; constructor () {} ngOnInit() { this.linkToSearchPublications = this.properties.searchLinkToAdvancedPublications; this.linkToSearchResearchData = this.properties.searchLinkToAdvancedDatasets; this.linkToSearchSoftware = this.properties.searchLinkToAdvancedSoftware; this.linkToSearchOrps = this.properties.searchLinkToAdvancedOrps; } ngOnDestroy() {} totalPages(totalResults: number): number { let totalPages:any = totalResults/this.pageSize; if(!(Number.isInteger(totalPages))) { totalPages = (parseInt(totalPages, this.pageSize) + 1); } return totalPages; } updatePage($event) { this.page = $event.value; } public getKeys( map) { return Array.from(map.keys()); } }