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

53 lines
2.3 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: `
<!--div *ngIf="fetchProjects.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No projects available</div>
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="fetchProjects.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-->
<errorMessages [status]="[fetchProjects.searchUtils.status]" [type]="'projects'"></errorMessages>
<!--div *ngIf="fetchProjects.searchUtils.totalResults == 0" class = "uk-alert">
No projects available
</div-->
<div *ngIf="fetchProjects.searchUtils.totalResults > 0">
<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() {}
}