1 |
51749
|
argiro.kok
|
import {Component, Input} from '@angular/core';
|
2 |
53973
|
konstantin
|
import {ActivatedRoute} from '@angular/router';
|
3 |
|
|
|
4 |
51749
|
argiro.kok
|
import {PiwikHelper} from '../../utils/piwikHelper';
|
5 |
|
|
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
|
6 |
53973
|
konstantin
|
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
|
7 |
50428
|
argiro.kok
|
|
8 |
53973
|
konstantin
|
import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
|
9 |
|
|
import {SearchZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
|
10 |
|
|
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
|
11 |
|
|
|
12 |
|
|
import {ZenodoInformationClass} from '../../openaireLibrary/deposit/utils/zenodoInformation.class';
|
13 |
|
|
import {FetchZenodoInformation} from '../utils/fetchZenodoInformation.class';
|
14 |
|
|
|
15 |
50428
|
argiro.kok
|
@Component({
|
16 |
|
|
selector: 'openaire-deposit-datasets',
|
17 |
|
|
template: `
|
18 |
53973
|
konstantin
|
<deposit-datasets [piwikSiteId]=piwikSiteId [zenodoInformation]="zenodoInformation">
|
19 |
50428
|
argiro.kok
|
|
20 |
|
|
</deposit-datasets>
|
21 |
|
|
`
|
22 |
|
|
})
|
23 |
|
|
|
24 |
|
|
export class OpenaireDepositDatasetsComponent {
|
25 |
53973
|
konstantin
|
public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
|
26 |
|
|
properties:EnvProperties;
|
27 |
|
|
fetchZenodoInformation: FetchZenodoInformation;
|
28 |
|
|
|
29 |
51749
|
argiro.kok
|
piwikSiteId = null;
|
30 |
53973
|
konstantin
|
constructor ( private route: ActivatedRoute,
|
31 |
|
|
private _ΖenodoCommunitieService: ZenodoCommunitiesService,
|
32 |
|
|
private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) {
|
33 |
|
|
this.fetchZenodoInformation = new FetchZenodoInformation(this._ΖenodoCommunitieService, this._searchZenodoCommunitiesService);
|
34 |
51749
|
argiro.kok
|
}
|
35 |
50428
|
argiro.kok
|
|
36 |
53973
|
konstantin
|
public ngOnInit() {
|
37 |
|
|
this.route.data
|
38 |
|
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
39 |
|
|
this.properties = data.envSpecific;
|
40 |
|
|
this.route.queryParams.subscribe(params => {
|
41 |
|
|
var communityId = params['communityId'];
|
42 |
|
|
if(!communityId){
|
43 |
54949
|
argiro.kok
|
communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
44 |
|
|
}
|
45 |
53973
|
konstantin
|
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
|
46 |
|
|
|
47 |
|
|
if(communityId) {
|
48 |
|
|
|
49 |
|
|
if (communityId != null && communityId != '') {
|
50 |
|
|
|
51 |
|
|
this._communityService.getCommunity(this.properties, this.properties.communityAPI+communityId).subscribe (
|
52 |
|
|
community => {
|
53 |
|
|
var community = community;
|
54 |
|
|
var masterZenodoCommunityId = community.zenodoCommunity;
|
55 |
|
|
if(masterZenodoCommunityId){
|
56 |
|
|
this.fetchZenodoInformation.getZenodoCommunityNameAndUrlById(masterZenodoCommunityId, this.properties, this.zenodoInformation);
|
57 |
|
|
}
|
58 |
|
|
this.fetchZenodoInformation.searchNumberOfZCommunities(communityId, this.properties, this.zenodoInformation);
|
59 |
|
|
},
|
60 |
|
|
error => {
|
61 |
54863
|
konstantin
|
//console.error("Community couldn't be loaded");
|
62 |
|
|
this.handleError("Error getting community with id: "+communityId, error);
|
63 |
53973
|
konstantin
|
}
|
64 |
|
|
);
|
65 |
|
|
}
|
66 |
|
|
}
|
67 |
|
|
});
|
68 |
|
|
});
|
69 |
|
|
}
|
70 |
54863
|
konstantin
|
|
71 |
|
|
private handleError(message: string, error) {
|
72 |
|
|
console.error("Deposit Research Data Page: "+message, error);
|
73 |
|
|
}
|
74 |
50428
|
argiro.kok
|
}
|