2020-07-10 10:38:52 +02:00
|
|
|
import {Component} from '@angular/core';
|
|
|
|
import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
|
|
|
import {ActivatedRoute, Router} from "@angular/router";
|
|
|
|
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
2020-11-13 17:42:12 +01:00
|
|
|
import {Subscriber} from "rxjs";
|
2020-11-27 11:46:58 +01:00
|
|
|
import {properties} from "../../../../environments/environment";
|
2020-07-10 10:38:52 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'monitor-advanced-search-results',
|
|
|
|
template: `
|
|
|
|
<div id="page_content">
|
|
|
|
<search-research-results *ngIf="initialized" resultType="result" [simpleView]="false"
|
|
|
|
[customFilter]=customFilter [hasPrefix]="false"
|
|
|
|
[includeOnlyResultsAndFilter]="false"
|
2020-11-27 11:46:58 +01:00
|
|
|
[showSwitchSearchLink]="true"
|
|
|
|
[openaireLink]="'https://'+(properties.environment != 'production'?'beta.':'')+'explore.openaire.eu/search/advanced/research-outcomes'"
|
|
|
|
></search-research-results>
|
2020-07-10 10:38:52 +02:00
|
|
|
</div>
|
|
|
|
`
|
|
|
|
})
|
|
|
|
export class MonitorAdvancedSearchResearchResultsComponent {
|
|
|
|
customFilter: SearchCustomFilter = null;
|
|
|
|
initialized: boolean = false;
|
2020-11-27 11:46:58 +01:00
|
|
|
properties;
|
2020-07-10 10:38:52 +02:00
|
|
|
constructor(private route: ActivatedRoute,
|
|
|
|
private router: Router,
|
|
|
|
private stakeholderService: StakeholderService) {
|
|
|
|
}
|
2020-11-13 17:42:12 +01:00
|
|
|
subscriptions = [];
|
|
|
|
ngOnDestroy() {
|
|
|
|
this.subscriptions.forEach(subscription => {
|
|
|
|
if (subscription instanceof Subscriber) {
|
|
|
|
subscription.unsubscribe();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-07-10 10:38:52 +02:00
|
|
|
ngOnInit() {
|
2020-11-27 11:46:58 +01:00
|
|
|
this.properties = properties;
|
2020-11-13 17:42:12 +01:00
|
|
|
this.subscriptions.push(this.route.params.subscribe(params => {
|
2020-07-10 10:38:52 +02:00
|
|
|
if (params['stakeholder']) {
|
2020-11-13 17:42:12 +01:00
|
|
|
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
2020-07-10 10:38:52 +02:00
|
|
|
if (stakeholder) {
|
|
|
|
if (stakeholder.type === "funder") {
|
2020-08-04 09:57:51 +02:00
|
|
|
let value = stakeholder.index_id+"||"+stakeholder.index_name+"||"+stakeholder.index_shortName;
|
|
|
|
this.customFilter = new SearchCustomFilter("Funder", "relfunder", value, stakeholder.name);
|
2020-07-10 10:38:52 +02:00
|
|
|
} else if (stakeholder.type === "organization") {
|
|
|
|
let value = stakeholder.index_id;
|
2020-07-14 10:25:59 +02:00
|
|
|
this.customFilter = new SearchCustomFilter("Organization", "relorganizationid", value, stakeholder.name);
|
2020-07-10 10:38:52 +02:00
|
|
|
} else if (stakeholder.type === "ri") {
|
2020-08-04 09:57:51 +02:00
|
|
|
let value = stakeholder.index_id+"||"+stakeholder.index_name;
|
|
|
|
this.customFilter = new SearchCustomFilter("Community", "community", value, stakeholder.name);
|
2020-07-10 10:38:52 +02:00
|
|
|
}
|
|
|
|
this.initialized = true;
|
|
|
|
}
|
2020-11-13 17:42:12 +01:00
|
|
|
}));
|
2020-07-10 10:38:52 +02:00
|
|
|
}
|
2020-11-13 17:42:12 +01:00
|
|
|
}));
|
2020-07-10 10:38:52 +02:00
|
|
|
}
|
|
|
|
}
|