Merge remote-tracking branch 'origin/develop' into stats-profile
This commit is contained in:
commit
4e91d169e0
|
@ -1,86 +1,102 @@
|
||||||
import {properties} from "../../../../environments/environment";
|
import {properties} from "../../../../environments/environment";
|
||||||
|
|
||||||
export class Layout {
|
export class Layout {
|
||||||
_id:string;
|
_id: string;
|
||||||
portalPid:string;
|
portalPid: string;
|
||||||
layoutOptions:CustomizationOptions;
|
layoutOptions: CustomizationOptions;
|
||||||
date;
|
date;
|
||||||
constructor(community, options:CustomizationOptions){
|
|
||||||
|
constructor(community, options: CustomizationOptions) {
|
||||||
this.portalPid = community;
|
this.portalPid = community;
|
||||||
this.layoutOptions = options;
|
this.layoutOptions = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getVariables(options: CustomizationOptions): {} | null {
|
public static getVariables(options: CustomizationOptions): {} | null {
|
||||||
if(options) {
|
if (options) {
|
||||||
let variables = {};
|
let variables = {};
|
||||||
if(options.identity) {
|
if (options.identity) {
|
||||||
variables['@global-primary-background'] = options.identity.mainColor;
|
variables['@global-primary-background'] = Layout.convertRGBAtoRGB(options.identity.mainColor);
|
||||||
variables['@global-secondary-background'] = options.identity.secondaryColor;
|
variables['@global-secondary-background'] = Layout.convertRGBAtoRGB(options.identity.secondaryColor);
|
||||||
}
|
}
|
||||||
if(options.backgrounds){
|
if (options.backgrounds) {
|
||||||
variables['@general-search-form-background'] = options.backgrounds.form.color;
|
variables['@general-search-form-background'] = Layout.convertRGBAtoRGB(options.backgrounds.form.color);
|
||||||
variables['@base-body-background'] = options.backgrounds.light.color;
|
variables['@global-background'] = Layout.convertRGBAtoRGB(options.backgrounds.light.color);
|
||||||
variables['@hero-background-image'] = (options.backgrounds.form.imageFile?(this.getUrl(properties.utilsService + '/download/' +options.backgrounds.form.imageFile)): 'none') ;
|
variables['@hero-background-image'] = (options.backgrounds.form.imageFile ? (this.getUrl(properties.utilsService + '/download/' + options.backgrounds.form.imageFile)) : 'none');
|
||||||
variables['@hero-background-position'] = options.backgrounds.form.position;
|
variables['@hero-background-position'] = options.backgrounds.form.position;
|
||||||
}
|
}
|
||||||
if(options.buttons){
|
if (options.buttons) {
|
||||||
//general
|
//general
|
||||||
variables['@button-border-width'] = options.buttons.lightBackground.borderWidth + "px";
|
variables['@button-border-width'] = options.buttons.lightBackground.borderWidth + "px";
|
||||||
variables['@button-border-radius'] = options.buttons.lightBackground.borderRadius + "px";
|
variables['@button-border-radius'] = options.buttons.lightBackground.borderRadius + "px";
|
||||||
// default -> on dark background todo check again when we have sucj=h buttons
|
// default -> on dark background todo check again when we have sucj=h buttons
|
||||||
variables['@button-default-background'] = options.buttons.darkBackground.backgroundColor;
|
variables['@button-default-background'] = Layout.convertRGBAtoRGB(options.buttons.darkBackground.backgroundColor);
|
||||||
variables['@button-default-color'] = options.buttons.darkBackground.color;
|
variables['@button-default-color'] = Layout.convertRGBAtoRGB(options.buttons.darkBackground.color);
|
||||||
variables['@button-default-border'] = options.buttons.darkBackground.borderColor;
|
variables['@button-default-border'] = Layout.convertRGBAtoRGB(options.buttons.darkBackground.borderColor);
|
||||||
variables['@button-default-hover-background'] = options.buttons.darkBackground.onHover.backgroundColor;
|
variables['@button-default-hover-background'] = Layout.convertRGBAtoRGB(options.buttons.darkBackground.onHover.backgroundColor);
|
||||||
variables['@button-default-hover-color'] = options.buttons.darkBackground.onHover.color;
|
variables['@button-default-hover-color'] = Layout.convertRGBAtoRGB(options.buttons.darkBackground.onHover.color);
|
||||||
variables['@button-default-hover-border'] = options.buttons.darkBackground.onHover.borderColor;
|
variables['@button-default-hover-border'] = Layout.convertRGBAtoRGB(options.buttons.darkBackground.onHover.borderColor);
|
||||||
variables['@button-default-active-background'] = options.buttons.darkBackground.onHover.backgroundColor;
|
variables['@button-default-active-background'] = Layout.convertRGBAtoRGB(options.buttons.darkBackground.onHover.backgroundColor);
|
||||||
variables['@button-default-active-color'] = options.buttons.darkBackground.onHover.color;
|
variables['@button-default-active-color'] = Layout.convertRGBAtoRGB(options.buttons.darkBackground.onHover.color);
|
||||||
variables['@button-default-active-border'] = options.buttons.darkBackground.onHover.borderColor;
|
variables['@button-default-active-border'] = Layout.convertRGBAtoRGB(options.buttons.darkBackground.onHover.borderColor);
|
||||||
|
|
||||||
// primary
|
// primary
|
||||||
variables['@button-primary-background'] = options.buttons.lightBackground.backgroundColor;
|
variables['@button-primary-background'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.backgroundColor);
|
||||||
variables['@button-primary-color'] = options.buttons.lightBackground.color;
|
variables['@button-primary-color'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.color);
|
||||||
variables['@button-primary-border'] = options.buttons.lightBackground.borderColor;
|
variables['@button-primary-border'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.borderColor);
|
||||||
variables['@button-primary-hover-background'] = options.buttons.lightBackground.onHover.backgroundColor;
|
variables['@button-primary-hover-background'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.onHover.backgroundColor);
|
||||||
variables['@button-primary-hover-color'] = options.buttons.lightBackground.onHover.color;
|
variables['@button-primary-hover-color'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.onHover.color);
|
||||||
variables['@button-primary-hover-border'] = options.buttons.lightBackground.onHover.borderColor;
|
variables['@button-primary-hover-border'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.onHover.borderColor);
|
||||||
variables['@button-primary-active-background'] = options.buttons.lightBackground.onHover.backgroundColor;
|
variables['@button-primary-active-background'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.onHover.backgroundColor);
|
||||||
variables['@button-primary-active-color'] = options.buttons.lightBackground.onHover.color;
|
variables['@button-primary-active-color'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.onHover.color);
|
||||||
variables['@button-primary-active-border'] = options.buttons.lightBackground.onHover.borderColor;
|
variables['@button-primary-active-border'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.onHover.borderColor);
|
||||||
|
|
||||||
// secondary
|
// secondary
|
||||||
variables['@button-secondary-background'] = options.buttons.lightBackground.color;
|
variables['@button-secondary-background'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.color);
|
||||||
variables['@button-secondary-color'] = options.buttons.lightBackground.backgroundColor;
|
variables['@button-secondary-color'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.backgroundColor);
|
||||||
variables['@button-secondary-border'] = options.buttons.lightBackground.backgroundColor;
|
variables['@button-secondary-border'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.backgroundColor);
|
||||||
variables['@button-secondary-hover-background'] = options.buttons.lightBackground.backgroundColor;
|
variables['@button-secondary-hover-background'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.backgroundColor);
|
||||||
variables['@button-secondary-hover-color'] = options.buttons.lightBackground.color;
|
variables['@button-secondary-hover-color'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.color);
|
||||||
variables['@button-secondary-hover-border'] = options.buttons.lightBackground.borderColor;
|
variables['@button-secondary-hover-border'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.borderColor);
|
||||||
variables['@button-secondary-active-background'] = options.buttons.lightBackground.backgroundColor;
|
variables['@button-secondary-active-background'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.backgroundColor);
|
||||||
variables['@button-secondary-active-color'] = options.buttons.lightBackground.color;
|
variables['@button-secondary-active-color'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.color);
|
||||||
variables['@button-secondary-active-border'] = options.buttons.lightBackground.borderColor;
|
variables['@button-secondary-active-border'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.borderColor);
|
||||||
|
|
||||||
}
|
}
|
||||||
return variables;
|
return variables;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public static getUrl(url){
|
|
||||||
|
public static getUrl(url) {
|
||||||
return 'url("' + url + '")';
|
return 'url("' + url + '")';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static convertRGBAtoRGB(color: string): string {
|
||||||
|
if(color.includes('rgba')) {
|
||||||
|
const regexPattern = /rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/;
|
||||||
|
const matches = color.match(regexPattern);
|
||||||
|
const [, r, g, b, a] = matches;
|
||||||
|
let R = parseInt(r)*parseFloat(a) + (1 - parseFloat(a))*255;
|
||||||
|
let G = parseInt(g)*parseFloat(a) + (1 - parseFloat(a))*255;
|
||||||
|
let B = parseInt(b)*parseFloat(a) + (1 - parseFloat(a))*255;
|
||||||
|
return 'rgb(' + R + ',' + G + ',' + B + ',' + ')';
|
||||||
|
} else {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CustomizationOptions {
|
export class CustomizationOptions {
|
||||||
identity: {
|
identity: {
|
||||||
mainColor: string;
|
mainColor: string;
|
||||||
secondaryColor: string;
|
secondaryColor: string;
|
||||||
};
|
};
|
||||||
identityIsCustom:boolean;
|
identityIsCustom: boolean;
|
||||||
backgroundsIsCustom:boolean;
|
backgroundsIsCustom: boolean;
|
||||||
buttonsIsCustom:boolean;
|
buttonsIsCustom: boolean;
|
||||||
backgrounds: {
|
backgrounds: {
|
||||||
dark: {
|
dark: {
|
||||||
color: string; //background
|
color: string; //background
|
||||||
}
|
}
|
||||||
light: {
|
light: {
|
||||||
color: string; //background
|
color: string; //background
|
||||||
|
@ -89,7 +105,7 @@ export class CustomizationOptions {
|
||||||
color: string; //background
|
color: string; //background
|
||||||
imageUrl: string;
|
imageUrl: string;
|
||||||
imageFile: string;
|
imageFile: string;
|
||||||
position:string;
|
position: string;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
buttons: {
|
buttons: {
|
||||||
|
@ -98,24 +114,24 @@ export class CustomizationOptions {
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(mainColor: string = null, secondaryColor: string = null) {
|
constructor(mainColor: string = null, secondaryColor: string = null) {
|
||||||
this.identity= {
|
this.identity = {
|
||||||
mainColor: mainColor ? mainColor : CustomizationOptions.getIdentity().mainColor,
|
mainColor: mainColor ? mainColor : CustomizationOptions.getIdentity().mainColor,
|
||||||
secondaryColor : secondaryColor ? secondaryColor : CustomizationOptions.getIdentity().secondaryColor,
|
secondaryColor: secondaryColor ? secondaryColor : CustomizationOptions.getIdentity().secondaryColor,
|
||||||
};
|
};
|
||||||
this.identityIsCustom = false;
|
this.identityIsCustom = false;
|
||||||
this.backgroundsIsCustom = false;
|
this.backgroundsIsCustom = false;
|
||||||
this.buttonsIsCustom = false;
|
this.buttonsIsCustom = false;
|
||||||
this.backgrounds={
|
this.backgrounds = {
|
||||||
dark : {
|
dark: {
|
||||||
color: this.identity.mainColor,
|
color: this.identity.mainColor,
|
||||||
},
|
},
|
||||||
light : {
|
light: {
|
||||||
color: "#f9f9f9" //CustomizationOptions.getRGBA(this.identity.mainColor,0.05),
|
color: "#f9f9f9" //CustomizationOptions.getRGBA(this.identity.mainColor,0.05),
|
||||||
},
|
},
|
||||||
form : {
|
form: {
|
||||||
color: CustomizationOptions.getRGBA(this.identity.mainColor,0.15),
|
color: CustomizationOptions.getRGBA(this.identity.mainColor, 0.15),
|
||||||
imageUrl : null,
|
imageUrl: null,
|
||||||
imageFile : null,
|
imageFile: null,
|
||||||
position: null
|
position: null
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -123,7 +139,7 @@ export class CustomizationOptions {
|
||||||
|
|
||||||
this.buttons = {
|
this.buttons = {
|
||||||
darkBackground: {
|
darkBackground: {
|
||||||
isDefault:true,
|
isDefault: true,
|
||||||
backgroundColor: "#ffffff",
|
backgroundColor: "#ffffff",
|
||||||
color: "#000000",
|
color: "#000000",
|
||||||
borderStyle: "solid",
|
borderStyle: "solid",
|
||||||
|
@ -137,7 +153,7 @@ export class CustomizationOptions {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
lightBackground: {
|
lightBackground: {
|
||||||
isDefault:true,
|
isDefault: true,
|
||||||
backgroundColor: this.identity.mainColor,
|
backgroundColor: this.identity.mainColor,
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
borderStyle: "solid",
|
borderStyle: "solid",
|
||||||
|
@ -153,12 +169,13 @@ export class CustomizationOptions {
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public static checkForObsoleteVersion(current:CustomizationOptions, communityId:string){
|
|
||||||
let defaultCO = new CustomizationOptions(CustomizationOptions.getIdentity(communityId).mainColor,CustomizationOptions.getIdentity(communityId).secondaryColor);
|
public static checkForObsoleteVersion(current: CustomizationOptions, communityId: string) {
|
||||||
|
let defaultCO = new CustomizationOptions(CustomizationOptions.getIdentity(communityId).mainColor, CustomizationOptions.getIdentity(communityId).secondaryColor);
|
||||||
let updated = Object.assign({}, defaultCO);
|
let updated = Object.assign({}, defaultCO);
|
||||||
if(!current){
|
if (!current) {
|
||||||
current = Object.assign({}, defaultCO);
|
current = Object.assign({}, defaultCO);
|
||||||
}else {
|
} else {
|
||||||
if (current.identity && current.identity.mainColor && current.identity.secondaryColor) {
|
if (current.identity && current.identity.mainColor && current.identity.secondaryColor) {
|
||||||
updated = new CustomizationOptions(current.identity.mainColor, current.identity.secondaryColor);
|
updated = new CustomizationOptions(current.identity.mainColor, current.identity.secondaryColor);
|
||||||
}
|
}
|
||||||
|
@ -198,39 +215,41 @@ export class CustomizationOptions {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public static getIdentity(community:string=null){
|
|
||||||
let COLORS= {
|
public static getIdentity(community: string = null) {
|
||||||
default:{
|
let COLORS = {
|
||||||
mainColor:'#4687E6',
|
default: {
|
||||||
|
mainColor: '#4687E6',
|
||||||
secondaryColor: '#2D72D6'
|
secondaryColor: '#2D72D6'
|
||||||
},
|
},
|
||||||
"covid-19":{
|
"covid-19": {
|
||||||
mainColor:"#03ADEE",
|
mainColor: "#03ADEE",
|
||||||
secondaryColor: "#F15157"
|
secondaryColor: "#F15157"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if(community && COLORS[community]){
|
if (community && COLORS[community]) {
|
||||||
return COLORS[community];
|
return COLORS[community];
|
||||||
}
|
}
|
||||||
return COLORS.default;
|
return COLORS.default;
|
||||||
}
|
}
|
||||||
public static getRGBA(color, A){
|
|
||||||
if(color.indexOf("#")!=-1){
|
public static getRGBA(color, A) {
|
||||||
return 'rgba('+parseInt(color.substring(1,3),16)+','+parseInt(color.substring(3,5),16)+','+parseInt(color.substring(5,7),16)+','+A+')';
|
if (color.indexOf("#") != -1) {
|
||||||
|
return 'rgba(' + parseInt(color.substring(1, 3), 16) + ',' + parseInt(color.substring(3, 5), 16) + ',' + parseInt(color.substring(5, 7), 16) + ',' + A + ')';
|
||||||
}
|
}
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static isForLightBackground(color:string){
|
public static isForLightBackground(color: string) {
|
||||||
let L, r, g, b, a = 1;
|
let L, r, g, b, a = 1;
|
||||||
if(color.length == 7 || color.length == 9) {
|
if (color.length == 7 || color.length == 9) {
|
||||||
r = parseInt(color.substring(1, 3), 16);
|
r = parseInt(color.substring(1, 3), 16);
|
||||||
g = parseInt(color.substring(3, 5), 16);
|
g = parseInt(color.substring(3, 5), 16);
|
||||||
b = parseInt(color.substring(5, 7), 16);
|
b = parseInt(color.substring(5, 7), 16);
|
||||||
if(color.length == 9) {
|
if (color.length == 9) {
|
||||||
a = parseInt(color.substring(7, 9), 16);
|
a = parseInt(color.substring(7, 9), 16);
|
||||||
}
|
}
|
||||||
}else if(color.length > 9){
|
} else if (color.length > 9) {
|
||||||
let array = color.split("rgba(")[1].split(")")[0].split(",");
|
let array = color.split("rgba(")[1].split(")")[0].split(",");
|
||||||
r = parseInt(array[0]);
|
r = parseInt(array[0]);
|
||||||
g = parseInt(array[1]);
|
g = parseInt(array[1]);
|
||||||
|
@ -238,7 +257,7 @@ export class CustomizationOptions {
|
||||||
a = +array[3];
|
a = +array[3];
|
||||||
|
|
||||||
}
|
}
|
||||||
const brightness = r* 0.299 + g * 0.587 + b * 0.114 + (1 - a) * 255;
|
const brightness = r * 0.299 + g * 0.587 + b * 0.114 + (1 - a) * 255;
|
||||||
|
|
||||||
return (brightness < 186)
|
return (brightness < 186)
|
||||||
|
|
||||||
|
@ -258,8 +277,9 @@ export class CustomizationOptions {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
export class ButtonsCustomization{
|
|
||||||
isDefault:boolean;
|
export class ButtonsCustomization {
|
||||||
|
isDefault: boolean;
|
||||||
backgroundColor: string;
|
backgroundColor: string;
|
||||||
color: string;
|
color: string;
|
||||||
borderStyle: string;
|
borderStyle: string;
|
||||||
|
|
|
@ -35,8 +35,11 @@ export class HttpInterceptorService implements HttpInterceptor {
|
||||||
return of(response);
|
return of(response);
|
||||||
} else {
|
} else {
|
||||||
if (isPlatformServer(this.platformId)) {
|
if (isPlatformServer(this.platformId)) {
|
||||||
|
if(request.url.startsWith('/assets') || request.url.startsWith('assets')) {
|
||||||
|
return of(null);
|
||||||
|
}
|
||||||
let headers = new HttpHeaders();
|
let headers = new HttpHeaders();
|
||||||
if(request.withCredentials) {
|
if(request.withCredentials && !properties.hasMachineCache) {
|
||||||
headers = headers.set('Cookie', this.req.get('Cookie'));
|
headers = headers.set('Cookie', this.req.get('Cookie'));
|
||||||
}
|
}
|
||||||
const authReq = request.clone({
|
const authReq = request.clone({
|
||||||
|
|
|
@ -186,8 +186,8 @@ export class DataProviderComponent {
|
||||||
this.stickyHeader = false;
|
this.stickyHeader = false;
|
||||||
this.updateDescription("");
|
this.updateDescription("");
|
||||||
|
|
||||||
if(data["pv"]) {
|
if(data["return_path"]) {
|
||||||
this.prevPath = data["pv"];
|
this.prevPath = data["return_path"] + (data["search_params"] ? ("?"+data["search_params"]) : "");
|
||||||
}
|
}
|
||||||
if((typeof document !== 'undefined') && document.referrer) {
|
if((typeof document !== 'undefined') && document.referrer) {
|
||||||
this.referrer = document.referrer;
|
this.referrer = document.referrer;
|
||||||
|
@ -845,7 +845,11 @@ export class DataProviderComponent {
|
||||||
|
|
||||||
public addEoscPrevInParams(obj) {
|
public addEoscPrevInParams(obj) {
|
||||||
if(properties.adminToolsPortalType == "eosc" && this.prevPath) {
|
if(properties.adminToolsPortalType == "eosc" && this.prevPath) {
|
||||||
return this.routerHelper.addQueryParam("pv", this.prevPath, obj);
|
let splitted: string[] = this.prevPath.split("?");
|
||||||
|
obj = this.routerHelper.addQueryParam("return_path", splitted[0], obj);
|
||||||
|
if(splitted.length > 0) {
|
||||||
|
obj = this.routerHelper.addQueryParam("search_params", splitted[1], obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,11 @@ export class RelatedDatasourcesTabComponent {
|
||||||
|
|
||||||
public addEoscPrevInParams(obj) {
|
public addEoscPrevInParams(obj) {
|
||||||
if(properties.adminToolsPortalType == "eosc" && this.prevPath) {
|
if(properties.adminToolsPortalType == "eosc" && this.prevPath) {
|
||||||
return this.routerHelper.addQueryParam("pv", this.prevPath, obj);
|
let splitted: string[] = this.prevPath.split("?");
|
||||||
|
obj = this.routerHelper.addQueryParam("return_path", splitted[0], obj);
|
||||||
|
if(splitted.length > 0) {
|
||||||
|
obj = this.routerHelper.addQueryParam("search_params", splitted[1], obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,11 @@ export class AvailableOnComponent {
|
||||||
|
|
||||||
public addEoscPrevInParams(obj) {
|
public addEoscPrevInParams(obj) {
|
||||||
if(properties.adminToolsPortalType == "eosc" && this.prevPath) {
|
if(properties.adminToolsPortalType == "eosc" && this.prevPath) {
|
||||||
return this.routerHelper.addQueryParam("pv", this.prevPath, obj);
|
let splitted: string[] = this.prevPath.split("?");
|
||||||
|
obj = this.routerHelper.addQueryParam("return_path", splitted[0], obj);
|
||||||
|
if(splitted.length > 0) {
|
||||||
|
obj = this.routerHelper.addQueryParam("search_params", splitted[1], obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,11 @@ export class FundedByComponent {
|
||||||
|
|
||||||
public addEoscPrevInParams(obj) {
|
public addEoscPrevInParams(obj) {
|
||||||
if(properties.adminToolsPortalType == "eosc" && this.prevPath) {
|
if(properties.adminToolsPortalType == "eosc" && this.prevPath) {
|
||||||
return this.routerHelper.addQueryParam("pv", this.prevPath, obj);
|
let splitted: string[] = this.prevPath.split("?");
|
||||||
|
obj = this.routerHelper.addQueryParam("return_path", splitted[0], obj);
|
||||||
|
if(splitted.length > 0) {
|
||||||
|
obj = this.routerHelper.addQueryParam("search_params", splitted[1], obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import {EnvProperties} from '../../../utils/properties/env-properties';
|
||||||
import {ClickEvent} from "../../../utils/click/click-outside-or-esc.directive";
|
import {ClickEvent} from "../../../utils/click/click-outside-or-esc.directive";
|
||||||
import {NumberUtils} from "../../../utils/number-utils.class";
|
import {NumberUtils} from "../../../utils/number-utils.class";
|
||||||
import {OpenaireEntities} from "../../../utils/properties/searchFields";
|
import {OpenaireEntities} from "../../../utils/properties/searchFields";
|
||||||
|
import {StringUtils} from "../../../utils/string-utils.class";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'metrics',
|
selector: 'metrics',
|
||||||
|
@ -77,7 +78,7 @@ import {OpenaireEntities} from "../../../utils/properties/searchFields";
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr *ngFor="let key of getKeys(metrics.infos)">
|
<tr *ngFor="let key of getKeys(metrics.infos)">
|
||||||
<td class="uk-width-1-3 uk-text-center uk-text-truncate" uk-tooltip [title]="metrics.infos.get(key).name">
|
<td class="uk-width-1-3 uk-text-center uk-text-truncate" uk-tooltip [title]="metrics.infos.get(key).name">
|
||||||
<a [href]="metrics.infos.get(key).url + (prevPath ? ('&pv='+prevPath) : '')">
|
<a [href]="metrics.infos.get(key).url + getEoscParams()">
|
||||||
{{metrics.infos.get(key).name}}
|
{{metrics.infos.get(key).name}}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
@ -313,4 +314,16 @@ export class MetricsComponent {
|
||||||
let formatted = NumberUtils.roundNumber(+num);
|
let formatted = NumberUtils.roundNumber(+num);
|
||||||
return formatted.number + formatted.size;
|
return formatted.number + formatted.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getEoscParams() {
|
||||||
|
let params = "";
|
||||||
|
if(this.prevPath) {
|
||||||
|
let splitted: string[] = this.prevPath.split("?");
|
||||||
|
params = "&return_path="+StringUtils.URIEncode(splitted[0]);
|
||||||
|
if(splitted.length > 0) {
|
||||||
|
params += "&search_params="+StringUtils.URIEncode(splitted[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,11 @@ import {StringUtils} from "../../utils/string-utils.class";
|
||||||
})
|
})
|
||||||
export class ParsingFunctions {
|
export class ParsingFunctions {
|
||||||
public eoscSubjects = [
|
public eoscSubjects = [
|
||||||
{label: 'EOSC::Jupyter Notebook', link: 'https://' + (properties.environment != 'production'?'beta.':'') + 'marketplace.eosc-portal.eu/services?tag=EOSC%3A%3AJupyter+Notebook', value: 'Jupyter Notebook'},
|
{label: 'EOSC::Jupyter Notebook', link: 'https://' + (properties.environment != 'production'?'beta.':'') + 'search.marketplace.eosc-portal.eu/search/service?q=*&fq=tag_list:"EOSC%5C:%5C:Jupyter%20Notebook"', value: 'Jupyter Notebook'},
|
||||||
{label: 'EOSC::RO-crate', link: 'https://' + (properties.environment != 'production'?'beta.':'') + 'marketplace.eosc-portal.eu/datasources/eosc.psnc.6f0470e3bb9203ec3a7553f3a72a7a1f?q=ROHub', value: 'RO-crate'},
|
{label: 'EOSC::RO-crate', link: 'https://' + (properties.environment != 'production'?'beta.':'') + 'search.marketplace.eosc-portal.eu/search/data-source?q=*&fq=tag_list:%22eosc%5C:%5C:ro%5C-crate%22', value: 'RO-crate'},
|
||||||
{label: 'EOSC::Galaxy Workflow', link: 'https://' + (properties.environment != 'production'?'beta.':'') + 'marketplace.eosc-portal.eu/services?tag=EOSC%3A%3AGalaxy+Workflow', value: 'Galaxy Workflow'},
|
{label: 'EOSC::Galaxy Workflow', link: 'https://' + (properties.environment != 'production'?'beta.':'') + 'search.marketplace.eosc-portal.eu/search/service?q=*&fq=tag_list:%22eosc%5C:%5C:galaxy%20workflow%22', value: 'Galaxy Workflow'},
|
||||||
{label: 'EOSC::Twitter Data', link: 'https://' + (properties.environment != 'production'?'beta.':'') + 'marketplace.eosc-portal.eu/services?tag=EOSC%3A%3ATwitter+Data', value: 'Twitter Data'}
|
{label: 'EOSC::Twitter Data', link: 'https://' + (properties.environment != 'production'?'beta.':'') + 'search.marketplace.eosc-portal.eu/search/service?q=*&fq=tag_list:%22EOSC%5C:%5C:Twitter%20Data%22', value: 'Twitter Data'},
|
||||||
|
{label: 'EOSC::Data Cube', link: 'https://' + (properties.environment != 'production'?'beta.':'') + 'search.marketplace.eosc-portal.eu/search/service?q=*&fq=tag_list:%22EOSC%5C:%5C:Data%20Cube%22', value: 'Data Cube'}
|
||||||
]
|
]
|
||||||
|
|
||||||
public notebookInSubjects: boolean = false;
|
public notebookInSubjects: boolean = false;
|
||||||
|
|
|
@ -170,8 +170,8 @@ export class OrganizationComponent {
|
||||||
this.updateTitle("Organization");
|
this.updateTitle("Organization");
|
||||||
this.updateDescription("");
|
this.updateDescription("");
|
||||||
|
|
||||||
if(params["pv"]) {
|
if(params["return_path"]) {
|
||||||
this.prevPath = params["pv"];
|
this.prevPath = params["return_path"] + (params["search_params"] ? ("?"+params["search_params"]) : "");
|
||||||
}
|
}
|
||||||
if((typeof document !== 'undefined') && document.referrer) {
|
if((typeof document !== 'undefined') && document.referrer) {
|
||||||
this.referrer = document.referrer;
|
this.referrer = document.referrer;
|
||||||
|
|
|
@ -214,8 +214,8 @@ export class ProjectComponent {
|
||||||
this.updateTitle(title);
|
this.updateTitle(title);
|
||||||
this.updateDescription(description);
|
this.updateDescription(description);
|
||||||
|
|
||||||
if(params["pv"]) {
|
if(params["return_path"]) {
|
||||||
this.prevPath = params["pv"];
|
this.prevPath = params["return_path"] + (params["search_params"] ? ("?"+params["search_params"]) : "");
|
||||||
}
|
}
|
||||||
if((typeof document !== 'undefined') && document.referrer) {
|
if((typeof document !== 'undefined') && document.referrer) {
|
||||||
this.referrer = document.referrer;
|
this.referrer = document.referrer;
|
||||||
|
@ -979,7 +979,11 @@ export class ProjectComponent {
|
||||||
|
|
||||||
public addEoscPrevInParams(obj) {
|
public addEoscPrevInParams(obj) {
|
||||||
if(properties.adminToolsPortalType == "eosc" && this.prevPath) {
|
if(properties.adminToolsPortalType == "eosc" && this.prevPath) {
|
||||||
return this.routerHelper.addQueryParam("pv", this.prevPath, obj);
|
let splitted: string[] = this.prevPath.split("?");
|
||||||
|
obj = this.routerHelper.addQueryParam("return_path", splitted[0], obj);
|
||||||
|
if(splitted.length > 0) {
|
||||||
|
obj = this.routerHelper.addQueryParam("search_params", splitted[1], obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,9 +208,8 @@ export class ResultLandingComponent {
|
||||||
this.egiTransferModalOpen = true;
|
this.egiTransferModalOpen = true;
|
||||||
}
|
}
|
||||||
this.updateDescription("");
|
this.updateDescription("");
|
||||||
|
if(data["return_path"]) {
|
||||||
if(data["pv"]) {
|
this.prevPath = data["return_path"] + (data["search_params"] ? ("?"+data["search_params"]) : "");
|
||||||
this.prevPath = data["pv"];
|
|
||||||
}
|
}
|
||||||
if((typeof document !== 'undefined') && document.referrer) {
|
if((typeof document !== 'undefined') && document.referrer) {
|
||||||
this.referrer = document.referrer;
|
this.referrer = document.referrer;
|
||||||
|
@ -723,7 +722,7 @@ export class ResultLandingComponent {
|
||||||
}
|
}
|
||||||
if(!this.identifier) {
|
if(!this.identifier) {
|
||||||
this._location.go(( pid ? (this.linkToLandingPage.split("?")[0] + "?pid=" + pid.id):
|
this._location.go(( pid ? (this.linkToLandingPage.split("?")[0] + "?pid=" + pid.id):
|
||||||
(this.linkToLandingPage + this.id)) + (this.prevPath ? ("&pv="+this.prevPath) : ""));
|
(this.linkToLandingPage + this.id)) + this.getEoscParams());
|
||||||
}
|
}
|
||||||
// else {
|
// else {
|
||||||
// this._location.go(this.linkToLandingPage.split("?")[0] + "?pid=" + this.identifier.id);
|
// this._location.go(this.linkToLandingPage.split("?")[0] + "?pid=" + this.identifier.id);
|
||||||
|
@ -924,9 +923,25 @@ export class ResultLandingComponent {
|
||||||
this.descriptionModal.open();
|
this.descriptionModal.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getEoscParams() {
|
||||||
|
let params = "";
|
||||||
|
if(this.prevPath) {
|
||||||
|
let splitted: string[] = this.prevPath.split("?");
|
||||||
|
params = "&return_path="+StringUtils.URIEncode(splitted[0]);
|
||||||
|
if(splitted.length > 0) {
|
||||||
|
params += "&search_params="+StringUtils.URIEncode(splitted[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
public addEoscPrevInParams(obj) {
|
public addEoscPrevInParams(obj) {
|
||||||
if(properties.adminToolsPortalType == "eosc" && this.prevPath) {
|
if(properties.adminToolsPortalType == "eosc" && this.prevPath) {
|
||||||
return this.routerHelper.addQueryParam("pv", this.prevPath, obj);
|
let splitted: string[] = this.prevPath.split("?");
|
||||||
|
obj = this.routerHelper.addQueryParam("return_path", splitted[0], obj);
|
||||||
|
if(splitted.length > 0) {
|
||||||
|
obj = this.routerHelper.addQueryParam("search_params", splitted[1], obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,26 +55,26 @@ export class SdgComponent implements OnInit, OnDestroy {
|
||||||
this.updateUrl(this.url);
|
this.updateUrl(this.url);
|
||||||
this.updateTitle(this.pageTitle);
|
this.updateTitle(this.pageTitle);
|
||||||
this.updateDescription(this.pageDescription);
|
this.updateDescription(this.pageDescription);
|
||||||
this.vocabulariesService.getSDGs(properties).subscribe(data => {
|
this.subscriptions.push(this.vocabulariesService.getSDGs(properties).subscribe(data => {
|
||||||
this.sdgs = data['sdg'];
|
this.sdgs = data['sdg'];
|
||||||
});
|
this.subscriptions.push(this.refineFieldResultsService.getRefineFieldsResultsByEntityName(['sdg'], 'result', this.properties, refineParams).subscribe(data => {
|
||||||
|
this.sdgsResearchOutcomes = data[1][0].values;
|
||||||
|
let merged =[];
|
||||||
|
for(let i=0; i<this.sdgs.length; i++){
|
||||||
|
merged.push({
|
||||||
|
...this.sdgs[i],
|
||||||
|
...(this.sdgsResearchOutcomes.find((innerItem) => innerItem.id === this.sdgs[i].id))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.displayedSdgs = merged;
|
||||||
|
this.loading = false;
|
||||||
|
}));
|
||||||
|
}));
|
||||||
let refineParams = null;
|
let refineParams = null;
|
||||||
if(this.customFilter) {
|
if(this.customFilter) {
|
||||||
let refineValue = StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)));
|
let refineValue = StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)));
|
||||||
refineParams = '&fq=' + refineValue;
|
refineParams = '&fq=' + refineValue;
|
||||||
}
|
}
|
||||||
this.refineFieldResultsService.getRefineFieldsResultsByEntityName(['sdg'], 'result', this.properties, refineParams).subscribe(data => {
|
|
||||||
this.sdgsResearchOutcomes = data[1][0].values;
|
|
||||||
let merged =[];
|
|
||||||
for(let i=0; i<this.sdgs.length; i++){
|
|
||||||
merged.push({
|
|
||||||
...this.sdgs[i],
|
|
||||||
...(this.sdgsResearchOutcomes.find((innerItem) => innerItem.id === this.sdgs[i].id))
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.displayedSdgs = merged;
|
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ngOnDestroy() {
|
public ngOnDestroy() {
|
||||||
|
|
|
@ -56,6 +56,7 @@ export class EntitiesSelectionComponent {
|
||||||
showPage["" + data['pages'][i]["route"] + ""] = data['pages'][i]["isEnabled"];
|
showPage["" + data['pages'][i]["route"] + ""] = data['pages'][i]["isEnabled"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.entities = [];
|
||||||
if(this.onlyresults) {
|
if(this.onlyresults) {
|
||||||
if(this.simpleView) {
|
if(this.simpleView) {
|
||||||
this.entities.push({label: 'All ' + OpenaireEntities.RESULTS.toLowerCase(), value: 'all'});
|
this.entities.push({label: 'All ' + OpenaireEntities.RESULTS.toLowerCase(), value: 'all'});
|
||||||
|
|
|
@ -317,7 +317,7 @@
|
||||||
</div>
|
</div>
|
||||||
<ng-template #header_template let-mobile="mobile">
|
<ng-template #header_template let-mobile="mobile">
|
||||||
<a *ngIf="!activeHeader.url" [routerLink]="activeHeader.route" [class.uk-padding-remove]="!isHeaderLeft"
|
<a *ngIf="!activeHeader.url" [routerLink]="activeHeader.route" [class.uk-padding-remove]="!isHeaderLeft"
|
||||||
class="uk-logo uk-navbar-item uk-flex uk-flex-middle">
|
class="uk-logo uk-navbar-item uk-flex uk-flex-middle" [class.small]="activeHeader.logoInfo">
|
||||||
<img *ngIf="(mobile && activeHeader.logoSmallUrl) || (!mobile && activeHeader.logoUrl)"
|
<img *ngIf="(mobile && activeHeader.logoSmallUrl) || (!mobile && activeHeader.logoUrl)"
|
||||||
[src]="!mobile?activeHeader.logoUrl:activeHeader.logoSmallUrl"
|
[src]="!mobile?activeHeader.logoUrl:activeHeader.logoSmallUrl"
|
||||||
[alt]="activeHeader.title">
|
[alt]="activeHeader.title">
|
||||||
|
@ -329,7 +329,7 @@
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</a>
|
</a>
|
||||||
<a *ngIf="activeHeader.url" [href]="activeHeader.url" [class.uk-padding-remove]="!isHeaderLeft"
|
<a *ngIf="activeHeader.url" [href]="activeHeader.url" [class.uk-padding-remove]="!isHeaderLeft"
|
||||||
class="uk-logo uk-navbar-item uk-flex uk-flex-middle">
|
class="uk-logo uk-navbar-item uk-flex uk-flex-middle" [class.small]="activeHeader.logoInfo">
|
||||||
<img *ngIf="(mobile && activeHeader.logoSmallUrl) || (!mobile && activeHeader.logoUrl)"
|
<img *ngIf="(mobile && activeHeader.logoSmallUrl) || (!mobile && activeHeader.logoUrl)"
|
||||||
[src]="!mobile?activeHeader.logoUrl:activeHeader.logoSmallUrl"
|
[src]="!mobile?activeHeader.logoUrl:activeHeader.logoSmallUrl"
|
||||||
[alt]="activeHeader.title">
|
[alt]="activeHeader.title">
|
||||||
|
|
|
@ -144,4 +144,5 @@ export interface EnvProperties {
|
||||||
connectPortalUrl?;
|
connectPortalUrl?;
|
||||||
eoscDataTransferAPI?;
|
eoscDataTransferAPI?;
|
||||||
eoscDataTransferDestinations?;
|
eoscDataTransferDestinations?;
|
||||||
|
hasMachineCache?: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,7 +180,11 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
|
||||||
|
|
||||||
public addEoscPrevInParams(obj) {
|
public addEoscPrevInParams(obj) {
|
||||||
if(properties.adminToolsPortalType == "eosc" && this.prevPath) {
|
if(properties.adminToolsPortalType == "eosc" && this.prevPath) {
|
||||||
return this.routerHelper.addQueryParam("pv", this.prevPath, obj);
|
let splitted: string[] = this.prevPath.split("?");
|
||||||
|
obj = this.routerHelper.addQueryParam("return_path", splitted[0], obj);
|
||||||
|
if(splitted.length > 0) {
|
||||||
|
obj = this.routerHelper.addQueryParam("search_params", splitted[1], obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,12 +122,12 @@ export class ISVocabulariesService {
|
||||||
|
|
||||||
getFos(properties: EnvProperties): Observable<any> {
|
getFos(properties: EnvProperties): Observable<any> {
|
||||||
let url = "/assets/common-assets/vocabulary/fos.json";
|
let url = "/assets/common-assets/vocabulary/fos.json";
|
||||||
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
return this.http.get(url).pipe(map(res => (res && res['fos'])?res:{fos: []}));
|
||||||
}
|
}
|
||||||
|
|
||||||
getSDGs(properties: EnvProperties): Observable<any> {
|
getSDGs(properties: EnvProperties): Observable<any> {
|
||||||
let url = "/assets/common-assets/vocabulary/sdg.json";
|
let url = "/assets/common-assets/vocabulary/sdg.json";
|
||||||
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
return this.http.get(url).pipe(map(res => (res && res['sdg'])?res:{sdg: []}));
|
||||||
}
|
}
|
||||||
|
|
||||||
parseSDGs(data: any): AutoCompleteValue[] {
|
parseSDGs(data: any): AutoCompleteValue[] {
|
||||||
|
|
Loading…
Reference in New Issue