From 6a2feeea0237b240fefee22f07bf4a402f666298 Mon Sep 17 00:00:00 2001 From: "sofia.baltzi" Date: Thu, 15 Mar 2018 16:14:49 +0000 Subject: [PATCH] Add check if communityId is null in component.ts and in html and Add error message git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@51278 d315682c-612b-4755-9ff5-7f18f6832af3 --- src/app/community/community.component.html | 6 +- src/app/community/community.component.ts | 106 +++++++++++---------- 2 files changed, 57 insertions(+), 55 deletions(-) diff --git a/src/app/community/community.component.html b/src/app/community/community.component.html index 917656d..07a018b 100644 --- a/src/app/community/community.component.html +++ b/src/app/community/community.component.html @@ -3,7 +3,7 @@
- +
Empty community id
@@ -33,7 +33,7 @@

-
+
@@ -84,7 +84,7 @@
-
+

Most recent publications diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts index 61ae540..f8aec92 100644 --- a/src/app/community/community.component.ts +++ b/src/app/community/community.component.ts @@ -75,68 +75,70 @@ export class CommunityComponent { this.communityId = communityId['communityId']; }); - this._communityService.getCommunity(this.properties.communityAPI+this.communityId).subscribe ( - community => { - this.community = community; - this.params = {community: encodeURIComponent('"'+community.queryId+'"')}; - //console.log(community); - }); + if (this.communityId != null) { + this._communityService.getCommunity(this.properties.communityAPI+this.communityId).subscribe ( + community => { + this.community = community; + this.params = {community: encodeURIComponent('"'+community.queryId+'"')}; + //console.log(community); + }); - // this._communityService.getCommunity('https://dev-openaire.d4science.org/openaire/community/'+this.communityId).subscribe ( - // community => { - // this.community = community; - // this.params = {community: encodeURIComponent('"'+community.queryId+'"')}; - // //console.log(community); - // }); + // this._communityService.getCommunity('https://dev-openaire.d4science.org/openaire/community/'+this.communityId).subscribe ( + // community => { + // this.community = community; + // this.params = {community: encodeURIComponent('"'+community.queryId+'"')}; + // //console.log(community); + // }); - this._searchEntriesService.getTotal(this.properties.searchAPIURLLAst+'publications/count?format=json&fq=communityid='+this.communityId).subscribe( - publicationTotal => { - this.publicationTotal = publicationTotal; - }); + this._searchEntriesService.getTotal(this.properties.searchAPIURLLAst+'publications/count?format=json&fq=communityid='+this.communityId).subscribe( + publicationTotal => { + this.publicationTotal = publicationTotal; + }); - this._searchEntriesService.getTotal(this.properties.searchAPIURLLAst+'datasets/count?format=json&fq=communityid='+this.communityId).subscribe( - researchDataTotal => { - this.researchDataTotal = researchDataTotal; - }); + this._searchEntriesService.getTotal(this.properties.searchAPIURLLAst+'datasets/count?format=json&fq=communityid='+this.communityId).subscribe( + researchDataTotal => { + this.researchDataTotal = researchDataTotal; + }); - this._searchEntriesService.getTotal(this.properties.searchAPIURLLAst+'software/count?format=json&fq=communityid='+this.communityId).subscribe( - softwareTotal => { - this.softwareTotal = softwareTotal; - }); + this._searchEntriesService.getTotal(this.properties.searchAPIURLLAst+'software/count?format=json&fq=communityid='+this.communityId).subscribe( + softwareTotal => { + this.softwareTotal = softwareTotal; + }); - this._searchEntriesService.countTotal(this.properties.communityAPI+this.communityId+'/projects').subscribe( - projectTotal => { - this.projectTotal = projectTotal; - //console.log(projectTotal); - }); + this._searchEntriesService.countTotal(this.properties.communityAPI+this.communityId+'/projects').subscribe( + projectTotal => { + this.projectTotal = projectTotal; + //console.log(projectTotal); + }); - this._searchEntriesService.countTotal(this.properties.communityAPI+this.communityId+'/contentproviders').subscribe( - contentProviderTotal => { - this.contentProviderTotal = contentProviderTotal; - //console.log(contentProviderTotal); - }); + this._searchEntriesService.countTotal(this.properties.communityAPI+this.communityId+'/contentproviders').subscribe( + contentProviderTotal => { + this.contentProviderTotal = contentProviderTotal; + //console.log(contentProviderTotal); + }); - // this._searchEntriesService.countTotal(this.properties.communityAPI+this.communityId+'/organizations').subscribe( - // organizationTotal => { - // this.organizationTotal = organizationTotal; - // console.log(organizationTotal); - // }); + // this._searchEntriesService.countTotal(this.properties.communityAPI+this.communityId+'/organizations').subscribe( + // organizationTotal => { + // this.organizationTotal = organizationTotal; + // 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+'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+'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; - }); + 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; + }); + } }); }