54 lines
2.1 KiB
TypeScript
54 lines
2.1 KiB
TypeScript
import {Component, Input} from '@angular/core';
|
|
import {EnvProperties} from '../../../utils/properties/env-properties';
|
|
import {ClaimDBContext, ClaimDBProject, ClaimDBResult} from "../claimHelper.class";
|
|
import {OpenaireEntities} from "../../../utils/properties/searchFields";
|
|
import {StringUtils} from "../../../utils/string-utils.class";
|
|
|
|
//Usage Example "<claim-entity [entity]="" [type]="" > </claim-entity>"
|
|
|
|
//externalUrl
|
|
@Component({
|
|
selector: 'claim-entity',
|
|
template: `
|
|
<div *ngIf="type == 'publication' || type == 'dataset' || type == 'software' || type == 'other'"
|
|
[attr.uk-tooptip]="getEntityName(type)">
|
|
<div *ngIf="source" class="uk-text-small">
|
|
{{getEntityName(type)}}
|
|
</div>
|
|
<div class="uk-flex">
|
|
<span *ngIf="!source" class="uk-text-meta uk-margin-small-right uk-text-large uk-text-nowrap">Link to:</span>
|
|
<publication-title [entity]="entity" param="id"
|
|
path="/search/result" [externalPortalUrl]=externalPortalUrl></publication-title>
|
|
</div>
|
|
</div>
|
|
<div *ngIf="type == 'project'" [attr.uk-tooptip]="getEntityName(type)"
|
|
class="uk-flex">
|
|
<span class="uk-text-meta uk-margin-small-right uk-text-large uk-text-nowrap">Link to:</span>
|
|
<project-title [project]="entity" [searchLink]=properties.searchLinkToProject
|
|
[externalPortalUrl]=externalPortalUrl></project-title>
|
|
</div>
|
|
<div *ngIf="type == 'context'" class="uk-flex uk-text-large">
|
|
<span class="uk-text-meta uk-margin-small-right uk-text-nowrap">Link to:</span>
|
|
<span class="uk-text-truncate" uk-tooltip="Concept">{{entity.title}}</span>
|
|
</div>
|
|
`
|
|
})
|
|
|
|
export class ClaimEntityFormatter {
|
|
@Input() entity: ClaimDBResult | ClaimDBContext | ClaimDBProject;
|
|
@Input() type: string;
|
|
@Input() properties: EnvProperties;
|
|
@Input() externalPortalUrl: string = null;
|
|
@Input() source: boolean = true;
|
|
public openAIREEntities = OpenaireEntities;
|
|
|
|
constructor() {
|
|
}
|
|
|
|
public getEntityName(entityType:string) {
|
|
return StringUtils.getEntityName(entityType);
|
|
}
|
|
|
|
}
|
|
|