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

45 lines
1.5 KiB
TypeScript

import {Component, Input} from '@angular/core';
import { FetchProjects } from '../../utils/fetchEntitiesClasses/fetchProjects.class';
import { ErrorCodes} from '../../utils/properties/errorCodes';
import{EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'projectsTab',
template: `
<errorMessages [status]="[fetchProjects.searchUtils.status]" [type]="'projects'" tab_error_class=true></errorMessages>
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.DONE">
<div class = "uk-text-right" *ngIf = "fetchProjects.searchUtils.totalResults > 10">
<a [queryParams]="paramsForSearchLink"
routerLinkActive="router-link-active" [routerLink]="linkToSearchProjects" class="uk-button uk-button-text">
View all {{fetchProjects.searchUtils.totalResults | number}} results
</a>
</div>
<tab-result [(results)]="fetchProjects.results"
[(status)]= "fetchProjects.status"
type="project" urlParam="projectId">
</tab-result>
</div>
`
})
export class ProjectsTabComponent {
@Input() paramsForSearchLink = {};
@Input() fetchProjects : FetchProjects;
@Input() properties:EnvProperties ;
public linkToSearchProjects = "";
public errorCodes:ErrorCodes = new ErrorCodes();
constructor () {}
ngOnInit() {
this.linkToSearchProjects = this.properties.searchLinkToAdvancedProjects;
}
ngOnDestroy() {}
}