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

42 lines
1.6 KiB
TypeScript

import {Component, Input} from '@angular/core';
import { FetchResearchResults } from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import{EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'datasetsTab',
template: `
<errorMessages [status]="[fetchDatasets.searchUtils.status]" [type]="'research data'" tab_error_class=true></errorMessages>
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.DONE">
<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 : FetchResearchResults;
@Input() properties:EnvProperties ;
public linkToSearchDatasets = "";
public errorCodes:ErrorCodes = new ErrorCodes();
constructor () {}
ngOnInit() {
this.linkToSearchDatasets = this.properties.searchLinkToAdvancedDatasets;
}
ngOnDestroy() {}
}