diff --git a/src/app/community/community.component.html b/src/app/community/community.component.html
index d344165..9633d09 100644
--- a/src/app/community/community.component.html
+++ b/src/app/community/community.component.html
@@ -12,42 +12,24 @@
diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts
index c1bd1dd..177cae9 100644
--- a/src/app/community/community.component.ts
+++ b/src/app/community/community.component.ts
@@ -12,7 +12,6 @@ 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',
@@ -24,16 +23,16 @@ export class CommunityComponent {
public pageTitle = "OpenAIRE"
- public publications;
- public reasearchData;
- public software;
- public publicationsInfo=[];
- public researchDataInfo=[];
- public softwareInfo=[];
+ public publicationTotal = null;
+ public researchDataTotal = null;
+ public softwareTotal = null;
+
params = {community: encodeURIComponent('"egi||EGI Federation"')};
properties:EnvProperties;
- //public publicationsInfo: PublicationInfo[] = [];
+ public publicationResults = null;
+ public researchDataResults = null;
+ public softwareResults = null;
constructor (
private route: ActivatedRoute,
@@ -68,46 +67,40 @@ export class CommunityComponent {
});
this._communityService.getNumberOfPublications().subscribe(
- publications => {
- this.publications = publications;
- console.log(publications);
+ publicationTotal => {
+ this.publicationTotal = publicationTotal;
+ //console.log(publications);
});
this._communityService.getNumberOfResearchData().subscribe(
- reasearchData => {
- this.reasearchData = reasearchData;
- console.log(reasearchData);
+ researchDataTotal => {
+ this.researchDataTotal = researchDataTotal;
+ //console.log(reasearchData);
});
this._communityService.getNumberOfSoftware().subscribe(
- software => {
- this.software = software;
- console.log(software);
+ softwareTotal => {
+ this.softwareTotal = softwareTotal;
+ //console.log(software);
});
- this._communityService.getPublicationsInfo().subscribe(
- publicationsInfo => {
- this.publicationsInfo = publicationsInfo;
- console.log(publicationsInfo);
+ this._communityService.getResults('http://beta.services.openaire.eu:8480/search/rest/v2/api/publications?fq=communityid%20exact%20%22egi%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe(
+ publicationResults => {
+ this.publicationResults = publicationResults;
+ //console.log(publicationResults);
});
- this._communityService.getResearchDataInfo().subscribe(
- researchDataInfo => {
- this.researchDataInfo = researchDataInfo;
- console.log(researchDataInfo);
+ this._communityService.getResults('http://beta.services.openaire.eu:8480/search/rest/v2/api/datasets?fq=communityid%20exact%20%22egi%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe(
+ researchDataResults => {
+ this.researchDataResults = researchDataResults;
+ console.log(researchDataResults);
});
- this._communityService.getSoftwareInfo().subscribe(
- softwareInfo => {
- this.softwareInfo = softwareInfo;
- console.log(softwareInfo);
+ this._communityService.getResults('http://beta.services.openaire.eu:8480/search/rest/v2/api/software?fq=communityid%20exact%20%22egi%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe(
+ softwareResults => {
+ this.softwareResults = softwareResults;
+ //console.log(softwareResults);
});
-
- // 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){
diff --git a/src/app/community/community.module.ts b/src/app/community/community.module.ts
index 698873a..0836578 100644
--- a/src/app/community/community.module.ts
+++ b/src/app/community/community.module.ts
@@ -5,6 +5,11 @@ import { RouterModule } from '@angular/router';
import{CommunityRoutingModule} from './community-routing.module';
import{CommunityComponent} from './community.component';
+
+import { CommunityService } from './community.service';
+
+import {ResultsComponent} from './results/results.component';
+
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
import {Meta} from '../openaireLibrary/sharedComponents/metaService';
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
@@ -18,10 +23,10 @@ import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRout
CommunityRoutingModule
],
declarations: [
- CommunityComponent
+ CommunityComponent, ResultsComponent
],
providers:[
- FreeGuard, PreviousRouteRecorder, ConfigurationService, Meta, PiwikService
+ FreeGuard, PreviousRouteRecorder, ConfigurationService, Meta, PiwikService, CommunityService
],
exports: [
CommunityComponent
diff --git a/src/app/community/community.service.ts b/src/app/community/community.service.ts
index 4e069ec..042b98a 100644
--- a/src/app/community/community.service.ts
+++ b/src/app/community/community.service.ts
@@ -2,75 +2,96 @@ import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Rx';
-import { PublicationInfo } from '../../publicationInfo';
+import { ResultInfo } from './results/resultInfo';
@Injectable()
export class CommunityService {
+ private sizeOfDescription: number = 135;
+
constructor(private http:Http) {
}
getNumberOfPublications() {
- return this.http.get('http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/publications/count?format=json&fq=communityid=egi')
- .map(res =>
res.json()).do(res => {console.log(res)});
- }
-
- // Most recent publications
- getPublicationsInfo(){
- return this.http.get('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&size=5')
- .map(res => res.json()).map(res => this.parse(res)).do(res => {console.log(res)});
-
- }
- getDatasetsInfo(){
- return this.http.get('http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/datasets?fq=communityid exact "egi"&sortBy=resultdateofacceptance,descending&format=json&size=5')
- .map(res => res.json()).map(res => this.parse(res)).do(res => {console.log(res)});
-
+ return this.http.get('http://beta.services.openaire.eu:8480/search/rest/v2/api/publications/count?format=json&fq=communityid=egi')
+ .map(res => res.json()).map(res => res.total).do(res => {console.log(res)});
}
getNumberOfResearchData() {
- return this.http.get('http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/datasets/count?format=json&fq=communityid=egi')
- .map(res => res.json()).do(res => {console.log(res)});
- }
-
- getResearchDataInfo() {
- return this.http.get('http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/datasets?fq=communityid exact "egi"&sortBy=resultdateofacceptance,descending&format=json&size=5')
- .map(res => res.json()).map(res => res.results).do(res => {console.log(res)});
+ return this.http.get('http://beta.services.openaire.eu:8480/search/rest/v2/api/datasets/count?format=json&fq=communityid=egi')
+ .map(res => res.json()).map(res => res.total).do(res => {console.log(res)});
}
getNumberOfSoftware() {
- return this.http.get('http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/software/count?format=json&fq=communityid=egi')
- .map(res => res.json()).do(res => {console.log(res)});
+ return this.http.get('http://beta.services.openaire.eu:8480/search/rest/v2/api/software/count?format=json&fq=communityid=egi')
+ .map(res => res.json()).map(res => res.total).do(res => {console.log(res)});
}
- getSoftwareInfo() {
- return this.http.get('http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/software?fq=communityid exact "egi"&sortBy=resultdateofacceptance,descending&format=json')
- .map(res => res.json()).map(res => this.parse(res)).do(res => {console.log(res)});
+ getResults(url: string) {
+ return this.http.get(url).map(res => res.json()).map(res => this.parseResults(res['results']));
}
- parse(res){
- var results =[];
- for(let item of res.results){
- var result= {};
- result["id"] = item.result["header"]["dri:objIdentifier"];
- result["title"] = item.result["metadata"]["oaf:entity"]["oaf:result"]["title"]["content"];
- result["bestaccessright"] = item.result["metadata"]["oaf:entity"]["oaf:result"]["bestaccessright"]["classid"];
- result["date"]=item.result["metadata"]["oaf:entity"]["oaf:result"]["dateofacceptance"];
- result["description"]= item.result["metadata"]["oaf:entity"]["oaf:result"]["description"];
+ parseResults(data: any): ResultInfo[] {
+ let results: ResultInfo[] = [];
- result["authors"] = [];
- if(Array.isArray(item.result["metadata"]["oaf:entity"]["oaf:result"]["creator"])){
- result["authors"] = item.result["metadata"]["oaf:entity"]["oaf:result"]["creator"];
- }else{
- result["authors"].push(item.result["metadata"]["oaf:entity"]["oaf:result"]["creator"]);
+ let length = Array.isArray(data) ? data.length :1;
+
+ for (let i=0; i();
+ }
+
+ let authors = resData['creator'];
+ let length = Array.isArray(authors) ? authors.length : 1;
+
+ for(let i=0; i this.sizeOfDescription) {
+ result.description = result.description.substring(0, this.sizeOfDescription) + "...";
+ }
+
+ results.push(result);
}
- result["authors"] = result["authors"].slice(0,10);
-
- results.push(result);
- }
- return results;
+ return results;
}
- // getPublicationInfo(url: string) {
- // return this.http.get(url).map(res => res.json()).map(res => res.results).do(res => {console.log(res)});
- // }
}
diff --git a/src/app/community/results/resultInfo.ts b/src/app/community/results/resultInfo.ts
new file mode 100644
index 0000000..cbead40
--- /dev/null
+++ b/src/app/community/results/resultInfo.ts
@@ -0,0 +1,9 @@
+export class ResultInfo {
+ title: string;
+ id: string;
+ accessRights: string;
+ authors: string[];
+ year: string;
+ description: string;
+ type: string;
+}
diff --git a/src/app/community/results/results.component.ts b/src/app/community/results/results.component.ts
new file mode 100644
index 0000000..d4a5563
--- /dev/null
+++ b/src/app/community/results/results.component.ts
@@ -0,0 +1,70 @@
+import {Component, Input} from '@angular/core';
+import { ResultInfo } from './resultInfo';
+
+@Component({
+ selector: 'results-comp',
+ template: `
+ 0">
+
+
+
+
+
+
{{item.accessRights}}
+
+ {{author}}
+
+
{{item.year}}
+
{{item.description}}
+
+
+
+
+
+
+ No results found
+
+
+
+ `
+
+})
+
+export class ResultsComponent {
+
+ @Input() public results : ResultInfo[];
+ @Input() public resultType: string;
+ @Input() public params: any;
+
+}
diff --git a/src/app/landingPages/htmlProjectReport/htmlProjectReport-routing.module.ts b/src/app/landingPages/htmlProjectReport/htmlProjectReport-routing.module.ts
index 544468f..53a70ea 100644
--- a/src/app/landingPages/htmlProjectReport/htmlProjectReport-routing.module.ts
+++ b/src/app/landingPages/htmlProjectReport/htmlProjectReport-routing.module.ts
@@ -5,10 +5,15 @@ import { OpenaireHtmlProjectReportComponent } from './htmlProjectReport.componen
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
+import {Properties} from '../../utils/properties';
+
@NgModule({
imports: [
RouterModule.forChild([
- { path: '', component: OpenaireHtmlProjectReportComponent , canActivate: [FreeGuard, IsRouteEnabled],canDeactivate: [PreviousRouteRecorder]}
+ { path: '', component: OpenaireHtmlProjectReportComponent , canActivate: [FreeGuard, IsRouteEnabled],
+ data: {
+ redirect: '/error', api: Properties.adminToolsAPIURL, community :Properties.adminToolsCommunity
+ },canDeactivate: [PreviousRouteRecorder]}
])
]
})
diff --git a/src/app/landingPages/software/software-routing.module.ts b/src/app/landingPages/software/software-routing.module.ts
index 50f6a3e..a52bd26 100644
--- a/src/app/landingPages/software/software-routing.module.ts
+++ b/src/app/landingPages/software/software-routing.module.ts
@@ -5,11 +5,14 @@ import {OpenaireSoftwareComponent } from './software.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
+import {Properties} from '../../utils/properties';
@NgModule({
imports: [
RouterModule.forChild([
- { path: '', component: OpenaireSoftwareComponent, canActivate: [FreeGuard, IsRouteEnabled],canDeactivate: [PreviousRouteRecorder] }
+ { path: '', component: OpenaireSoftwareComponent, canActivate: [FreeGuard, IsRouteEnabled], data: {
+ redirect: '/error', api: Properties.adminToolsAPIURL, community :Properties.adminToolsCommunity
+ },canDeactivate: [PreviousRouteRecorder] }
])
]
})