Update community page
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@50822 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
2f7d91409a
commit
7542d5eb28
|
@ -12,42 +12,24 @@
|
||||||
<div class="uk-child-width-1-6@l uk-child-width-1-6@m uk-child-width-1-3@s uk-text-center uk-grid" uk-grid="">
|
<div class="uk-child-width-1-6@l uk-child-width-1-6@m uk-child-width-1-3@s uk-text-center uk-grid" uk-grid="">
|
||||||
<div class="uk-first-column">
|
<div class="uk-first-column">
|
||||||
<div class="uk-card uk-card-default uk-card-small uk-card-body">
|
<div class="uk-card uk-card-default uk-card-small uk-card-body">
|
||||||
<a [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/publications" ><h3 class="uk-card-title">{{publications.total}}</h3>
|
<div *ngIf="publicationTotal != null">
|
||||||
|
<a><h3 class="uk-card-title">{{publicationTotal}}</h3>
|
||||||
<p>publications</p></a>
|
<p>publications</p></a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="uk-card uk-card-default uk-card-small uk-card-body">
|
<div class="uk-card uk-card-default uk-card-small uk-card-body">
|
||||||
<a [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/datasets"><h3 class="uk-card-title">{{reasearchData.total}}</h3>
|
<a><h3 class="uk-card-title">{{researchDataTotal}}</h3>
|
||||||
<p>research data</p></a>
|
<p>research data</p></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="uk-card uk-card-default uk-card-small uk-card-body">
|
<div class="uk-card uk-card-default uk-card-small uk-card-body">
|
||||||
<a [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/software"><h3 class="uk-card-title">{{software.total}}</h3>
|
<a><h3 class="uk-card-title">{{softwareTotal}}</h3>
|
||||||
<p>software</p></a>
|
<p>software</p></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--div>
|
|
||||||
<div class="uk-card uk-card-default uk-card-small uk-card-body">
|
|
||||||
<a><h3 class="uk-card-title">37</h3>
|
|
||||||
<p>content providers</p></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div class="uk-card uk-card-default uk-card-small uk-card-body">
|
|
||||||
<a><h3 class="uk-card-title">126</h3>
|
|
||||||
<p>organizations</p></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div class="uk-card uk-card-default uk-card-small uk-card-body">
|
|
||||||
<a><h3 class="uk-card-title">743</h3>
|
|
||||||
<p>projects</p></a>
|
|
||||||
</div>
|
|
||||||
</div-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="uk-grid-small uk-margin-medium uk-grid" uk-grid="">
|
<div class="uk-grid-small uk-margin-medium uk-grid" uk-grid="">
|
||||||
|
@ -55,114 +37,19 @@
|
||||||
<h3 class="uk-margin-small uk-h3 uk-heading-line uk-text-primary">
|
<h3 class="uk-margin-small uk-h3 uk-heading-line uk-text-primary">
|
||||||
<span>Most recent publications</span>
|
<span>Most recent publications</span>
|
||||||
</h3>
|
</h3>
|
||||||
<!--test-->
|
<results-comp [(results)]=publicationResults resultType="publication" [params]=params></results-comp>
|
||||||
<div class="uk-margin-remove-vertical uk-grid-match uk-child-width-1-1 uk-child-width-1-1@m uk-child-width-1-1@l uk-child-width-1-1@xl uk-grid-small uk-grid-divider uk-grid uk-grid-stack" uk-grid="">
|
|
||||||
<li *ngFor="let item of publicationsInfo; let i = index">
|
|
||||||
<div class="uk-first-column">
|
|
||||||
<div class="el-item uk-panel">
|
|
||||||
<h6 class="el-title uk-margin uk-h6 uk-text-primary uk-margin-remove-adjacent uk-margin-remove-bottom">
|
|
||||||
|
|
||||||
<a [queryParams]="{articleId: item.id, community: 'egi||EGI Federation'}" routerLinkActive="router-link-active" routerLink="/search/publication" >
|
|
||||||
{{item.title}}</a>
|
|
||||||
</h6>
|
|
||||||
<div class="el-content "><span class=" uk-label label-{{item.bestaccessright}}">{{item.bestaccessright}}</span><br></div>
|
|
||||||
<!--authors-->
|
|
||||||
<span *ngFor='let item1 of item.authors; let i = index'>
|
|
||||||
<span class="el-meta uk-margin uk-text-meta">{{item1["content"]}}</span><span *ngIf='i< item.authors.length -1' class="el-meta uk-margin uk-text-meta">, </span>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="el-meta uk-margin uk-text-meta"> {{item.dateofacceptance}} </div>
|
|
||||||
<!--div class="text-justify descriptionText"> {{item.description}} </div-->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</div>
|
|
||||||
<!--end of test-->
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
<div class="uk-margin">
|
|
||||||
<a class="el-content uk-button uk-button-text" [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/publications" >
|
|
||||||
View all
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-width-expand@m">
|
<div class="uk-width-expand@m">
|
||||||
<h2 class="uk-h3 uk-heading-line uk-text-primary">
|
<h2 class="uk-h3 uk-heading-line uk-text-primary">
|
||||||
<span>Most recent research data</span>
|
<span>Most recent research data</span>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="uk-margin-remove-vertical uk-grid-match uk-child-width-1-1 uk-child-width-1-1@m uk-child-width-1-1@l uk-child-width-1-1@xl uk-grid-small uk-grid-divider uk-grid uk-grid-stack" uk-grid="">
|
<results-comp [(results)]=researchDataResults resultType="dataset" [params]=params></results-comp>
|
||||||
<li *ngFor="let item of researchDataInfo; let i = index">
|
|
||||||
<div class="uk-first-column">
|
|
||||||
<div class="el-item uk-panel">
|
|
||||||
<h6 class="el-title uk-margin uk-h6 uk-text-primary uk-margin-remove-adjacent uk-margin-remove-bottom">
|
|
||||||
<a [queryParams]="{articleId: item.id, community: 'egi||EGI Federation'}" routerLinkActive="router-link-active" routerLink="/search/publication" >
|
|
||||||
{{item.title}}</a>
|
|
||||||
</h6>
|
|
||||||
<div class="el-content "><span class=" uk-label label-{{item.bestaccessright}}">{{item.bestaccessright}}</span><br></div>
|
|
||||||
<!--authors-->
|
|
||||||
<span *ngFor='let item1 of item.authors; let i = index'>
|
|
||||||
<span class="el-meta uk-margin uk-text-meta">{{item1["content"]}}</span><span *ngIf='i< item.authors.length -1' class="el-meta uk-margin uk-text-meta">, </span>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="el-meta uk-margin uk-text-meta"> {{item.dateofacceptance}} </div>
|
|
||||||
<!--div class="text-justify descriptionText"> {{item.description}} </div-->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</div>
|
|
||||||
<div *ngIf = "researchDataInfo.length == 0 " class=" uk-alert uk-alert-primary"> No results found</div>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
<div *ngIf = "researchDataInfo.length > 0 " class="uk-margin">
|
|
||||||
<a class="el-content uk-button uk-button-text" [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/datasets" >
|
|
||||||
View all
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-width-expand@m">
|
<div class="uk-width-expand@m">
|
||||||
<h2 class="uk-h3 uk-heading-line uk-text-primary">
|
<h2 class="uk-h3 uk-heading-line uk-text-primary">
|
||||||
<span>Most recent software</span>
|
<span>Most recent software</span>
|
||||||
</h2>
|
</h2>
|
||||||
|
<results-comp [(results)]=softwareResults resultType="software" [params]=params></results-comp>
|
||||||
<div class="uk-margin-remove-vertical uk-grid-match uk-child-width-1-1 uk-child-width-1-1@m uk-child-width-1-1@l uk-child-width-1-1@xl uk-grid-small uk-grid-divider uk-grid uk-grid-stack" uk-grid="">
|
|
||||||
<li *ngFor="let item of softwareInfo; let i = index">
|
|
||||||
<div class="uk-first-column">
|
|
||||||
<div class="el-item uk-panel">
|
|
||||||
<h6 class="el-title uk-margin uk-h6 uk-text-primary uk-margin-remove-adjacent uk-margin-remove-bottom">
|
|
||||||
<a [queryParams]="{articleId: item.id, community: 'egi||EGI Federation'}" routerLinkActive="router-link-active" routerLink="/search/publication" >
|
|
||||||
{{item.title}}</a>
|
|
||||||
</h6>
|
|
||||||
<div class="el-content "><span class=" uk-label label-{{item.bestaccessright}}">{{item.bestaccessright}}</span><br></div>
|
|
||||||
<!--authors-->
|
|
||||||
<span *ngFor='let item1 of item.authors; let i = index'>
|
|
||||||
<span class="el-meta uk-margin uk-text-meta">{{item1["content"]}}</span><span *ngIf='i< item.authors.length -1' class="el-meta uk-margin uk-text-meta">, </span>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="el-meta uk-margin uk-text-meta"> {{item.dateofacceptance}} </div>
|
|
||||||
<!--div class="text-justify descriptionText"> {{item.description}} </div-->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
<div class="uk-margin">
|
|
||||||
<a class="el-content uk-button uk-button-text" [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/software" >
|
|
||||||
View all
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-grid">
|
<div class="uk-grid">
|
||||||
|
|
|
@ -12,7 +12,6 @@ import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
|
||||||
import {Meta} from '../openaireLibrary/sharedComponents/metaService';
|
import {Meta} from '../openaireLibrary/sharedComponents/metaService';
|
||||||
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
|
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
|
||||||
|
|
||||||
//import { PublicationInfo } from '../../publicationInfo';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'community',
|
selector: 'community',
|
||||||
|
@ -24,16 +23,16 @@ export class CommunityComponent {
|
||||||
|
|
||||||
public pageTitle = "OpenAIRE"
|
public pageTitle = "OpenAIRE"
|
||||||
|
|
||||||
public publications;
|
public publicationTotal = null;
|
||||||
public reasearchData;
|
public researchDataTotal = null;
|
||||||
public software;
|
public softwareTotal = null;
|
||||||
public publicationsInfo=[];
|
|
||||||
public researchDataInfo=[];
|
|
||||||
public softwareInfo=[];
|
|
||||||
params = {community: encodeURIComponent('"egi||EGI Federation"')};
|
params = {community: encodeURIComponent('"egi||EGI Federation"')};
|
||||||
properties:EnvProperties;
|
properties:EnvProperties;
|
||||||
|
|
||||||
//public publicationsInfo: PublicationInfo[] = [];
|
public publicationResults = null;
|
||||||
|
public researchDataResults = null;
|
||||||
|
public softwareResults = null;
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
|
@ -68,46 +67,40 @@ export class CommunityComponent {
|
||||||
|
|
||||||
});
|
});
|
||||||
this._communityService.getNumberOfPublications().subscribe(
|
this._communityService.getNumberOfPublications().subscribe(
|
||||||
publications => {
|
publicationTotal => {
|
||||||
this.publications = publications;
|
this.publicationTotal = publicationTotal;
|
||||||
console.log(publications);
|
//console.log(publications);
|
||||||
});
|
});
|
||||||
|
|
||||||
this._communityService.getNumberOfResearchData().subscribe(
|
this._communityService.getNumberOfResearchData().subscribe(
|
||||||
reasearchData => {
|
researchDataTotal => {
|
||||||
this.reasearchData = reasearchData;
|
this.researchDataTotal = researchDataTotal;
|
||||||
console.log(reasearchData);
|
//console.log(reasearchData);
|
||||||
});
|
});
|
||||||
|
|
||||||
this._communityService.getNumberOfSoftware().subscribe(
|
this._communityService.getNumberOfSoftware().subscribe(
|
||||||
software => {
|
softwareTotal => {
|
||||||
this.software = software;
|
this.softwareTotal = softwareTotal;
|
||||||
console.log(software);
|
//console.log(software);
|
||||||
});
|
});
|
||||||
|
|
||||||
this._communityService.getPublicationsInfo().subscribe(
|
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(
|
||||||
publicationsInfo => {
|
publicationResults => {
|
||||||
this.publicationsInfo = publicationsInfo;
|
this.publicationResults = publicationResults;
|
||||||
console.log(publicationsInfo);
|
//console.log(publicationResults);
|
||||||
});
|
});
|
||||||
|
|
||||||
this._communityService.getResearchDataInfo().subscribe(
|
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(
|
||||||
researchDataInfo => {
|
researchDataResults => {
|
||||||
this.researchDataInfo = researchDataInfo;
|
this.researchDataResults = researchDataResults;
|
||||||
console.log(researchDataInfo);
|
console.log(researchDataResults);
|
||||||
});
|
});
|
||||||
|
|
||||||
this._communityService.getSoftwareInfo().subscribe(
|
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(
|
||||||
softwareInfo => {
|
softwareResults => {
|
||||||
this.softwareInfo = softwareInfo;
|
this.softwareResults = softwareResults;
|
||||||
console.log(softwareInfo);
|
//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() {
|
public ngOnDestroy() {
|
||||||
if(this.piwiksub){
|
if(this.piwiksub){
|
||||||
|
|
|
@ -5,6 +5,11 @@ import { RouterModule } from '@angular/router';
|
||||||
|
|
||||||
import{CommunityRoutingModule} from './community-routing.module';
|
import{CommunityRoutingModule} from './community-routing.module';
|
||||||
import{CommunityComponent} from './community.component';
|
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 {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
|
||||||
import {Meta} from '../openaireLibrary/sharedComponents/metaService';
|
import {Meta} from '../openaireLibrary/sharedComponents/metaService';
|
||||||
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
|
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
|
||||||
|
@ -18,10 +23,10 @@ import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRout
|
||||||
CommunityRoutingModule
|
CommunityRoutingModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
CommunityComponent
|
CommunityComponent, ResultsComponent
|
||||||
],
|
],
|
||||||
providers:[
|
providers:[
|
||||||
FreeGuard, PreviousRouteRecorder, ConfigurationService, Meta, PiwikService
|
FreeGuard, PreviousRouteRecorder, ConfigurationService, Meta, PiwikService, CommunityService
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
CommunityComponent
|
CommunityComponent
|
||||||
|
|
|
@ -2,75 +2,96 @@ import { Injectable } from '@angular/core';
|
||||||
import { Http, Response, Headers, RequestOptions } from '@angular/http';
|
import { Http, Response, Headers, RequestOptions } from '@angular/http';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
|
|
||||||
import { PublicationInfo } from '../../publicationInfo';
|
import { ResultInfo } from './results/resultInfo';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CommunityService {
|
export class CommunityService {
|
||||||
|
|
||||||
|
private sizeOfDescription: number = 135;
|
||||||
|
|
||||||
constructor(private http:Http) {
|
constructor(private http:Http) {
|
||||||
}
|
}
|
||||||
|
|
||||||
getNumberOfPublications() {
|
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')
|
return this.http.get('http://beta.services.openaire.eu:8480/search/rest/v2/api/publications/count?format=json&fq=communityid=egi')
|
||||||
.map(res => <any> res.json()).do(res => {console.log(res)});
|
.map(res => <any> res.json()).map(res => res.total).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 => <any> 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 => <any> res.json()).map(res => this.parse(res)).do(res => {console.log(res)});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getNumberOfResearchData() {
|
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')
|
return this.http.get('http://beta.services.openaire.eu:8480/search/rest/v2/api/datasets/count?format=json&fq=communityid=egi')
|
||||||
.map(res => <any> res.json()).do(res => {console.log(res)});
|
.map(res => <any> res.json()).map(res => res.total).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 => <any> res.json()).map(res => res.results).do(res => {console.log(res)});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getNumberOfSoftware() {
|
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')
|
return this.http.get('http://beta.services.openaire.eu:8480/search/rest/v2/api/software/count?format=json&fq=communityid=egi')
|
||||||
.map(res => <any> res.json()).do(res => {console.log(res)});
|
.map(res => <any> res.json()).map(res => res.total).do(res => {console.log(res)});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSoftwareInfo() {
|
getResults(url: string) {
|
||||||
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')
|
return this.http.get(url).map(res => <any> res.json()).map(res => this.parseResults(res['results']));
|
||||||
.map(res => <any> res.json()).map(res => this.parse(res)).do(res => {console.log(res)});
|
|
||||||
}
|
}
|
||||||
parse(res){
|
|
||||||
var results =[];
|
|
||||||
for(let item of res.results){
|
|
||||||
var result= {};
|
|
||||||
|
|
||||||
result["id"] = item.result["header"]["dri:objIdentifier"];
|
parseResults(data: any): ResultInfo[] {
|
||||||
result["title"] = item.result["metadata"]["oaf:entity"]["oaf:result"]["title"]["content"];
|
let results: ResultInfo[] = [];
|
||||||
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"];
|
|
||||||
|
|
||||||
result["authors"] = [];
|
let length = Array.isArray(data) ? data.length :1;
|
||||||
if(Array.isArray(item.result["metadata"]["oaf:entity"]["oaf:result"]["creator"])){
|
|
||||||
result["authors"] = item.result["metadata"]["oaf:entity"]["oaf:result"]["creator"];
|
for (let i=0; i<length; i++) {
|
||||||
}else{
|
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:result'] : data['result']['metadata']['oaf:entity']['oaf:result'];
|
||||||
result["authors"].push(item.result["metadata"]["oaf:entity"]["oaf:result"]["creator"]);
|
|
||||||
|
var result: ResultInfo = new ResultInfo();
|
||||||
|
|
||||||
|
|
||||||
|
if(Array.isArray(resData['title'])) {
|
||||||
|
result['title'] = resData['title'][0].content;
|
||||||
|
} else {
|
||||||
|
result['title'] = resData['title'].content;
|
||||||
|
}
|
||||||
|
|
||||||
|
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
|
||||||
|
|
||||||
|
if(resData['bestaccessright'].hasOwnProperty("classid")) {
|
||||||
|
result['accessRights'] = resData['bestaccessright'].classid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(resData['resulttype'].hasOwnProperty("classid")) {
|
||||||
|
result['type'] = resData['resulttype'].classid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(resData.hasOwnProperty("creator") && resData['creator'] != null) {
|
||||||
|
if(result['authors'] == undefined) {
|
||||||
|
result['authors'] = new Array<string>();
|
||||||
|
}
|
||||||
|
|
||||||
|
let authors = resData['creator'];
|
||||||
|
let length = Array.isArray(authors) ? authors.length : 1;
|
||||||
|
|
||||||
|
for(let i=0; i<length; i++) {
|
||||||
|
let author = Array.isArray(authors) ? authors[i] : authors;
|
||||||
|
result.authors[author.rank-1] = author.content;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.authors = result.authors.filter(function (item) {
|
||||||
|
return (item != undefined);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var date:string = (resData.dateofacceptance)+""; // transform to string in case it is an integer
|
||||||
|
result.year = (date && (date).indexOf('-') !== -1)?date.split('-')[0]:date;
|
||||||
|
|
||||||
|
if(!Array.isArray(resData.description)) {
|
||||||
|
result.description = resData.description;
|
||||||
|
} else {
|
||||||
|
result.description = resData.description[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(result.description.length > this.sizeOfDescription) {
|
||||||
|
result.description = result.description.substring(0, this.sizeOfDescription) + "...";
|
||||||
|
}
|
||||||
|
|
||||||
|
results.push(result);
|
||||||
}
|
}
|
||||||
result["authors"] = result["authors"].slice(0,10);
|
return results;
|
||||||
|
|
||||||
results.push(result);
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
}
|
||||||
// getPublicationInfo(url: string) {
|
|
||||||
// return this.http.get(url).map(res => <any> res.json()).map(res => res.results).do(res => {console.log(res)});
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
export class ResultInfo {
|
||||||
|
title: string;
|
||||||
|
id: string;
|
||||||
|
accessRights: string;
|
||||||
|
authors: string[];
|
||||||
|
year: string;
|
||||||
|
description: string;
|
||||||
|
type: string;
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
import {Component, Input} from '@angular/core';
|
||||||
|
import { ResultInfo } from './resultInfo';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'results-comp',
|
||||||
|
template: `
|
||||||
|
<div *ngIf="results != null && results.length > 0">
|
||||||
|
<div class="uk-margin-remove-vertical uk-grid-match uk-child-width-1-1 uk-child-width-1-1@m uk-child-width-1-1@l uk-child-width-1-1@xl uk-grid-small uk-grid-divider uk-grid uk-grid-stack" uk-grid="">
|
||||||
|
<li *ngFor="let item of results; let i = index">
|
||||||
|
<div class="uk-first-column">
|
||||||
|
<div class="el-item uk-panel">
|
||||||
|
<h6 class="el-title uk-margin uk-h6 uk-text-primary uk-margin-remove-adjacent uk-margin-remove-bottom">
|
||||||
|
<div *ngIf="item.type == 'publication'">
|
||||||
|
<a [queryParams]="{articleId: item.id, community: 'egi||EGI Federation'}" routerLinkActive="router-link-active" routerLink="/search/publication" >
|
||||||
|
{{item.title}} </a>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="item.type == 'dataset'">
|
||||||
|
<a [queryParams]="{datasetId: item.id, community: 'egi||EGI Federation'}" routerLinkActive="router-link-active" routerLink="/search/dataset" >
|
||||||
|
{{item.title}} </a>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="item.type == 'software'">
|
||||||
|
<a [queryParams]="{softwareId: item.id, community: 'egi||EGI Federation'}" routerLinkActive="router-link-active" routerLink="/search/software" >
|
||||||
|
{{item.title}} </a>
|
||||||
|
</div>
|
||||||
|
</h6>
|
||||||
|
<div class="el-content"><span class=" uk-label label-{{item.accessRights}}">{{item.accessRights}}</span><br></div>
|
||||||
|
<span *ngFor='let author of item.authors; let i = index'>
|
||||||
|
<span class="el-meta uk-margin uk-text-meta">{{author}}</span>
|
||||||
|
</span>
|
||||||
|
<div class="el-meta uk-text-meta"> {{item.year}} </div>
|
||||||
|
<div class="text-justify descriptionText"> {{item.description}} </div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="results != null && results.length == 0" class=" uk-alert uk-alert-primary"> No results found </div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div *ngIf="results != null && results.length > 0">
|
||||||
|
<div class="uk-margin">
|
||||||
|
<div *ngIf="resultType == 'publication'">
|
||||||
|
<a class="el-content uk-button uk-button-text" [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/publications">
|
||||||
|
View all
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="resultType == 'dataset'">
|
||||||
|
<a class="el-content uk-button uk-button-text" [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/datasets">
|
||||||
|
View all
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="resultType == 'software'">
|
||||||
|
<a class="el-content uk-button uk-button-text" [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/software">
|
||||||
|
View all
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>`
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
export class ResultsComponent {
|
||||||
|
|
||||||
|
@Input() public results : ResultInfo[];
|
||||||
|
@Input() public resultType: string;
|
||||||
|
@Input() public params: any;
|
||||||
|
|
||||||
|
}
|
|
@ -5,10 +5,15 @@ import { OpenaireHtmlProjectReportComponent } from './htmlProjectReport.componen
|
||||||
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
|
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
|
||||||
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||||
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
|
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
|
||||||
|
import {Properties} from '../../utils/properties';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
RouterModule.forChild([
|
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]}
|
||||||
])
|
])
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
|
@ -5,11 +5,14 @@ import {OpenaireSoftwareComponent } from './software.component';
|
||||||
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
|
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
|
||||||
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||||
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
|
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
|
||||||
|
import {Properties} from '../../utils/properties';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
RouterModule.forChild([
|
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] }
|
||||||
])
|
])
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue