import {Component, Input, SimpleChanges} from '@angular/core'; import {EnvProperties} from "../../properties/env-properties"; import {ErrorCodes} from "../../properties/errorCodes"; import {OpenaireEntities} from "../../properties/searchFields"; import {StringUtils} from "../../string-utils.class"; @Component({ selector: 'search-tab', template: `
Recent {{getEntityName(resultType)}} {{customTitle}}
View all in search page View all in OpenAIRE
` }) export class SearchTabComponent { @Input() public isMobile: boolean = false; @Input() prevPath: string = ""; @Input() public fetch; @Input() public resultType: string; @Input() public params: any; @Input() public searchNumber: number = 5; @Input() public searchLinkToAdvancedPage: string; @Input() properties: EnvProperties; @Input() customTitle; @Input() showEnermaps: boolean; public errorCodes: ErrorCodes = new ErrorCodes(); public getEntityName(entityType: string): string { return StringUtils.getEntityName(entityType, true); } get paramsForExternalUrl() { let parameters: string = ""; Object.keys(this.params).forEach(paramKey => { parameters += (parameters ? "&" : "?") + paramKey+"="+this.params[paramKey]; }) return parameters; } }