Remove dev condition for relatedTo component

This commit is contained in:
Alex Martzios 2021-11-24 16:52:58 +02:00
parent de6c91cbab
commit 130691b60a
1 changed files with 41 additions and 43 deletions

View File

@ -11,7 +11,7 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class";
@Component({ @Component({
selector: 'relatedTo', selector: 'relatedTo',
template: ` template: `
<div class="sideInfoTitle"> <div *ngIf="(gateways && gateways.length > 0) || (otherCommunities && otherCommunities.length > 0)" class="sideInfoTitle">
<span>Communities</span> <span>Communities</span>
</div> </div>
<!-- If there are any communities with dashboard --> <!-- If there are any communities with dashboard -->
@ -169,52 +169,50 @@ export class RelatedToComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.contexts.sort(this.compare); this.contexts.sort(this.compare);
if(properties.environment === "development") { let index = 0;
let index = 0; this.contexts.forEach( context => {
this.contexts.forEach( context => { if(context.idContext) {
if(context.idContext) { this.subscriptions.push(
this.subscriptions.push( this.userManagementService.getUserInfo().subscribe( user => {
this.userManagementService.getUserInfo().subscribe( user => { //- handling subscribe errors?
//- handling subscribe errors? this.subscriptions.push(
this.subscriptions.push( this.communityService.getCommunity(context.idContext).subscribe( community => {
this.communityService.getCommunity(context.idContext).subscribe( community => { if(community && !ConnectHelper.isPrivate(community,user) && (this.currentCommunity != context.idContext)) {
if(community && !ConnectHelper.isPrivate(community,user) && (this.currentCommunity != context.idContext)) { // creating the link, based on the enviroment
// creating the link, based on the enviroment let url = '';
let url = ''; if(properties.environment == "beta") {
if(properties.environment == "beta") { url = 'https://beta.' + context.idContext + '.openaire.eu';
url = 'https://beta.' + context.idContext + '.openaire.eu';
} else {
url = 'https://' + context.idContext + '.openaire.eu';
}
context.link = url;
for(let gateway of this.gateways) {
if(gateway.link == context.link) {
return; // skips so that we don't get duplicate gateways
}
}
this.gateways.push(context);
} else { } else {
if(this.currentCommunity != context.idContext) { url = 'https://' + context.idContext + '.openaire.eu';
for(let other of this.otherCommunities) { }
if(other.idContext == context.idContext) { context.link = url;
return; // skips so that we don't get duplicate communities because of the multiple concepts for(let gateway of this.gateways) {
} if(gateway.link == context.link) {
return; // skips so that we don't get duplicate gateways
}
}
this.gateways.push(context);
} else {
if(this.currentCommunity != context.idContext) {
for(let other of this.otherCommunities) {
if(other.idContext == context.idContext) {
return; // skips so that we don't get duplicate communities because of the multiple concepts
} }
} }
this.otherCommunities.push(context);
} }
index++; this.otherCommunities.push(context);
if(index == this.contexts.length) { }
this.gateways.sort(this.compare); index++;
this.otherCommunities.sort(this.compare); if(index == this.contexts.length) {
} this.gateways.sort(this.compare);
}) this.otherCommunities.sort(this.compare);
); }
}) })
); );
} })
}); );
} }
});
} }
ngOnDestroy() { ngOnDestroy() {