import {Component, Input} from '@angular/core'; import {EnvProperties} from "../../properties/env-properties"; import {ErrorCodes} from "../../properties/errorCodes"; import {OpenaireEntities} from "../../properties/searchFields"; @Component({ selector: 'search-tab', template: ` Recent {{getEntityName(resultType)}} {{customTitle}} View all in search page ` }) export class SearchTabComponent { @Input() public fetch; @Input() public resultType: string; @Input() public params: any; @Input() public searchNumber: number = 5; @Input() public searchLinkToAdvancedPage: string; @Input() properties: EnvProperties; @Input() showImpactFactors; @Input() customTitle; @Input() showEnermaps: boolean; public errorCodes: ErrorCodes = new ErrorCodes(); public getEntityName(entityType: string): string { if (entityType == "publication") { return OpenaireEntities.PUBLICATIONS; } else if (entityType == "dataset") { return OpenaireEntities.DATASETS; } else if (entityType == "software") { return OpenaireEntities.SOFTWARE; } else if (entityType == "other") { return OpenaireEntities.OTHER; } else if (entityType == "result") { return OpenaireEntities.RESULTS; } else if (entityType == "project") { return OpenaireEntities.PROJECTS; } else if (entityType == "dataprovider") { return OpenaireEntities.DATASOURCES; } else if (this.resultType) { return this.resultType; } } }