openaire-library/landingPages/dataProvider/publicationsTab.component.ts

54 lines
2.7 KiB
TypeScript

import {Component, Input} from '@angular/core';
import { FetchPublications } from '../../utils/fetchEntitiesClasses/fetchPublications.class';
import {ErrorCodes} from '../../utils/properties/openaireProperties';
import{EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'publicationsTab',
template: `
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No publications available</div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<!--errorMessages [status]="[fetchPublications.searchUtils.status]" [type]="'publications'"></errorMessages>
{{fetchPublications.searchUtils.status}}-->
<!--div *ngIf="fetchPublications.searchUtils.totalResults == 0" class = "uk-alert">
No publications available
</div-->
<div *ngIf="fetchPublications.searchUtils.totalResults > 0">
<div class = "uk-text-right" *ngIf = "fetchPublications.searchUtils.totalResults > 10">
<!--a [href] = "linkToSearchPublications">
View all {{fetchPublications.searchUtils.totalResults}} results
</a-->
<a [queryParams]="paramsForSearchLink"
routerLinkActive="router-link-active" [routerLink]="linkToSearchPublications" class="uk-button uk-button-text">
View all {{fetchPublications.searchUtils.totalResults}} results
</a>
</div>
<tab-result [(results)]="fetchPublications.results"
[(status)]= "fetchPublications.status"
type="publication" urlParam="articleId">
</tab-result>
</div>
`
})
export class PublicationsTabComponent {
@Input() paramsForSearchLink = {};//: string = "";
@Input() fetchPublications : FetchPublications;
@Input() properties:EnvProperties ;
public linkToSearchPublications = "";
public errorCodes:ErrorCodes = new ErrorCodes();
constructor () {}
ngOnInit() {
this.linkToSearchPublications = this.properties.searchLinkToAdvancedPublications
}
ngOnDestroy() {}
}