2017-12-19 13:53:46 +01:00
|
|
|
|
import {Component, Input} from '@angular/core';
|
|
|
|
|
|
2019-09-11 11:45:54 +02:00
|
|
|
|
import { FetchResearchResults } from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
2018-02-15 11:36:12 +01:00
|
|
|
|
import { ErrorCodes} from '../../utils/properties/errorCodes';
|
2019-09-11 11:45:54 +02:00
|
|
|
|
import { RouterHelper } from '../../utils/routerHelper.class';
|
|
|
|
|
import { EnvProperties } from '../../utils/properties/env-properties';
|
2020-03-16 14:09:46 +01:00
|
|
|
|
import {AlertModal} from "../../utils/modal/alert";
|
2020-07-13 16:42:34 +02:00
|
|
|
|
import {properties} from "../../../../environments/environment";
|
2022-05-03 13:22:53 +02:00
|
|
|
|
import {OpenaireEntities} from "../../utils/properties/searchFields";
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
|
|
@Component({
|
2020-03-16 14:09:46 +01:00
|
|
|
|
selector: 'relatedDatasourcesTab',
|
|
|
|
|
template: `
|
|
|
|
|
<errorMessages [status]="[fetchResults.searchUtils.status]"
|
2022-05-03 13:22:53 +02:00
|
|
|
|
[type]="'related '+openaireEntities.DATASOURCES" tab_error_class=true>
|
2020-03-16 14:09:46 +01:00
|
|
|
|
</errorMessages>
|
|
|
|
|
|
2022-05-03 13:22:53 +02:00
|
|
|
|
<div *ngIf="fetchResults.searchUtils.status == errorCodes.DONE && !loading" class="uk-text-small">
|
|
|
|
|
<div class="uk-text-meta uk-margin-medium-bottom">
|
|
|
|
|
*Only top 100 {{openaireEntities.DATASOURCES}} that host {{openaireEntities.RESULTS}} which are also available via the Federated Research Data Repository are shown.
|
2020-03-16 14:09:46 +01:00
|
|
|
|
</div>
|
2022-05-03 13:22:53 +02:00
|
|
|
|
<results-and-pages *ngIf="results.length >pageSize" [type]="openaireEntities.DATASOURCES"
|
|
|
|
|
[page]="page" [pageSize]="pageSize"
|
|
|
|
|
[totalResults]="results.length">
|
|
|
|
|
</results-and-pages>
|
2020-03-16 14:09:46 +01:00
|
|
|
|
|
|
|
|
|
<table class="uk-table uk-table-striped">
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
2022-05-03 13:22:53 +02:00
|
|
|
|
<th>{{openaireEntities.DATASOURCE}}</th>
|
2020-03-16 14:09:46 +01:00
|
|
|
|
<th *ngIf="fetchResults.results.length > 0 || fetchResults.searchUtils.status == errorCodes.ERROR"
|
|
|
|
|
class="uk-text-center">
|
2022-05-03 13:22:53 +02:00
|
|
|
|
{{openaireEntities.RESULTS}} in Explore
|
2020-03-16 14:09:46 +01:00
|
|
|
|
</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
<ng-container *ngIf="results">
|
|
|
|
|
<ng-container *ngFor="let result of results; let i=index">
|
|
|
|
|
<tr *ngIf="i>=(page-1)*pageSize && i<page*pageSize">
|
2022-05-03 13:22:53 +02:00
|
|
|
|
<td>
|
2020-07-13 16:42:34 +02:00
|
|
|
|
<a [queryParams]="{datasourceId: result.id}" routerLinkActive="router-link-active" [routerLink]="dataProviderUrl"
|
2020-03-16 14:09:46 +01:00
|
|
|
|
(click)="onLinkClick()">
|
|
|
|
|
{{result.name}}
|
|
|
|
|
</a>
|
|
|
|
|
</td>
|
|
|
|
|
<td *ngIf="fetchResults.results.length > 0" class="uk-text-center">
|
|
|
|
|
<a
|
|
|
|
|
[queryParams]="routerHelper.createQueryParams(['f0', 'fv0', 'f1', 'fv1', 'f2', 'fv2', 'qf'], ['collectedfromdatasourceid', dataproviderId, 'resulthostingdatasourceid,or', dataproviderId, 'resulthostingdatasourceid', result.id, 'false'])"
|
|
|
|
|
routerLinkActive="router-link-active" [routerLink]="properties.searchLinkToAdvancedResults"
|
|
|
|
|
(click)="onLinkClick()">
|
|
|
|
|
{{result.count | number}}
|
|
|
|
|
</a>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</ng-container>
|
|
|
|
|
</ng-container>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
2022-05-03 13:22:53 +02:00
|
|
|
|
<paging-no-load *ngIf="results.length >pageSize"
|
2020-03-16 14:09:46 +01:00
|
|
|
|
(pageChange)="updatePage($event)"
|
2022-05-03 13:22:53 +02:00
|
|
|
|
[currentPage]="page"
|
|
|
|
|
[size]="pageSize"
|
2020-03-16 14:09:46 +01:00
|
|
|
|
[totalResults]="results.length">
|
2022-05-03 13:22:53 +02:00
|
|
|
|
</paging-no-load>
|
2020-03-16 14:09:46 +01:00
|
|
|
|
</div>
|
|
|
|
|
`
|
2017-12-19 13:53:46 +01:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export class RelatedDatasourcesTabComponent {
|
|
|
|
|
@Input() dataproviderId: string;
|
2020-03-16 14:09:46 +01:00
|
|
|
|
// @Input() fetchPublications : FetchResearchResults;
|
|
|
|
|
// @Input() fetchDatasets : FetchResearchResults;
|
|
|
|
|
// @Input() fetchSoftware : FetchResearchResults;
|
|
|
|
|
// @Input() fetchOrps: FetchResearchResults;
|
|
|
|
|
@Input() fetchResults: FetchResearchResults;
|
2018-07-05 17:50:43 +02:00
|
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
|
// true: preprocessing is not over
|
|
|
|
|
@Input() loading: boolean = true;
|
[Monitor Dashboard & Library | new-theme]: Renaming entity types using OpenaireEntities.
Files updated: develop.component.ts, methodology.component.ts, claimEntitiesSelection.component.ts, directLinking.component.ts, linkingGeneric.component.html, linkingGeneric.component.ts, approved.component.ts, searchDataprovidersToDeposit.component.ts, errorPage.component.ts, dataProvider.component.html, dataProvider.component.ts, dataProvider.service.ts, relatedDatasourcesTab.component.ts, project.component.ts, myOrcidLinks.component.ts, searchMyOrcidResults.component.html, searchMyOrcidResults.component.ts, searchAll.component.html, searchAll.component.ts, advancedSearchForm.component.html, advancedSearchForm.component.ts, searchDataProviders.component.ts, searchResearchResults.service.ts, numbers.component.ts, other-portals.component.html, other-portals.component.ts, fetchDataproviders.class.ts, fetchResearchResults.class.ts, searchFields.ts, result-preview.component.ts
2022-05-09 12:13:44 +02:00
|
|
|
|
// Εvery datasource's id is a single key of a map
|
2020-03-16 14:09:46 +01:00
|
|
|
|
//@Input() results: Map<string, {"name": string, "countPublications": string, "countDatasets": string, "countSoftware": string, "countOrps": string}>;
|
|
|
|
|
@Input() results: {"id": string, "name": string, "count": number}[];
|
2018-02-05 14:14:59 +01:00
|
|
|
|
@Input() properties:EnvProperties ;
|
2020-03-16 14:09:46 +01:00
|
|
|
|
@Input() collectedFromName: string ="[no title available]";
|
|
|
|
|
@Input() modal: AlertModal;
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
|
|
public routerHelper:RouterHelper = new RouterHelper();
|
|
|
|
|
public errorCodes:ErrorCodes = new ErrorCodes();
|
|
|
|
|
|
|
|
|
|
public page: number = 1;
|
|
|
|
|
public pageSize: number = 10;
|
2020-07-13 16:42:34 +02:00
|
|
|
|
public dataProviderUrl;
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
2022-05-03 13:22:53 +02:00
|
|
|
|
public openaireEntities = OpenaireEntities;
|
|
|
|
|
|
|
|
|
|
constructor () {}
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
2020-07-13 16:42:34 +02:00
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.dataProviderUrl = properties.searchLinkToDataProvider.split('?')[0];
|
|
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
|
|
ngOnDestroy() {}
|
|
|
|
|
|
|
|
|
|
totalPages(totalResults: number): number {
|
|
|
|
|
let totalPages:any = totalResults/this.pageSize;
|
|
|
|
|
if(!(Number.isInteger(totalPages))) {
|
|
|
|
|
totalPages = (parseInt(totalPages, this.pageSize) + 1);
|
|
|
|
|
}
|
|
|
|
|
return totalPages;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updatePage($event) {
|
|
|
|
|
this.page = $event.value;
|
2022-06-16 18:37:31 +02:00
|
|
|
|
this.scrollToTabTop("relatedDatasources");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
scrollToTabTop(tabId:string){
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
window.scrollTo({
|
|
|
|
|
top: document.getElementById(tabId) ? document.getElementById(tabId).offsetTop - 250 : 250,
|
|
|
|
|
behavior: 'smooth'
|
|
|
|
|
});
|
|
|
|
|
}, 200);
|
2017-12-19 13:53:46 +01:00
|
|
|
|
}
|
2018-07-26 18:38:59 +02:00
|
|
|
|
|
|
|
|
|
public getKeys( map) {
|
|
|
|
|
return Array.from(map.keys());
|
|
|
|
|
}
|
2020-03-16 14:09:46 +01:00
|
|
|
|
|
|
|
|
|
public onLinkClick() {
|
|
|
|
|
if(this.modal) {
|
|
|
|
|
this.modal.cancel();
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
|
}
|