Reload tabs on click at community page
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@53477 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
68da6bf875
commit
ec84429004
|
@ -151,9 +151,9 @@
|
|||
|
||||
<ul class="uk-tab uk-margin-top" data-uk-tab="{connect: '#resultTabs'">
|
||||
<li *ngIf="IsEntityEnabled('publication')" class="uk-active"><a href="#">publications</a></li>
|
||||
<li *ngIf="IsEntityEnabled('dataset')"><a href="#">research data</a></li>
|
||||
<li *ngIf="IsEntityEnabled('software')"><a href="#">software</a></li>
|
||||
<li *ngIf="IsEntityEnabled('orp')"><a href="#">other research products</a></li>
|
||||
<li *ngIf="IsEntityEnabled('dataset')" (click)="searchResearchData()"><a href="#">research data</a></li>
|
||||
<li *ngIf="IsEntityEnabled('software')" (click)="searchSoftware()"><a href="#">software</a></li>
|
||||
<li *ngIf="IsEntityEnabled('orp')" (click)="searchOrps()"><a href="#">other research products</a></li>
|
||||
</ul>
|
||||
|
||||
<ul id="resultTabs" class="uk-switcher" style="min-height:450px;">
|
||||
|
|
|
@ -26,6 +26,7 @@ import {PiwikHelper} from '../utils/piwikHelper';
|
|||
})
|
||||
|
||||
export class CommunityComponent {
|
||||
public sub: any;
|
||||
public piwiksub: any;
|
||||
public subfunders: any;
|
||||
|
||||
|
@ -52,6 +53,12 @@ export class CommunityComponent {
|
|||
|
||||
public communityInfo = null;
|
||||
|
||||
// TODO Unsubscribe
|
||||
public subPublications;
|
||||
public subResearchData;
|
||||
public subSoftware;
|
||||
public subOrps;
|
||||
|
||||
constructor (
|
||||
private route: ActivatedRoute,
|
||||
private _router: Router,
|
||||
|
@ -114,46 +121,22 @@ 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.searchPublications();
|
||||
});
|
||||
|
||||
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.getTotal(this.properties.searchAPIURLLAst+'other/count?format=json&fq=communityid='+this.communityId).subscribe(
|
||||
orpTotal => {
|
||||
this.orpTotal = orpTotal;
|
||||
if (this.orpTotal > 0) {
|
||||
this._searchEntriesService.getResults(this.properties.searchAPIURLLAst+'other?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe(
|
||||
orpResults => {
|
||||
this.orpResults = orpResults;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this._searchEntriesService.countTotal(this.properties.communityAPI+this.communityId+'/projects').subscribe(
|
||||
|
@ -186,6 +169,43 @@ export class CommunityComponent {
|
|||
});
|
||||
}
|
||||
|
||||
public searchPublications() {
|
||||
if (this.publicationTotal > 0 && this.publicationResults == null) {
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public searchResearchData() {
|
||||
if (this.researchDataTotal > 0 && this.researchDataResults == null) {
|
||||
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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public searchSoftware() {
|
||||
if (this.softwareTotal > 0 && this.softwareResults == null) {
|
||||
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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public searchOrps() {
|
||||
if (this.orpTotal > 0 && this.orpResults == null) {
|
||||
this._searchEntriesService.getResults(this.properties.searchAPIURLLAst+'other?fq=communityid%20exact%20%22'+this.communityId+'%22&sortBy=resultdateofacceptance,descending&format=json&size=5').subscribe(
|
||||
orpResults => {
|
||||
this.orpResults = orpResults;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public ngOnDestroy() {
|
||||
if(this.piwiksub){
|
||||
this.piwiksub.unsubscribe();
|
||||
|
|
Loading…
Reference in New Issue