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:
argiro.kokogiannaki 2016-11-28 13:34:57 +00:00
parent 1fb51c87d1
commit d454981ea8
3 changed files with 27 additions and 31 deletions

View File

@ -167,7 +167,7 @@
</li-->
<li class="list-group-item">
<div class="text-center">
<a class="btn btn-primary" href="/deposit">
<a class="btn btn-primary" href="/deposit-publications">
Deposit Publications
</a>
</div>

View File

@ -1,4 +1,4 @@
import {Component, ViewChild, OnInit} from '@angular/core';
import {Component, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Params} from '@angular/router';
import {ProjectService} from '../../services/project.service';
@ -17,7 +17,7 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
selector: 'project',
templateUrl: 'project.component.html',
})
export class ProjectComponent implements OnInit{
export class ProjectComponent{
private projectId : string ;
@ -45,7 +45,7 @@ export class ProjectComponent implements OnInit{
private route: ActivatedRoute,
private _searchPublicationsService: SearchPublicationsService,
private _searchDatasetsService: SearchDatasetsService) {
console.info('project constructor');
console.info('project constructor.');
this.searchPublicationsComponent = new SearchPublicationsComponent(this.route, this._searchPublicationsService);
this.searchDatasetsComponent = new SearchDatasetsComponent(this.route, this._searchDatasetsService);
@ -57,38 +57,34 @@ export class ProjectComponent implements OnInit{
console.info("Id is :"+this.projectId);
if(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{
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() {
this.sub.unsubscribe();
//if(this.subPublications != undefined) {
this.subPublications.unsubscribe();
//}
if(this.subDatasets != undefined) {
this.subDatasets.unsubscribe();
}
// if(this.subPublications != undefined) {
// this.subPublications.unsubscribe();
// }
// if(this.subDatasets != undefined) {
// this.subDatasets.unsubscribe();
// }
this.subDatasetsCount.unsubscribe();
}
@ -104,9 +100,9 @@ export class ProjectComponent implements OnInit{
private searchDatasetsInit() {
if(this.subDatasets == undefined && this.searchDatasetsComponent.totalResults > 0) {
this.subDatasets = this.route.queryParams.subscribe(params => {
// this.subDatasets = this.route.queryParams.subscribe(params => {
this.searchDatasets();
});
// });
}
}

View File

@ -19,9 +19,9 @@ export class ProjectService {
let url = OpenaireProperties.getSearchAPIURL() + 'projects/'+id;
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
// if (this._cache.has(key)) {
// return Observable.of(this._cache.get(key));
// }
return this.http.get(url)
.map(res => <any> res.json())
.map(res => res['result']['metadata']['oaf:entity']['oaf:project'])