From 1459dda5faa82e3ea5f465159590fe7707cde671 Mon Sep 17 00:00:00 2001 From: "sofia.baltzi" Date: Mon, 12 Mar 2018 16:34:48 +0000 Subject: [PATCH] Add communityAPI link in properties class and Move service's calls in route.data git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@51164 d315682c-612b-4755-9ff5-7f18f6832af3 --- src/app/community/community.component.ts | 151 +++++++++++------------ src/app/community/community.module.ts | 2 +- src/app/utils/properties.ts | 6 +- 3 files changed, 80 insertions(+), 79 deletions(-) diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts index 9c0dd34..39b5456 100644 --- a/src/app/community/community.component.ts +++ b/src/app/community/community.component.ts @@ -1,23 +1,24 @@ import {Component, Input, Output, EventEmitter, ViewChild, ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import {ActivatedRoute, Router} from '@angular/router'; -import {Location} from '@angular/common'; +import {Observable} from 'rxjs/Observable'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Location} from '@angular/common'; import "rxjs/add/observable/zip"; -import { EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; -import { ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes'; -import {Properties} from '../utils/properties'; +import { EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; +import { ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes'; +import {Properties} from '../utils/properties'; -import {CommunityService} from "../openaireLibrary/connect/community/community.service"; -import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; -import {Meta} from '../openaireLibrary/sharedComponents/metaService'; -import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service'; -import {SearchEntriesService} from '../searchEntries/searchEntries.service'; +import {CommunityService} from "../openaireLibrary/connect/community/community.service"; +import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service'; +import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; +import {Meta} from '../openaireLibrary/sharedComponents/metaService'; +import {SearchEntriesService} from '../searchEntries/searchEntries.service'; @Component({ selector: 'community', templateUrl: 'community.component.html', }) + export class CommunityComponent { public piwiksub: any; public subfunders: any; @@ -42,14 +43,14 @@ export class CommunityComponent { public community = null; constructor ( - private route: ActivatedRoute, + private route: ActivatedRoute, private _router: Router, private location: Location, private _meta: Meta, private _piwikService:PiwikService, private config: ConfigurationService, private _communityService:CommunityService, - private _searchEntriesService:SearchEntriesService, - ) { + private _searchEntriesService:SearchEntriesService) { + var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects "; var title = "OpenAIRE"; @@ -69,69 +70,67 @@ export class CommunityComponent { this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE").subscribe(); } + this.route.queryParams.subscribe( + communityId => { + this.communityId = communityId['communityId']; + }); + + this._communityService.getCommunity('https://dev-openaire.d4science.org/openaire/community/'+this.communityId).subscribe ( + community => { + this.community = community; + this.params = {community: encodeURIComponent('"'+community.queryId+'"')}; + //console.log(community); + }); + + this._searchEntriesService.getTotal('http://beta.services.openaire.eu:8480/search/rest/v2/api/publications/count?format=json&fq=communityid='+this.communityId).subscribe( + publicationTotal => { + this.publicationTotal = publicationTotal; + }); + + this._searchEntriesService.getTotal('http://beta.services.openaire.eu:8480/search/rest/v2/api/datasets/count?format=json&fq=communityid='+this.communityId).subscribe( + researchDataTotal => { + this.researchDataTotal = researchDataTotal; + }); + + this._searchEntriesService.getTotal('http://beta.services.openaire.eu:8480/search/rest/v2/api/software/count?format=json&fq=communityid='+this.communityId).subscribe( + softwareTotal => { + this.softwareTotal = softwareTotal; + }); + + this._searchEntriesService.countTotal('https://dev-openaire.d4science.org/openaire/community/'+this.communityId+'/projects').subscribe( + projectTotal => { + this.projectTotal = projectTotal; + //console.log(projectTotal); + }); + + this._searchEntriesService.countTotal('https://dev-openaire.d4science.org/openaire/community/'+this.communityId+'/contentproviders').subscribe( + contentProviderTotal => { + this.contentProviderTotal = contentProviderTotal; + //console.log(contentProviderTotal); + }); + + // this._searchEntriesService.countTotal('https://dev-openaire.d4science.org/openaire/community/'+this.communityId+'/organizations').subscribe( + // organizationTotal => { + // this.organizationTotal = organizationTotal; + // console.log(organizationTotal); + // }); + + this._searchEntriesService.getResults('http://beta.services.openaire.eu:8480/search/rest/v2/api/publications?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe( + publicationResults => { + this.publicationResults = publicationResults; + //console.log(publicationResults); + }); + + this._searchEntriesService.getResults('http://beta.services.openaire.eu:8480/search/rest/v2/api/datasets?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe( + researchDataResults => { + this.researchDataResults = researchDataResults; + }); + + this._searchEntriesService.getResults('http://beta.services.openaire.eu:8480/search/rest/v2/api/software?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe( + softwareResults => { + this.softwareResults = softwareResults; + }); }); - - this.route.queryParams.subscribe( - communityId => { - this.communityId = communityId['communityId']; - }); - - this._communityService.getCommunity('https://dev-openaire.d4science.org/openaire/community/'+this.communityId).subscribe ( - community => { - this.community = community; - this.params = {community: encodeURIComponent('"'+community.queryId+'"')}; - //console.log(community); - }); - - this._searchEntriesService.getTotal('http://beta.services.openaire.eu:8480/search/rest/v2/api/publications/count?format=json&fq=communityid='+this.communityId).subscribe( - publicationTotal => { - this.publicationTotal = publicationTotal; - }); - - this._searchEntriesService.getTotal('http://beta.services.openaire.eu:8480/search/rest/v2/api/datasets/count?format=json&fq=communityid='+this.communityId).subscribe( - researchDataTotal => { - this.researchDataTotal = researchDataTotal; - }); - - this._searchEntriesService.getTotal('http://beta.services.openaire.eu:8480/search/rest/v2/api/software/count?format=json&fq=communityid='+this.communityId).subscribe( - softwareTotal => { - this.softwareTotal = softwareTotal; - }); - - this._searchEntriesService.countTotal('https://dev-openaire.d4science.org/openaire/community/'+this.communityId+'/projects').subscribe( - projectTotal => { - this.projectTotal = projectTotal; - //console.log(projectTotal); - }); - - this._searchEntriesService.countTotal('https://dev-openaire.d4science.org/openaire/community/'+this.communityId+'/contentproviders').subscribe( - contentProviderTotal => { - this.contentProviderTotal = contentProviderTotal; - //console.log(contentProviderTotal); - }); - - // this._searchEntriesService.countTotal('https://dev-openaire.d4science.org/openaire/community/'+this.communityId+'/organizations').subscribe( - // organizationTotal => { - // this.organizationTotal = organizationTotal; - // console.log(organizationTotal); - // }); - - this._searchEntriesService.getResults('http://beta.services.openaire.eu:8480/search/rest/v2/api/publications?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe( - publicationResults => { - this.publicationResults = publicationResults; - //console.log(publicationResults); - }); - - this._searchEntriesService.getResults('http://beta.services.openaire.eu:8480/search/rest/v2/api/datasets?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe( - researchDataResults => { - this.researchDataResults = researchDataResults; - }); - - this._searchEntriesService.getResults('http://beta.services.openaire.eu:8480/search/rest/v2/api/software?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe( - softwareResults => { - this.softwareResults = softwareResults; - }); - } public ngOnDestroy() { diff --git a/src/app/community/community.module.ts b/src/app/community/community.module.ts index cbff2ec..8aab6ea 100644 --- a/src/app/community/community.module.ts +++ b/src/app/community/community.module.ts @@ -11,7 +11,7 @@ import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; import {Meta} from '../openaireLibrary/sharedComponents/metaService'; import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service'; import {SearchEntriesService} from '../searchEntries/searchEntries.service'; -import { CommunityService } from '../openaireLibrary/connect/community/community.service'; +import {CommunityService} from '../openaireLibrary/connect/community/community.service'; import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard'; import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; diff --git a/src/app/utils/properties.ts b/src/app/utils/properties.ts index 5c3a90c..a7786e6 100644 --- a/src/app/utils/properties.ts +++ b/src/app/utils/properties.ts @@ -1,5 +1,7 @@ export class Properties { public static adminToolsAPIURL = "http://duffy.di.uoa.gr:8080/uoa-admin-tools"; - public static adminToolsAPIURL_pm = "http://duffy.di.uoa.gr:8080/uoa-admin-tools"; - public static adminToolsCommunity = "egi"; + public static adminToolsAPIURL_pm = "http://duffy.di.uoa.gr:8080/uoa-admin-tools"; + public static adminToolsCommunity = "egi"; + + public static communityAPI = "https://dev-openaire.d4science.org/openaire/community/"; }