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 "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 {CommunityService} from "./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 { PublicationInfo } from '../../publicationInfo'; @Component({ selector: 'community', templateUrl: 'community.component.html', }) export class CommunityComponent { public piwiksub: any; public subfunders: any; public pageTitle = "OpenAIRE" public publications; public reasearchData; public software; public publicationsInfo=[]; public researchDataInfo=[]; public softwareInfo=[]; params = {community: encodeURIComponent('"egi||EGI Federation"')}; properties:EnvProperties; //public publicationsInfo: PublicationInfo[] = []; constructor ( private route: ActivatedRoute, private _router: Router, private location: Location, private _meta: Meta,private _piwikService:PiwikService, private config: ConfigurationService, private _communityService:CommunityService ) { var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects "; var title = "OpenAIRE"; this._meta.setTitle(title); this._meta.updateMeta("description", description); this._meta.updateProperty("og:description", description); this._meta.updateProperty("og:title", title); } public ngOnInit() { this.route.data .subscribe((data: { envSpecific: EnvProperties }) => { this.properties = data.envSpecific; var url = data.envSpecific.baseLink+this._router.url this._meta.updateProperty("og:url", url); if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE").subscribe(); } }); this._communityService.getNumberOfPublications().subscribe( publications => { this.publications = publications; console.log(publications); }); this._communityService.getNumberOfResearchData().subscribe( reasearchData => { this.reasearchData = reasearchData; console.log(reasearchData); }); this._communityService.getNumberOfSoftware().subscribe( software => { this.software = software; console.log(software); }); this._communityService.getPublicationsInfo().subscribe( publicationsInfo => { this.publicationsInfo = publicationsInfo; console.log(publicationsInfo); }); this._communityService.getResearchDataInfo().subscribe( researchDataInfo => { this.researchDataInfo = researchDataInfo; console.log(researchDataInfo); }); this._communityService.getSoftwareInfo().subscribe( softwareInfo => { this.softwareInfo = softwareInfo; console.log(softwareInfo); }); // this._communityService // .getPublicationInfo('http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/publications?fq=communityid exact "egi"&sortBy=resultdateofacceptance,descending&format=json') // .subscribe( // // }); } public ngOnDestroy() { if(this.piwiksub){ this.piwiksub.unsubscribe(); } } }