Change community link for getCommunity
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@50974 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
130fb88464
commit
9520d42028
|
@ -5,17 +5,18 @@
|
||||||
<article class="uk-article ">
|
<article class="uk-article ">
|
||||||
<a class="uk-button uk-button-primary uk-align-right"> Subscribe</a>
|
<a class="uk-button uk-button-primary uk-align-right"> Subscribe</a>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<div *ngIf="communityId != null && communityInfo != null">
|
<div *ngIf="communityId != null && community != null">
|
||||||
<div *ngFor="let item of communityInfo; let i = index">
|
<div *ngIf="community.title != null">
|
||||||
<div *ngIf="item.title != null">
|
<p> {{community.title}}</p>
|
||||||
<p> {{item.title}}</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="item.title == null && item.shortTitle != null">
|
<div *ngIf="community.title == null && community.shortTitle != null">
|
||||||
<p> {{item.shortTitle}}</p>
|
<p> {{community.shortTitle}}</p>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="item.description != null">
|
<div *ngIf="community.description != null">
|
||||||
<p> {{item.description}}</p>
|
<p> {{community.description}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div *ngIf="community.queryId != null">
|
||||||
|
<p> {{community.queryId}}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
@ -24,7 +25,6 @@
|
||||||
<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">
|
||||||
|
|
||||||
<div *ngIf="publicationTotal != null">
|
<div *ngIf="publicationTotal != null">
|
||||||
<a [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/publications" ><h3 class="uk-card-title">{{publicationTotal}}</h3>
|
<a [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/publications" ><h3 class="uk-card-title">{{publicationTotal}}</h3>
|
||||||
<p>publications</p></a>
|
<p>publications</p></a>
|
||||||
|
@ -34,24 +34,29 @@
|
||||||
<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">
|
||||||
|
<div *ngIf="researchDataTotal != null">
|
||||||
<a [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/datasets"><h3 class="uk-card-title">{{researchDataTotal}}</h3>
|
<a [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/datasets"><h3 class="uk-card-title">{{researchDataTotal}}</h3>
|
||||||
<p>research data</p></a>
|
<p>research data</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">
|
||||||
|
<div *ngIf="softwareTotal != null">
|
||||||
<a [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/software"><h3 class="uk-card-title">{{softwareTotal}}</h3>
|
<a [queryParams]=params routerLinkActive="router-link-active" routerLink="/search/find/software"><h3 class="uk-card-title">{{softwareTotal}}</h3>
|
||||||
<p>software</p></a>
|
<p>software</p></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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="">
|
||||||
<div class="uk-width-expand@m uk-first-column">
|
<div class="uk-width-expand@m uk-first-column">
|
||||||
<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>
|
||||||
|
|
||||||
<results-comp [(results)]=publicationResults resultType="publication" [params]=params></results-comp>
|
<results-comp [(results)]=publicationResults resultType="publication" [params]=params></results-comp>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-width-expand@m">
|
<div class="uk-width-expand@m">
|
||||||
|
|
|
@ -36,7 +36,7 @@ export class CommunityComponent {
|
||||||
public softwareResults = null;
|
public softwareResults = null;
|
||||||
|
|
||||||
public communityId = null;
|
public communityId = null;
|
||||||
public communityInfo = null;
|
public community = null;
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
|
@ -78,10 +78,10 @@ export class CommunityComponent {
|
||||||
//console.log(communityId);
|
//console.log(communityId);
|
||||||
});
|
});
|
||||||
|
|
||||||
this._communityService.getCommunity(this.communityId,'https://dev-openaire.d4science.org/openaire/community/communities').subscribe (
|
this._communityService.getCommunity('https://dev-openaire.d4science.org/openaire/community/'+this.communityId).subscribe (
|
||||||
communityInfo => {
|
community => {
|
||||||
this.communityInfo = communityInfo;
|
this.community = community;
|
||||||
console.log(communityInfo);
|
console.log(community);
|
||||||
});
|
});
|
||||||
|
|
||||||
this._communityService.getTotal('http://beta.services.openaire.eu:8480/search/rest/v2/api/publications/count?format=json&fq=communityid='+this.communityId).subscribe(
|
this._communityService.getTotal('http://beta.services.openaire.eu:8480/search/rest/v2/api/publications/count?format=json&fq=communityid='+this.communityId).subscribe(
|
||||||
|
|
|
@ -85,49 +85,40 @@ export class CommunityService {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommunity(id:string , url: string) {
|
getCommunity(url: string) {
|
||||||
return this.http.get(url).map(res => <any> res.json()).map(res => this.searchCommunity(id,res));
|
return this.http.get(url).map(res => <any> res.json()).map(res => this.parseCommunity(res));
|
||||||
}
|
}
|
||||||
|
|
||||||
searchCommunity(id:string, data:any): CommunityInfo[] {
|
parseCommunity(data:any): CommunityInfo {
|
||||||
let community: CommunityInfo[] = [];
|
|
||||||
|
|
||||||
let notFound:boolean = true;
|
|
||||||
|
|
||||||
let length = Array.isArray(data) ? data.length :1;
|
let length = Array.isArray(data) ? data.length :1;
|
||||||
|
|
||||||
for (let i=0; i<length && notFound; i++) {
|
for (let i=0; i<length; i++) {
|
||||||
|
|
||||||
let resData = Array.isArray(data) ? data[i] : data;
|
let resData = Array.isArray(data) ? data[i] : data;
|
||||||
|
|
||||||
var result: CommunityInfo = new CommunityInfo();
|
var community: CommunityInfo = new CommunityInfo();
|
||||||
|
|
||||||
if(Array.isArray(resData) && id == resData[0].id) {
|
if(Array.isArray(resData)) {
|
||||||
|
|
||||||
notFound = false;
|
community['title'] = resData[0].name;
|
||||||
|
community['shortTitle'] = resData[0].shortName;
|
||||||
|
community['communityId'] = resData[0].id;
|
||||||
|
community['queryId'] = resData[0].queryId;
|
||||||
|
community['logoUrl'] = resData[0].logoUrl;
|
||||||
|
community['description'] = resData[0].description;
|
||||||
|
|
||||||
result['title'] = resData[0].name;
|
} else if(!Array.isArray(resData)) {
|
||||||
result['shortTitle'] = resData[0].shortName;
|
|
||||||
result['communityId'] = resData[0].id;
|
|
||||||
result['queryId'] = resData[0].queryId;
|
|
||||||
result['logoUrl'] = resData[0].logoUrl;
|
|
||||||
result['description'] = resData[0].description;
|
|
||||||
|
|
||||||
} else if(!Array.isArray(resData) && id == resData.id) {
|
community['title'] = resData.name;
|
||||||
|
community['shortTitle'] = resData.shortName;
|
||||||
notFound = false;
|
community['communityId'] = resData.id;
|
||||||
|
community['queryId'] = resData.queryId;
|
||||||
result['title'] = resData.name;
|
community['logoUrl'] = resData.logoUrl;
|
||||||
result['shortTitle'] = resData.shortName;
|
community['description'] = resData.description;
|
||||||
result['communityId'] = resData.id;
|
|
||||||
result['queryId'] = resData.queryId;
|
|
||||||
result['logoUrl'] = resData.logoUrl;
|
|
||||||
result['description'] = resData.description;
|
|
||||||
}
|
}
|
||||||
community.push(result);
|
|
||||||
}
|
}
|
||||||
return community;
|
return community;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {Component, Input} from '@angular/core';
|
import {Component, Input} from '@angular/core';
|
||||||
import { ResultInfo } from './resultInfo';
|
import { ResultInfo } from './resultInfo';
|
||||||
|
import { CommunityInfo } from '../../utils/communityInfo';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'results-comp',
|
selector: 'results-comp',
|
||||||
|
@ -66,5 +67,6 @@ export class ResultsComponent {
|
||||||
@Input() public results : ResultInfo[];
|
@Input() public results : ResultInfo[];
|
||||||
@Input() public resultType: string;
|
@Input() public resultType: string;
|
||||||
@Input() public params: any;
|
@Input() public params: any;
|
||||||
|
@Input() public community : CommunityInfo;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue