Project

General

Profile

1
export class ConnectHelper{
2

    
3
  public static  getCommunityFromDomain(domain:string):string{
4
    // domain = "beta.egi.openaire.eu"; for testing
5
    if(domain.indexOf("openaire.eu") == -1){
6
      return null;
7
    }
8
    if(domain.indexOf("beta")!=-1){
9
      domain = domain.substr(domain.indexOf(".")+1,domain.length);
10
      domain = domain.substr(0,domain.indexOf("."));
11
    }else{
12
      domain = domain.substr(0,domain.indexOf("."));
13
    }
14
    if(domain == "connect" || domain == "explore"){
15
      return null;
16
    }
17
    return domain;
18
  }
19
  public static  isProduction(domain:string):boolean{
20
    if(domain.indexOf(".openaire.eu")==-1){
21
      return false;
22
    }
23
    return true;
24
  }
25
  public static  getProductionPrefix(domain:string):string{
26
    if(domain.indexOf("beta.")!=-1){
27
      return "beta.";
28
    }else{
29
      return "";
30
    }
31
  }
32
}
    (1-1/1)