[Library|Trunk]

- update guard is community: check domain or community parameter
- remove onchanges 


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60014 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-12-02 15:26:35 +00:00
parent ff5c88b0b0
commit 605644eb16
2 changed files with 5 additions and 7 deletions

View File

@ -9,6 +9,7 @@ import {
import {Observable} from 'rxjs'; import {Observable} from 'rxjs';
import {ConnectHelper} from '../connectHelper'; import {ConnectHelper} from '../connectHelper';
import {properties} from "../../../../environments/environment";
@Injectable() @Injectable()
export class IsCommunity implements CanActivate, CanLoad { export class IsCommunity implements CanActivate, CanLoad {
@ -20,13 +21,13 @@ export class IsCommunity implements CanActivate, CanLoad {
if (community && community !== 'undefined') { if (community && community !== 'undefined') {
return true; return true;
} else { } else {
this.router.navigate(['errorcommunity']); this.router.navigate(['error']);
return false; return false;
} }
} }
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean { canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
return this.check(route.queryParams['communityId']); return this.check((route.queryParams['communityId']) ? route.queryParams['communityId'] : ConnectHelper.getCommunityFromDomain(properties.domain));
} }
canLoad(route: Route, segments: UrlSegment[]): Observable<boolean> | Promise<boolean> | boolean { canLoad(route: Route, segments: UrlSegment[]): Observable<boolean> | Promise<boolean> | boolean {

View File

@ -12,7 +12,7 @@ import {Stakeholder, StakeholderInfo} from "../../monitor/entities/stakeholder";
templateUrl: 'portal-search-result.component.html' templateUrl: 'portal-search-result.component.html'
}) })
export class PortalSearchResultComponent implements OnInit, OnChanges{ export class PortalSearchResultComponent implements OnInit{
@Input() results: (CommunityInfo & StakeholderInfo)[]; @Input() results: (CommunityInfo & StakeholderInfo)[];
@Input() status: number; @Input() status: number;
@Input() type: string; @Input() type: string;
@ -50,9 +50,6 @@ export class PortalSearchResultComponent implements OnInit, OnChanges{
}); });
} }
ngOnChanges(changes: SimpleChanges) {
console.log(changes);
}
getProductionPrefix(id:string): string { getProductionPrefix(id:string): string {
return (this.properties.environment == "production") ? "" : "beta."; return (this.properties.environment == "production") ? "" : "beta.";