[Trunk|Connect]: 1. AppComponent: comment is SubscribedToCommunity. 2. SearchCommunities: Add condition if user is logged in before get subscription and managing infomation
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@55393 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
c50740f7c6
commit
4e6b258a3d
|
@ -74,7 +74,6 @@ export class AppComponent {
|
||||||
var community = null;
|
var community = null;
|
||||||
this.community = null;
|
this.community = null;
|
||||||
this.showMenu = false;
|
this.showMenu = false;
|
||||||
|
|
||||||
this._communitiesService.getCommunities(this.properties, this.properties.communitiesAPI).subscribe (
|
this._communitiesService.getCommunities(this.properties, this.properties.communitiesAPI).subscribe (
|
||||||
communities => {
|
communities => {
|
||||||
|
|
||||||
|
@ -95,7 +94,7 @@ export class AppComponent {
|
||||||
this.managerOfCommunities = true;
|
this.managerOfCommunities = true;
|
||||||
}else if(com.managers.indexOf(Session.getUserEmail())!=-1){
|
}else if(com.managers.indexOf(Session.getUserEmail())!=-1){
|
||||||
this.managerOfCommunities = true;
|
this.managerOfCommunities = true;
|
||||||
}else if(!this.subscriberOfCommunities){
|
}/*else if(!this.subscriberOfCommunities){
|
||||||
// check if subscriber
|
// check if subscriber
|
||||||
this._subscribeService.isSubscribedToCommunity(com.communityId, Session.getUserEmail(), this.properties.adminToolsAPIURL).subscribe (
|
this._subscribeService.isSubscribedToCommunity(com.communityId, Session.getUserEmail(), this.properties.adminToolsAPIURL).subscribe (
|
||||||
isSubscriber => {
|
isSubscriber => {
|
||||||
|
@ -107,7 +106,7 @@ export class AppComponent {
|
||||||
console.error("Error fetching your subscribed communities")
|
console.error("Error fetching your subscribed communities")
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -107,32 +107,40 @@ export class SearchCommunitiesComponent {
|
||||||
let observables: Observable<boolean>[] = [];
|
let observables: Observable<boolean>[] = [];
|
||||||
for(let i = 0; i < data.length; i++) {
|
for(let i = 0; i < data.length; i++) {
|
||||||
this.totalResults[i] = data[i];
|
this.totalResults[i] = data[i];
|
||||||
|
this.totalResults[i].isManager = false;
|
||||||
|
this.totalResults[i].isSubscribed = false;
|
||||||
// For Test do not delete them.
|
// For Test do not delete them.
|
||||||
//this.results[i].description = "EGI is a federated e-Infrastructure set up to provide advanced computing services for research and innovation.EGI is a federated e-Infrastructure set up to provide advanced computing services for research and innovation.EGI is a federated e-Infrastructure set up to provide advanced computing services for research and innovation."
|
//this.results[i].description = "EGI is a federated e-Infrastructure set up to provide advanced computing services for research and innovation.EGI is a federated e-Infrastructure set up to provide advanced computing services for research and innovation.EGI is a federated e-Infrastructure set up to provide advanced computing services for research and innovation."
|
||||||
//this.results[i].date = new Date(new Date(2012, 0, 1).getTime() + Math.random() * (new Date().getTime() - new Date(2012, 0, 1).getTime()));
|
//this.results[i].date = new Date(new Date(2012, 0, 1).getTime() + Math.random() * (new Date().getTime() - new Date(2012, 0, 1).getTime()));
|
||||||
let observable: Observable<boolean> = this._subscribeService.isSubscribedToCommunity(this.totalResults[i].communityId, Session.getUserEmail(), this.properties["adminToolsAPIURL"]);
|
if(Session.isLoggedIn()) {
|
||||||
observables.push(observable.pipe(catchError(err => {
|
let observable: Observable<boolean> = this._subscribeService.isSubscribedToCommunity(this.totalResults[i].communityId, Session.getUserEmail(), this.properties["adminToolsAPIURL"]);
|
||||||
return of(false);
|
observables.push(observable.pipe(catchError(err => {
|
||||||
})));
|
return of(false);
|
||||||
this.totalResults[i].isManager = this.isCommunityManager(this.totalResults[i]);
|
})));
|
||||||
|
this.totalResults[i].isManager = this.isCommunityManager(this.totalResults[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Observable.forkJoin(observables).subscribe(
|
if (observables.length > 0) {
|
||||||
res => {
|
Observable.forkJoin(observables).subscribe(
|
||||||
for(let i = 0; i < res.length; i++) {
|
res => {
|
||||||
this.totalResults[i].isSubscribed = res[i];
|
for (let i = 0; i < res.length; i++) {
|
||||||
|
this.totalResults[i].isSubscribed = res[i];
|
||||||
|
}
|
||||||
|
this._getResults(params);
|
||||||
}
|
}
|
||||||
this._getResults(params);
|
);
|
||||||
}
|
}
|
||||||
);
|
else {
|
||||||
|
this._getResults(params);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
//console.log(err);
|
|
||||||
this.handleError('Error getting communities', err);
|
this.handleError('Error getting communities', err);
|
||||||
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
||||||
this.disableForms = false;
|
this.disableForms = false;
|
||||||
this.scroll();
|
this.scroll();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue