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

51 lines
2.6 KiB
TypeScript

import {Component, Input} from '@angular/core';
import { FetchDatasets } from '../../utils/fetchEntitiesClasses/fetchDatasets.class';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import{EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'datasetsTab',
template: `
<!--div *ngIf="fetchDatasets.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img class="loading-gif uk-align-center" ></div>
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No research data available</div>
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service temprorarily unavailable. Please try again later.</div>
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.NOT_FOUND" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">No research data found</div-->
<errorMessages [status]="[fetchDatasets.searchUtils.status]" [type]="'research data'"></errorMessages>
<!--div *ngIf="fetchDatasets.searchUtils.totalResults == 0" class = "uk-alert">
No research data available
</div-->
<div *ngIf="fetchDatasets.searchUtils.totalResults > 0">
<div class = "uk-text-right" *ngIf = "fetchDatasets.searchUtils.totalResults > 10" >
<a [queryParams]="paramsForSearchLink"
routerLinkActive="router-link-active" [routerLink]="linkToSearchDatasets" class="uk-button uk-button-text">
View all {{fetchDatasets.searchUtils.totalResults | number}} results
</a>
</div>
<tab-result [(results)]="fetchDatasets.results"
[(status)]= "fetchDatasets.searchUtils.status"
type="dataset" urlParam="datasetId">
</tab-result>
</div>
`
})
export class DatasetsTabComponent {
@Input() paramsForSearchLink = {};
@Input() fetchDatasets : FetchDatasets;
@Input() properties:EnvProperties ;
public linkToSearchDatasets = "";
public errorCodes:ErrorCodes = new ErrorCodes();
constructor () {}
ngOnInit() {
this.linkToSearchDatasets = this.properties.searchLinkToAdvancedDatasets;
}
ngOnDestroy() {}
}