2018-03-29 16:15:47 +02:00
|
|
|
import { Component, Input } from '@angular/core';
|
|
|
|
import { ActivatedRoute } from '@angular/router';
|
|
|
|
import { EnvProperties} from '../../utils/properties/env-properties';
|
|
|
|
|
|
|
|
import {ConnectHelper} from '../connectHelper';
|
2018-04-04 14:35:31 +02:00
|
|
|
import {SearchCommunityDataprovidersService} from '../contentProviders/searchDataproviders.service';
|
2020-11-18 17:06:27 +01:00
|
|
|
import {properties} from "../../../../environments/environment";
|
[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
|
|
|
import {OpenaireEntities} from "../../utils/properties/searchFields";
|
2018-03-29 16:15:47 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'approved-by-community',
|
|
|
|
template: `
|
[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
|
|
|
<span *ngIf="approved" class="uk-align-right uk-label custom-label uk-label-success">{{openaireEntities.COMMUNITY}} Approved</span>
|
2018-03-29 16:15:47 +02:00
|
|
|
`
|
|
|
|
})
|
|
|
|
|
|
|
|
export class ApprovedByCommunityComponent {
|
|
|
|
@Input() contentProviderId: string;
|
|
|
|
|
|
|
|
public communityId:string;
|
|
|
|
public approved:boolean = false;
|
|
|
|
private communityContentProviders = [];
|
|
|
|
|
|
|
|
properties:EnvProperties;
|
[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
|
|
|
public openaireEntities = OpenaireEntities;
|
2018-03-29 16:15:47 +02:00
|
|
|
|
2018-04-04 14:35:31 +02:00
|
|
|
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchCommunityDataprovidersService) {}
|
2018-03-29 16:15:47 +02:00
|
|
|
|
|
|
|
public ngOnInit() {
|
2020-11-18 17:06:27 +01:00
|
|
|
this.properties =properties;
|
|
|
|
this.route.queryParams.subscribe(
|
|
|
|
communityId => {
|
|
|
|
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
|
|
|
if(!this.communityId) {
|
|
|
|
this.communityId = communityId['communityId'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if(this.communityId && this.communityId != "openaire") {
|
|
|
|
this._searchDataprovidersService.searchDataproviders(this.properties, this.communityId).subscribe (
|
|
|
|
contentproviders => {
|
|
|
|
this.communityContentProviders = contentproviders;
|
|
|
|
this.approved = this.checkApproval();
|
|
|
|
},
|
|
|
|
error => {
|
[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
|
|
|
this.handleError("Error getting "+OpenaireEntities.DATASOURCES+" for "+OpenaireEntities.COMMUNITY+" with id: "+this.communityId, error);
|
2018-03-29 16:15:47 +02:00
|
|
|
}
|
2020-11-18 17:06:27 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-03-29 16:15:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private checkApproval(): boolean {
|
|
|
|
let self = this;
|
|
|
|
return this.communityContentProviders.map(contentprovider => contentprovider.openaireId).some(function(id) {
|
|
|
|
return id == self.contentProviderId;
|
|
|
|
});
|
|
|
|
}
|
2019-02-18 15:00:43 +01:00
|
|
|
|
|
|
|
private handleError(message: string, error) {
|
[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
|
|
|
console.error("Approved by "+OpenaireEntities.COMMUNITY+" (component): "+message, error);
|
2019-02-18 15:00:43 +01:00
|
|
|
}
|
2018-03-29 16:15:47 +02:00
|
|
|
}
|