Revision 58259
Added by Konstantina Galouni about 4 years ago
dataProvider.component.ts | ||
---|---|---|
73 | 73 |
public fetchAggregatorsDatasets: FetchResearchResults; |
74 | 74 |
public fetchAggregatorsSoftware: FetchResearchResults; |
75 | 75 |
public fetchAggregatorsOrps: FetchResearchResults; |
76 |
public fetchAggregatorsResults: FetchResearchResults; |
|
76 | 77 |
|
77 | 78 |
public loadingRelatedDatasources: boolean = true; |
78 | 79 |
|
... | ... | |
307 | 308 |
// return tab.name === 'Publications'; |
308 | 309 |
//})) { |
309 | 310 |
// this.relatedDataprovidersResultsType = 'publications'; |
310 |
this.fetchAggregatorsPublications = new FetchResearchResults(this._searchResearchResultsService); |
|
311 |
//} else { |
|
312 |
// this.relatedDataprovidersResultsType = 'datasets'; |
|
313 |
this.fetchAggregatorsDatasets = new FetchResearchResults(this._searchResearchResultsService); |
|
314 |
//} |
|
315 |
this.fetchAggregatorsSoftware = new FetchResearchResults(this._searchResearchResultsService); |
|
316 |
this.fetchAggregatorsOrps = new FetchResearchResults(this._searchResearchResultsService); |
|
311 |
|
|
312 |
// this.fetchAggregatorsPublications = new FetchResearchResults(this._searchResearchResultsService); |
|
313 |
// //} else { |
|
314 |
// // this.relatedDataprovidersResultsType = 'datasets'; |
|
315 |
// this.fetchAggregatorsDatasets = new FetchResearchResults(this._searchResearchResultsService); |
|
316 |
// //} |
|
317 |
// this.fetchAggregatorsSoftware = new FetchResearchResults(this._searchResearchResultsService); |
|
318 |
// this.fetchAggregatorsOrps = new FetchResearchResults(this._searchResearchResultsService); |
|
319 |
this.fetchAggregatorsResults = new FetchResearchResults(this._searchResearchResultsService); |
|
317 | 320 |
} |
318 | 321 |
// if (this.dataProviderInfo.resultsBy == "collectedFrom") { |
319 | 322 |
// //this.paramsForSearchLink = "?collectedFrom="+this.datasourceId+"&co=and"; |
... | ... | |
329 | 332 |
|
330 | 333 |
public getParamsForSearchLink(type: string = "") { |
331 | 334 |
let resultsBy: string = ""; |
332 |
if(this.dataProviderInfo.resultsBy == "collectedFrom") { |
|
333 |
resultsBy = "collectedfromdatasourceid" |
|
334 |
} else if (this.dataProviderInfo.resultsBy == "hostedBy") { |
|
335 |
resultsBy = "resulthostingdatasourceid"; |
|
336 |
} |
|
335 |
// if(this.dataProviderInfo.resultsBy == "collectedFrom") {
|
|
336 |
// resultsBy = "collectedfromdatasourceid"
|
|
337 |
// } else if (this.dataProviderInfo.resultsBy == "hostedBy") {
|
|
338 |
// resultsBy = "resulthostingdatasourceid";
|
|
339 |
// }
|
|
337 | 340 |
|
338 | 341 |
if(type) { |
339 |
return this.routerHelper.createQueryParams(['f0', 'fv0', 'type', 'qf'], [resultsBy, this.datasourceId, type, "false"]);
|
|
342 |
return this.routerHelper.createQueryParams(['f0', 'fv0', 'f1', 'fv1', 'type', 'qf'], ["collectedfromdatasourceid", this.datasourceId, "resulthostingdatasourceid,or", this.datasourceId, type, "false"]);
|
|
340 | 343 |
} else { |
341 |
return this.routerHelper.createQueryParams(['f0', 'fv0'], [resultsBy, this.datasourceId]);
|
|
344 |
return this.routerHelper.createQueryParams(['f0', 'fv0', 'f1', 'fv1'], ["collectedfromdatasourceid", this.datasourceId, "resulthostingdatasourceid,or", this.datasourceId]);
|
|
342 | 345 |
} |
343 | 346 |
} |
344 | 347 |
|
... | ... | |
467 | 470 |
private searchRelatedDatasources(page: number, size: number) { |
468 | 471 |
// Currently no counting is done for this tab. Following condition is always false |
469 | 472 |
|
473 |
// if (this.reloadRelatedDatasources && |
|
474 |
// (this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.LOADING || |
|
475 |
// this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.DONE) |
|
476 |
// && |
|
477 |
// (this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.LOADING || |
|
478 |
// this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.DONE) |
|
479 |
// && |
|
480 |
// (this.fetchAggregatorsSoftware.searchUtils.status == this.errorCodes.LOADING || |
|
481 |
// this.fetchAggregatorsSoftware.searchUtils.status == this.errorCodes.DONE) |
|
482 |
// && |
|
483 |
// (this.fetchAggregatorsOrps.searchUtils.status == this.errorCodes.LOADING || |
|
484 |
// this.fetchAggregatorsOrps.searchUtils.status == this.errorCodes.DONE) |
|
485 |
// ) { |
|
486 |
// this.relatedDatasourcesSub = observableMerge(this.fetchAggregatorsPublications.requestComplete, this.fetchAggregatorsDatasets.requestComplete, this.fetchAggregatorsSoftware.requestComplete, this.fetchAggregatorsOrps.requestComplete) |
|
487 |
// .subscribe( |
|
488 |
// data => { |
|
489 |
// }, |
|
490 |
// err => { |
|
491 |
// }, |
|
492 |
// () => { |
|
493 |
// this.preprocessRelatedDatasources(); |
|
494 |
// } |
|
495 |
// ); |
|
496 |
// |
|
497 |
// this.fetchAggregatorsPublications.getAggregatorResults("publication", this.datasourceId, page, size, this.properties); |
|
498 |
// this.fetchAggregatorsDatasets.getAggregatorResults("dataset", this.datasourceId, page, size, this.properties); |
|
499 |
// this.fetchAggregatorsSoftware.getAggregatorResults("software", this.datasourceId, page, size, this.properties); |
|
500 |
// this.fetchAggregatorsOrps.getAggregatorResults("other", this.datasourceId, page, size, this.properties); |
|
470 | 501 |
if (this.reloadRelatedDatasources && |
471 |
(this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.LOADING || |
|
472 |
this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.DONE) |
|
473 |
&& |
|
474 |
(this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.LOADING || |
|
475 |
this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.DONE) |
|
476 |
&& |
|
477 |
(this.fetchAggregatorsSoftware.searchUtils.status == this.errorCodes.LOADING || |
|
478 |
this.fetchAggregatorsSoftware.searchUtils.status == this.errorCodes.DONE) |
|
479 |
&& |
|
480 |
(this.fetchAggregatorsOrps.searchUtils.status == this.errorCodes.LOADING || |
|
481 |
this.fetchAggregatorsOrps.searchUtils.status == this.errorCodes.DONE)) { |
|
482 |
this.relatedDatasourcesSub = observableMerge(this.fetchAggregatorsPublications.requestComplete, this.fetchAggregatorsDatasets.requestComplete, this.fetchAggregatorsSoftware.requestComplete, this.fetchAggregatorsOrps.requestComplete) |
|
483 |
.subscribe( |
|
484 |
data => { |
|
485 |
}, |
|
486 |
err => { |
|
487 |
}, |
|
488 |
() => { |
|
489 |
this.preprocessRelatedDatasources(); |
|
490 |
} |
|
491 |
) |
|
502 |
(this.fetchAggregatorsResults.searchUtils.status == this.errorCodes.LOADING || |
|
503 |
this.fetchAggregatorsResults.searchUtils.status == this.errorCodes.DONE) |
|
504 |
) { |
|
505 |
this.relatedDatasourcesSub = this.fetchAggregatorsResults.requestComplete.subscribe( |
|
506 |
data => {}, |
|
507 |
err => {}, |
|
508 |
() => { |
|
509 |
//this.preprocessRelatedDatasources(); |
|
510 |
this.dataProviderInfo.relatedDatasources = this.fetchAggregatorsResults.results; |
|
511 |
this.loadingRelatedDatasources = false; |
|
512 |
} |
|
513 |
); |
|
492 | 514 |
|
493 |
this.fetchAggregatorsPublications.getAggregatorResults("publication", this.datasourceId, page, size, this.properties); |
|
494 |
this.fetchAggregatorsDatasets.getAggregatorResults("dataset", this.datasourceId, page, size, this.properties); |
|
495 |
this.fetchAggregatorsSoftware.getAggregatorResults("software", this.datasourceId, page, size, this.properties); |
|
496 |
this.fetchAggregatorsOrps.getAggregatorResults("other", this.datasourceId, page, size, this.properties); |
|
515 |
this.fetchAggregatorsResults.getAggregatorResults("results", this.datasourceId, page, size, this.properties); |
|
497 | 516 |
} else { |
498 | 517 |
this.loadingRelatedDatasources = false; |
499 | 518 |
} |
... | ... | |
503 | 522 |
} |
504 | 523 |
|
505 | 524 |
private countRelatedDatasources(page: number, size: number) { |
506 |
this.fetchAggregatorsPublications.getAggregatorResults("publication", this.datasourceId, page, size, this.properties); |
|
507 |
this.fetchAggregatorsDatasets.getAggregatorResults("dataset", this.datasourceId, page, size, this.properties); |
|
508 |
this.fetchAggregatorsSoftware.getAggregatorResults("software", this.datasourceId, page, size, this.properties); |
|
509 |
this.fetchAggregatorsOrps.getAggregatorResults("other", this.datasourceId, page, size, this.properties); |
|
525 |
// this.fetchAggregatorsPublications.getAggregatorResults("publication", this.datasourceId, page, size, this.properties); |
|
526 |
// this.fetchAggregatorsDatasets.getAggregatorResults("dataset", this.datasourceId, page, size, this.properties); |
|
527 |
// this.fetchAggregatorsSoftware.getAggregatorResults("software", this.datasourceId, page, size, this.properties); |
|
528 |
// this.fetchAggregatorsOrps.getAggregatorResults("other", this.datasourceId, page, size, this.properties); |
|
529 |
this.fetchAggregatorsResults.getAggregatorResults("results", this.datasourceId, page, size, this.properties); |
|
510 | 530 |
} |
511 | 531 |
|
512 | 532 |
|
513 |
private preprocessRelatedDatasources() { |
|
514 |
if (this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.DONE || |
|
515 |
this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.DONE || |
|
516 |
this.fetchAggregatorsSoftware.searchUtils.status == this.errorCodes.DONE || |
|
517 |
this.fetchAggregatorsOrps.searchUtils.status == this.errorCodes.DONE) { |
|
518 |
this.dataProviderInfo.relatedDatasources = new Map<string, { "name": string, "countPublications": string, "countDatasets": string, "countSoftware": string, "countOrps": string }>(); |
|
519 |
} |
|
520 |
for (let result of this.fetchAggregatorsPublications.results) { |
|
521 |
if (!this.dataProviderInfo.relatedDatasources.has(result.id)) { |
|
522 |
this.dataProviderInfo.relatedDatasources.set(result.id, { |
|
523 |
"name": result.name, |
|
524 |
"countPublications": result.count, |
|
525 |
"countDatasets": "0", |
|
526 |
"countSoftware": "0", |
|
527 |
"countOrps": "0" |
|
528 |
}); |
|
529 |
} else { |
|
530 |
this.dataProviderInfo.relatedDatasources.get(result.id).countPublications = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countPublications + result.count) + ""; |
|
531 |
} |
|
532 |
} |
|
533 |
// private preprocessRelatedDatasources() { |
|
534 |
// if (this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.DONE || |
|
535 |
// this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.DONE || |
|
536 |
// this.fetchAggregatorsSoftware.searchUtils.status == this.errorCodes.DONE || |
|
537 |
// this.fetchAggregatorsOrps.searchUtils.status == this.errorCodes.DONE) { |
|
538 |
// this.dataProviderInfo.relatedDatasources = new Map<string, { "name": string, "countPublications": string, "countDatasets": string, "countSoftware": string, "countOrps": string }>(); |
|
539 |
// } |
|
540 |
// for (let result of this.fetchAggregatorsPublications.results) { |
|
541 |
// if (!this.dataProviderInfo.relatedDatasources.has(result.id)) { |
|
542 |
// this.dataProviderInfo.relatedDatasources.set(result.id, { |
|
543 |
// "name": result.name, |
|
544 |
// "countPublications": result.count, |
|
545 |
// "countDatasets": "0", |
|
546 |
// "countSoftware": "0", |
|
547 |
// "countOrps": "0" |
|
548 |
// }); |
|
549 |
// } else { |
|
550 |
// this.dataProviderInfo.relatedDatasources.get(result.id).countPublications = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countPublications + result.count) + ""; |
|
551 |
// } |
|
552 |
// } |
|
553 |
// |
|
554 |
// for (let result of this.fetchAggregatorsDatasets.results) { |
|
555 |
// if (!this.dataProviderInfo.relatedDatasources.has(result.id)) { |
|
556 |
// this.dataProviderInfo.relatedDatasources.set(result.id, { |
|
557 |
// "name": result.name, |
|
558 |
// "countPublications": "0", |
|
559 |
// "countDatasets": result.count, |
|
560 |
// "countSoftware": "0", |
|
561 |
// "countOrps": "0" |
|
562 |
// }); |
|
563 |
// } else { |
|
564 |
// this.dataProviderInfo.relatedDatasources.get(result.id).countDatasets = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countDatasets + result.count) + ""; |
|
565 |
// } |
|
566 |
// } |
|
567 |
// |
|
568 |
// for (let result of this.fetchAggregatorsSoftware.results) { |
|
569 |
// if (!this.dataProviderInfo.relatedDatasources.has(result.id)) { |
|
570 |
// this.dataProviderInfo.relatedDatasources.set(result.id, { |
|
571 |
// "name": result.name, |
|
572 |
// "countPublications": "0", |
|
573 |
// "countDatasets": "0", |
|
574 |
// "countSoftware": result.count, |
|
575 |
// "countOrps": "0" |
|
576 |
// }); |
|
577 |
// } else { |
|
578 |
// this.dataProviderInfo.relatedDatasources.get(result.id).countSoftware = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countSoftware + result.count) + ""; |
|
579 |
// } |
|
580 |
// } |
|
581 |
// |
|
582 |
// for (let result of this.fetchAggregatorsOrps.results) { |
|
583 |
// if (!this.dataProviderInfo.relatedDatasources.has(result.id)) { |
|
584 |
// this.dataProviderInfo.relatedDatasources.set(result.id, { |
|
585 |
// "name": result.name, |
|
586 |
// "countPublications": "0", |
|
587 |
// "countDatasets": "0", |
|
588 |
// "countSoftware": "0", |
|
589 |
// "countOrps": result.count |
|
590 |
// }); |
|
591 |
// } else { |
|
592 |
// this.dataProviderInfo.relatedDatasources.get(result.id).countOrps = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countOrps + result.count) + ""; |
|
593 |
// } |
|
594 |
// } |
|
595 |
// this.loadingRelatedDatasources = false; |
|
596 |
// } |
|
533 | 597 |
|
534 |
for (let result of this.fetchAggregatorsDatasets.results) { |
|
535 |
if (!this.dataProviderInfo.relatedDatasources.has(result.id)) { |
|
536 |
this.dataProviderInfo.relatedDatasources.set(result.id, { |
|
537 |
"name": result.name, |
|
538 |
"countPublications": "0", |
|
539 |
"countDatasets": result.count, |
|
540 |
"countSoftware": "0", |
|
541 |
"countOrps": "0" |
|
542 |
}); |
|
543 |
} else { |
|
544 |
this.dataProviderInfo.relatedDatasources.get(result.id).countDatasets = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countDatasets + result.count) + ""; |
|
545 |
} |
|
546 |
} |
|
547 |
|
|
548 |
for (let result of this.fetchAggregatorsSoftware.results) { |
|
549 |
if (!this.dataProviderInfo.relatedDatasources.has(result.id)) { |
|
550 |
this.dataProviderInfo.relatedDatasources.set(result.id, { |
|
551 |
"name": result.name, |
|
552 |
"countPublications": "0", |
|
553 |
"countDatasets": "0", |
|
554 |
"countSoftware": result.count, |
|
555 |
"countOrps": "0" |
|
556 |
}); |
|
557 |
} else { |
|
558 |
this.dataProviderInfo.relatedDatasources.get(result.id).countSoftware = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countSoftware + result.count) + ""; |
|
559 |
} |
|
560 |
} |
|
561 |
|
|
562 |
for (let result of this.fetchAggregatorsOrps.results) { |
|
563 |
if (!this.dataProviderInfo.relatedDatasources.has(result.id)) { |
|
564 |
this.dataProviderInfo.relatedDatasources.set(result.id, { |
|
565 |
"name": result.name, |
|
566 |
"countPublications": "0", |
|
567 |
"countDatasets": "0", |
|
568 |
"countSoftware": "0", |
|
569 |
"countOrps": result.count |
|
570 |
}); |
|
571 |
} else { |
|
572 |
this.dataProviderInfo.relatedDatasources.get(result.id).countOrps = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countOrps + result.count) + ""; |
|
573 |
} |
|
574 |
} |
|
575 |
this.loadingRelatedDatasources = false; |
|
576 |
} |
|
577 |
|
|
578 | 598 |
public metricsResults($event) { |
579 | 599 |
this.totalViews = $event.totalViews; |
580 | 600 |
this.totalDownloads = $event.totalDownloads; |
Also available in: Unified diff
[Library | Landing Redesign]:
1. fetchResearchResults.class.ts: 'getResultsForDataproviders()' & 'getAggregatorResults()', searchProjects.service.ts: 'getProjectsforDataProvider()', searchDataproviders.service.ts: 'getDataProvidersforEntityRegistry()':
in query parameters add exact id for 'collectedfromdatasourceid or resulthostingdatasourceid'.
2. searchResearchResults.service.ts: unused 'resultType' parameter removed from 'searchAggregators()'.
3. dataProviderInfo.ts: 'relatedDatasources' structure changed from:
Map<string, {"name": string, "countPublications": string, "countDatasets": string, "countSoftware": string, "countOrps": string}>;
to {"id": string, "name": string, "count": number}[];, where count is the number for all research outcomes (publications, datasets, software, other).
4. relatedDatasourcesTab.component.ts:
a. Close modal when clicking an internal link
b. Change view and structure to show number of all research outcomes
c. Search links with parameters for 'collectedfromdatasourceid or resulthostingdatasourceid'.
5. dataProvider.component.ts:
a. Count and search everything with parameters for 'collectedfromdatasourceid or resulthostingdatasourceid'
b. Only 1 query for relatedDatasources (all research outcomes in 1 query).
6. dataProvider.component.html: Show all "tabs" no matter what the type of content provider is.