2018-03-29 10:23:36 +02:00
|
|
|
export class ConnectHelper{
|
|
|
|
|
|
|
|
public static getCommunityFromDomain(domain:string):string{
|
|
|
|
// domain = "beta.egi.openaire.eu"; for testing
|
2018-06-28 16:22:58 +02:00
|
|
|
if(domain.indexOf("openaire.eu") == -1){
|
2018-03-29 10:23:36 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
if(domain.indexOf("beta")!=-1){
|
|
|
|
domain = domain.substr(domain.indexOf(".")+1,domain.length);
|
|
|
|
domain = domain.substr(0,domain.indexOf("."));
|
|
|
|
}else{
|
|
|
|
domain = domain.substr(0,domain.indexOf("."));
|
|
|
|
}
|
2018-04-25 15:30:59 +02:00
|
|
|
if(domain == "connect" || domain == "explore"){
|
2018-03-29 10:23:36 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return domain;
|
|
|
|
}
|
|
|
|
public static isProduction(domain:string):boolean{
|
2018-06-28 16:22:58 +02:00
|
|
|
if(domain.indexOf(".openaire.eu")==-1){
|
2018-03-29 10:23:36 +02:00
|
|
|
return false;
|
|
|
|
}
|
2018-06-28 16:22:58 +02:00
|
|
|
return true;
|
2018-03-29 10:23:36 +02:00
|
|
|
}
|
|
|
|
public static getProductionPrefix(domain:string):string{
|
|
|
|
if(domain.indexOf("beta.")!=-1){
|
|
|
|
return "beta.";
|
|
|
|
}else{
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|