fixing params promise | disable cache for project main info
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44684 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
1fb51c87d1
commit
d454981ea8
|
@ -167,7 +167,7 @@
|
||||||
</li-->
|
</li-->
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<a class="btn btn-primary" href="/deposit">
|
<a class="btn btn-primary" href="/deposit-publications">
|
||||||
Deposit Publications
|
Deposit Publications
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Component, ViewChild, OnInit} from '@angular/core';
|
import {Component, ViewChild} from '@angular/core';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable} from 'rxjs/Observable';
|
||||||
import {ActivatedRoute, Params} from '@angular/router';
|
import {ActivatedRoute, Params} from '@angular/router';
|
||||||
import {ProjectService} from '../../services/project.service';
|
import {ProjectService} from '../../services/project.service';
|
||||||
|
@ -17,7 +17,7 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
||||||
selector: 'project',
|
selector: 'project',
|
||||||
templateUrl: 'project.component.html',
|
templateUrl: 'project.component.html',
|
||||||
})
|
})
|
||||||
export class ProjectComponent implements OnInit{
|
export class ProjectComponent{
|
||||||
|
|
||||||
|
|
||||||
private projectId : string ;
|
private projectId : string ;
|
||||||
|
@ -45,7 +45,7 @@ export class ProjectComponent implements OnInit{
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private _searchPublicationsService: SearchPublicationsService,
|
private _searchPublicationsService: SearchPublicationsService,
|
||||||
private _searchDatasetsService: SearchDatasetsService) {
|
private _searchDatasetsService: SearchDatasetsService) {
|
||||||
console.info('project constructor');
|
console.info('project constructor.');
|
||||||
|
|
||||||
this.searchPublicationsComponent = new SearchPublicationsComponent(this.route, this._searchPublicationsService);
|
this.searchPublicationsComponent = new SearchPublicationsComponent(this.route, this._searchPublicationsService);
|
||||||
this.searchDatasetsComponent = new SearchDatasetsComponent(this.route, this._searchDatasetsService);
|
this.searchDatasetsComponent = new SearchDatasetsComponent(this.route, this._searchDatasetsService);
|
||||||
|
@ -57,38 +57,34 @@ export class ProjectComponent implements OnInit{
|
||||||
console.info("Id is :"+this.projectId);
|
console.info("Id is :"+this.projectId);
|
||||||
if(this.projectId){
|
if(this.projectId){
|
||||||
this.getProjectInfo(this.projectId);
|
this.getProjectInfo(this.projectId);
|
||||||
|
// this.subPublications = this.route.queryParams.subscribe(params => {
|
||||||
|
this.searchPublications();
|
||||||
|
// });
|
||||||
|
|
||||||
|
this.subDatasetsCount = this._searchDatasetsService.numOfEntityDatasets(this.projectId, "projects/").subscribe(
|
||||||
|
data => {
|
||||||
|
this.searchDatasetsComponent.totalResults = data;
|
||||||
|
},
|
||||||
|
err => {
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
}else{
|
}else{
|
||||||
this.warningMessage="No valid project id";
|
this.warningMessage="No valid project id";
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.subPublications = this.route.queryParams.subscribe(params => {
|
|
||||||
this.searchPublications();
|
|
||||||
});
|
|
||||||
|
|
||||||
this.subDatasetsCount = this.route.queryParams.subscribe(params => {
|
|
||||||
this._searchDatasetsService.numOfEntityDatasets(this.projectId, "projects/").subscribe(
|
|
||||||
data => {
|
|
||||||
this.searchDatasetsComponent.totalResults = data;
|
|
||||||
},
|
|
||||||
err => {
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.sub.unsubscribe();
|
this.sub.unsubscribe();
|
||||||
//if(this.subPublications != undefined) {
|
// if(this.subPublications != undefined) {
|
||||||
this.subPublications.unsubscribe();
|
// this.subPublications.unsubscribe();
|
||||||
//}
|
// }
|
||||||
if(this.subDatasets != undefined) {
|
// if(this.subDatasets != undefined) {
|
||||||
this.subDatasets.unsubscribe();
|
// this.subDatasets.unsubscribe();
|
||||||
}
|
// }
|
||||||
this.subDatasetsCount.unsubscribe();
|
this.subDatasetsCount.unsubscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,9 +100,9 @@ export class ProjectComponent implements OnInit{
|
||||||
|
|
||||||
private searchDatasetsInit() {
|
private searchDatasetsInit() {
|
||||||
if(this.subDatasets == undefined && this.searchDatasetsComponent.totalResults > 0) {
|
if(this.subDatasets == undefined && this.searchDatasetsComponent.totalResults > 0) {
|
||||||
this.subDatasets = this.route.queryParams.subscribe(params => {
|
// this.subDatasets = this.route.queryParams.subscribe(params => {
|
||||||
this.searchDatasets();
|
this.searchDatasets();
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,9 @@ export class ProjectService {
|
||||||
|
|
||||||
let url = OpenaireProperties.getSearchAPIURL() + 'projects/'+id;
|
let url = OpenaireProperties.getSearchAPIURL() + 'projects/'+id;
|
||||||
let key = url;
|
let key = url;
|
||||||
if (this._cache.has(key)) {
|
// if (this._cache.has(key)) {
|
||||||
return Observable.of(this._cache.get(key));
|
// return Observable.of(this._cache.get(key));
|
||||||
}
|
// }
|
||||||
return this.http.get(url)
|
return this.http.get(url)
|
||||||
.map(res => <any> res.json())
|
.map(res => <any> res.json())
|
||||||
.map(res => res['result']['metadata']['oaf:entity']['oaf:project'])
|
.map(res => res['result']['metadata']['oaf:entity']['oaf:project'])
|
||||||
|
|
Loading…
Reference in New Issue