2017-12-19 13:53:46 +01:00
|
|
|
import {Component, Input} from '@angular/core';
|
|
|
|
import { FetchPublications } from '../../utils/fetchEntitiesClasses/fetchPublications.class';
|
|
|
|
|
2018-02-05 14:14:59 +01:00
|
|
|
import {ErrorCodes} from '../../utils/properties/openaireProperties';
|
|
|
|
import{EnvProperties} from '../../utils/properties/env-properties';
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
@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;
|
2018-02-05 14:14:59 +01:00
|
|
|
@Input() properties:EnvProperties ;
|
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
public linkToSearchPublications = "";
|
|
|
|
public errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
|
|
|
|
constructor () {}
|
|
|
|
|
|
|
|
ngOnInit() {
|
2018-02-05 14:14:59 +01:00
|
|
|
this.linkToSearchPublications = this.properties.searchLinkToAdvancedPublications
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnDestroy() {}
|
|
|
|
}
|