Check if total publication, researchData or software > 0 to search for articles

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@51552 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
sofia.baltzi 2018-03-28 10:53:07 +00:00
parent e7125a71ca
commit 043828e401
3 changed files with 26 additions and 22 deletions

View File

@ -90,22 +90,22 @@
<!-- <div class="uk-width-expand@m uk-first-column"> -->
<div class="uk-width-expand@m">
<!-- <h3 class="uk-margin-small uk-h3 uk-heading-line uk-text-primary"> -->
<h3 class="uk-h3 uk-heading-line uk-text-primary">
<h2 class="uk-h3 uk-heading-line uk-text-primary">
<span>Most recent publications</span>
</h3>
<results-comp [(results)]=publicationResults resultType="publication" [community]=community [params]=params></results-comp>
</h2>
<results-comp [(results)]=publicationResults [(total)]=publicationTotal resultType="publication" [community]=community [params]=params></results-comp>
</div>
<div class="uk-width-expand@m">
<h2 class="uk-h3 uk-heading-line uk-text-primary">
<span>Most recent research data</span>
</h2>
<results-comp [(results)]=researchDataResults resultType="dataset" [community]=community [params]=params></results-comp>
<results-comp [(results)]=researchDataResults [(total)]=researchDataTotal resultType="dataset" [community]=community [params]=params></results-comp>
</div>
<div class="uk-width-expand@m">
<h2 class="uk-h3 uk-heading-line uk-text-primary">
<span>Most recent software</span>
</h2>
<results-comp [(results)]=softwareResults resultType="software" [community]=community [params]=params></results-comp>
<results-comp [(results)]=softwareResults [(total)]=softwareTotal resultType="software" [community]=community [params]=params></results-comp>
</div>
</div>
<div>

View File

@ -95,16 +95,35 @@ export class CommunityComponent {
this._searchEntriesService.getTotal(this.properties.searchAPIURLLAst+'publications/count?format=json&fq=communityid='+this.communityId).subscribe(
publicationTotal => {
this.publicationTotal = publicationTotal;
if (this.publicationTotal > 0) {
this._searchEntriesService.getResults(this.properties.searchAPIURLLAst+'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.getTotal(this.properties.searchAPIURLLAst+'datasets/count?format=json&fq=communityid='+this.communityId).subscribe(
researchDataTotal => {
this.researchDataTotal = researchDataTotal;
if (this.researchDataTotal > 0) {
this._searchEntriesService.getResults(this.properties.searchAPIURLLAst+'datasets?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe(
researchDataResults => {
this.researchDataResults = researchDataResults;
});
}
});
this._searchEntriesService.getTotal(this.properties.searchAPIURLLAst+'software/count?format=json&fq=communityid='+this.communityId).subscribe(
softwareTotal => {
this.softwareTotal = softwareTotal;
if (this.softwareTotal > 0) {
this._searchEntriesService.getResults(this.properties.searchAPIURLLAst+'software?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe(
softwareResults => {
this.softwareResults = softwareResults;
});
}
});
this._searchEntriesService.countTotal(this.properties.communityAPI+this.communityId+'/projects').subscribe(
@ -125,21 +144,6 @@ export class CommunityComponent {
// console.log(organizationTotal);
// });
this._searchEntriesService.getResults(this.properties.searchAPIURLLAst+'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(this.properties.searchAPIURLLAst+'datasets?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe(
researchDataResults => {
this.researchDataResults = researchDataResults;
});
this._searchEntriesService.getResults(this.properties.searchAPIURLLAst+'software?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe(
softwareResults => {
this.softwareResults = softwareResults;
});
}
});
}

View File

@ -41,8 +41,7 @@ import { CommunityInfo } from '../../openaireLibrary/connect/community/community
</div>
</div>
<div *ngIf="results != null && results.length == 0" class=" uk-alert uk-alert-primary"> No results found </div>
<div *ngIf="results != null && results.length == 0 || total == 0" class=" uk-alert uk-alert-primary"> No results found </div>
<hr>
<div *ngIf="results != null && results.length > 0">
@ -73,4 +72,5 @@ export class ResultsComponent {
@Input() public resultType: string;
@Input() public params: any;
@Input() public community: CommunityInfo;
@Input() public total: any;
}