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

54 lines
2.7 KiB
TypeScript
Raw Normal View History

import {Component, Input} from '@angular/core';
import { FetchDataproviders } from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import{EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'datasourcesTab',
template: `
<!--div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No content providers available</div>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="fetchDataproviders.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="fetchDataproviders.searchUtils.status == errorCodes.NOT_FOUND" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">No content providers found</div-->
<errorMessages [status]="[fetchDataproviders.searchUtils.status]" [type]="'content providers'"></errorMessages>
<!--div *ngIf="fetchDataproviders.searchUtils.totalResults == 0" class = "uk-alert">
No content providers available
</div-->
<div *ngIf="fetchDataproviders.searchUtils.totalResults > 0">
<div class = "uk-text-right" *ngIf = "fetchDataproviders.searchUtils.totalResults > 10">
<a [queryParams]="paramsForSearchLink"
routerLinkActive="router-link-active" [routerLink]="linkToSearchDataproviders" class="uk-button uk-button-text">
View all {{fetchDataproviders.searchUtils.totalResults}} results
</a>
</div>
<tab-result [(results)]="fetchDataproviders.results"
[(status)]= "fetchDataproviders.status"
type="dataprovider" urlParam="datasourceId"
lazy=false>
</tab-result>
</div>
`
})
export class DatasourcesTabComponent {
@Input() paramsForSearchLink = {};
@Input() fetchDataproviders : FetchDataproviders;
@Input() properties:EnvProperties ;
public linkToSearchDataproviders = "";
public errorCodes:ErrorCodes = new ErrorCodes();
constructor () {}
ngOnInit() {
this.linkToSearchDataproviders = this.properties.searchLinkToAdvancedDataProviders;
}
ngOnDestroy() {}
}