2019-04-24 14:31:01 +02:00
|
|
|
import {Component, Input} from '@angular/core';
|
2020-07-01 14:11:57 +02:00
|
|
|
import {HostedByCollectedFrom} from "../../utils/result-preview/result-preview";
|
2020-07-13 16:42:34 +02:00
|
|
|
import {properties} from "../../../../environments/environment";
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
@Component({
|
2020-03-16 14:09:46 +01:00
|
|
|
selector: 'availableOn',
|
|
|
|
template: `
|
2022-01-07 11:01:22 +01:00
|
|
|
<div *ngIf="availableOn" class="download-from uk-height-max-large uk-overflow-auto uk-margin-small-bottom">
|
|
|
|
<div *ngFor="let instance of availableOn.slice(0, showNum) let i=index"
|
2020-03-16 14:09:46 +01:00
|
|
|
class="uk-flex uk-flex-top"
|
2022-01-07 11:01:22 +01:00
|
|
|
[title]="instance.accessRight ? instance.accessRight : 'Not available'">
|
2020-03-16 14:09:46 +01:00
|
|
|
<span class="uk-margin-small-right">
|
2022-01-07 11:01:22 +01:00
|
|
|
<img [src]="instance.accessRightIcon" loading="lazy" [alt]="instance.accessRight" style="width:20px; height:20px">
|
2020-03-16 14:09:46 +01:00
|
|
|
</span>
|
2020-05-20 22:34:29 +02:00
|
|
|
<div class="uk-width-expand uk-padding-small uk-padding-remove-left uk-padding-remove-vertical">
|
2022-01-07 11:01:22 +01:00
|
|
|
<a *ngIf="instance.downloadUrl" [href]="instance.downloadUrl" target="_blank"
|
2020-07-21 23:15:22 +02:00
|
|
|
class="title">
|
2022-01-07 11:01:22 +01:00
|
|
|
{{instance.downloadNames.join("; ")}}
|
2020-03-16 14:09:46 +01:00
|
|
|
<span class="custom-external custom-icon space"></span>
|
2020-07-27 12:48:05 +02:00
|
|
|
</a>
|
2022-01-07 11:01:22 +01:00
|
|
|
<div *ngIf="instance.types?.length > 0 || instance.years?.length > 0">
|
|
|
|
<span *ngIf="instance.types?.length > 0" class="uk-text-capitalize">{{instance.types.join(" . ")}}</span>
|
|
|
|
<span *ngIf="instance.types?.length > 0 && instance.years?.length > 0"> . </span>
|
|
|
|
<span *ngIf="instance.years?.length > 0">{{instance.years.join(" . ")}}</span>
|
2020-03-16 14:09:46 +01:00
|
|
|
</div>
|
2022-01-07 11:01:22 +01:00
|
|
|
<div *ngIf="instance.collectedNamesAndIds?.size > 0">
|
|
|
|
<span>Providers: </span>
|
2022-02-14 15:24:10 +01:00
|
|
|
<a *ngFor="let collectedName of getKeys(instance.collectedNamesAndIds); let i=index" [routerLink]="dataProviderUrl"
|
2022-01-07 11:01:22 +01:00
|
|
|
[queryParams]="{datasourceId: instance.collectedNamesAndIds.get(collectedName)}">
|
|
|
|
{{collectedName}}<ng-container *ngIf="(i !== (instance.collectedNamesAndIds.size - 1))">; </ng-container>
|
2020-07-27 12:48:05 +02:00
|
|
|
</a>
|
2020-03-16 14:09:46 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-07-27 12:48:05 +02:00
|
|
|
</div>
|
2020-03-16 14:09:46 +01:00
|
|
|
</div>
|
2020-07-21 23:15:22 +02:00
|
|
|
<div *ngIf="showNum > threshold" class="uk-margin-bottom">
|
|
|
|
<a (click)="showNum = threshold;" class="uk-flex uk-flex-middle uk-flex-center">
|
|
|
|
<span>View less</span>
|
2020-07-22 15:39:35 +02:00
|
|
|
<span class="space uk-icon">
|
|
|
|
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" data-svg="chevron-up">
|
|
|
|
<polyline fill="none" stroke="#000" stroke-width="1.03" points="4 13 10 7 16 13"></polyline>
|
|
|
|
</svg>
|
|
|
|
</span>
|
2018-05-16 17:42:42 +02:00
|
|
|
</a>
|
|
|
|
</div>
|
2020-07-21 23:15:22 +02:00
|
|
|
<div *ngIf="showNum == threshold && availableOn && availableOn.length > 5" class="uk-margin-bottom">
|
|
|
|
<a (click)="showNum = availableOn.length;" class="uk-flex uk-flex-middle uk-flex-center">
|
|
|
|
<span>View more</span>
|
2020-07-22 15:39:35 +02:00
|
|
|
<span class="space uk-icon">
|
|
|
|
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" data-svg="chevron-down">
|
|
|
|
<polyline fill="none" stroke="#000" stroke-width="1.03" points="16 7 10 13 4 7"></polyline>
|
|
|
|
</svg>
|
|
|
|
</span>
|
2018-05-16 17:42:42 +02:00
|
|
|
</a>
|
|
|
|
</div>
|
2020-03-16 14:09:46 +01:00
|
|
|
`
|
|
|
|
})
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
export class AvailableOnComponent {
|
2020-07-01 14:11:57 +02:00
|
|
|
@Input() availableOn: HostedByCollectedFrom[];
|
2020-03-16 14:09:46 +01:00
|
|
|
public threshold: number = 4;
|
|
|
|
public showNum: number = 4;
|
2020-07-13 16:42:34 +02:00
|
|
|
public dataProviderUrl = properties.searchLinkToDataProvider.split('?')[0];
|
2020-03-16 14:09:46 +01:00
|
|
|
|
|
|
|
constructor() {
|
|
|
|
}
|
|
|
|
|
2021-04-20 17:18:15 +02:00
|
|
|
ngOnInit() {}
|
2020-03-16 14:09:46 +01:00
|
|
|
|
|
|
|
public removeUnknown(value: string): string {
|
2021-03-31 11:34:41 +02:00
|
|
|
if (value.toLowerCase() === 'unknown') {
|
|
|
|
return null;
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
2020-03-16 14:09:46 +01:00
|
|
|
return value;
|
|
|
|
}
|
2022-02-14 15:24:10 +01:00
|
|
|
|
|
|
|
public getKeys( map) {
|
|
|
|
return Array.from(map.keys());
|
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|