diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 00000000..0267301c --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,200 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/connect/community/CustomizationOptions.ts b/connect/community/CustomizationOptions.ts index 091178da..f1a318d6 100644 --- a/connect/community/CustomizationOptions.ts +++ b/connect/community/CustomizationOptions.ts @@ -1,86 +1,102 @@ import {properties} from "../../../../environments/environment"; export class Layout { - _id:string; - portalPid:string; - layoutOptions:CustomizationOptions; + _id: string; + portalPid: string; + layoutOptions: CustomizationOptions; date; - constructor(community, options:CustomizationOptions){ + + constructor(community, options: CustomizationOptions) { this.portalPid = community; this.layoutOptions = options; } public static getVariables(options: CustomizationOptions): {} | null { - if(options) { + if (options) { let variables = {}; - if(options.identity) { - variables['@global-primary-background'] = options.identity.mainColor; - variables['@global-secondary-background'] = options.identity.secondaryColor; + if (options.identity) { + variables['@global-primary-background'] = Layout.convertRGBAtoRGB(options.identity.mainColor); + variables['@global-secondary-background'] = Layout.convertRGBAtoRGB(options.identity.secondaryColor); } - if(options.backgrounds){ - variables['@general-search-form-background'] = options.backgrounds.form.color; - variables['@base-body-background'] = options.backgrounds.light.color; - variables['@hero-background-image'] = (options.backgrounds.form.imageFile?(this.getUrl(properties.utilsService + '/download/' +options.backgrounds.form.imageFile)): 'none') ; + if (options.backgrounds) { + variables['@general-search-form-background'] = Layout.convertRGBAtoRGB(options.backgrounds.form.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-position'] = options.backgrounds.form.position; } - if(options.buttons){ + if (options.buttons) { //general variables['@button-border-width'] = options.buttons.lightBackground.borderWidth + "px"; variables['@button-border-radius'] = options.buttons.lightBackground.borderRadius + "px"; // default -> on dark background todo check again when we have sucj=h buttons - variables['@button-default-background'] = options.buttons.darkBackground.backgroundColor; - variables['@button-default-color'] = options.buttons.darkBackground.color; - variables['@button-default-border'] = options.buttons.darkBackground.borderColor; - variables['@button-default-hover-background'] = options.buttons.darkBackground.onHover.backgroundColor; - variables['@button-default-hover-color'] = options.buttons.darkBackground.onHover.color; - variables['@button-default-hover-border'] = options.buttons.darkBackground.onHover.borderColor; - variables['@button-default-active-background'] = options.buttons.darkBackground.onHover.backgroundColor; - variables['@button-default-active-color'] = options.buttons.darkBackground.onHover.color; - variables['@button-default-active-border'] = options.buttons.darkBackground.onHover.borderColor; + variables['@button-default-background'] = Layout.convertRGBAtoRGB(options.buttons.darkBackground.backgroundColor); + variables['@button-default-color'] = Layout.convertRGBAtoRGB(options.buttons.darkBackground.color); + variables['@button-default-border'] = Layout.convertRGBAtoRGB(options.buttons.darkBackground.borderColor); + variables['@button-default-hover-background'] = Layout.convertRGBAtoRGB(options.buttons.darkBackground.onHover.backgroundColor); + variables['@button-default-hover-color'] = Layout.convertRGBAtoRGB(options.buttons.darkBackground.onHover.color); + variables['@button-default-hover-border'] = Layout.convertRGBAtoRGB(options.buttons.darkBackground.onHover.borderColor); + variables['@button-default-active-background'] = Layout.convertRGBAtoRGB(options.buttons.darkBackground.onHover.backgroundColor); + variables['@button-default-active-color'] = Layout.convertRGBAtoRGB(options.buttons.darkBackground.onHover.color); + variables['@button-default-active-border'] = Layout.convertRGBAtoRGB(options.buttons.darkBackground.onHover.borderColor); // primary - variables['@button-primary-background'] = options.buttons.lightBackground.backgroundColor; - variables['@button-primary-color'] = options.buttons.lightBackground.color; - variables['@button-primary-border'] = options.buttons.lightBackground.borderColor; - variables['@button-primary-hover-background'] = options.buttons.lightBackground.onHover.backgroundColor; - variables['@button-primary-hover-color'] = options.buttons.lightBackground.onHover.color; - variables['@button-primary-hover-border'] = options.buttons.lightBackground.onHover.borderColor; - variables['@button-primary-active-background'] = options.buttons.lightBackground.onHover.backgroundColor; - variables['@button-primary-active-color'] = options.buttons.lightBackground.onHover.color; - variables['@button-primary-active-border'] = options.buttons.lightBackground.onHover.borderColor; + variables['@button-primary-background'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.backgroundColor); + variables['@button-primary-color'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.color); + variables['@button-primary-border'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.borderColor); + variables['@button-primary-hover-background'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.onHover.backgroundColor); + variables['@button-primary-hover-color'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.onHover.color); + variables['@button-primary-hover-border'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.onHover.borderColor); + variables['@button-primary-active-background'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.onHover.backgroundColor); + variables['@button-primary-active-color'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.onHover.color); + variables['@button-primary-active-border'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.onHover.borderColor); // secondary - variables['@button-secondary-background'] = options.buttons.lightBackground.color; - variables['@button-secondary-color'] = options.buttons.lightBackground.backgroundColor; - variables['@button-secondary-border'] = options.buttons.lightBackground.backgroundColor; - variables['@button-secondary-hover-background'] = options.buttons.lightBackground.backgroundColor; - variables['@button-secondary-hover-color'] = options.buttons.lightBackground.color; - variables['@button-secondary-hover-border'] = options.buttons.lightBackground.borderColor; - variables['@button-secondary-active-background'] = options.buttons.lightBackground.backgroundColor; - variables['@button-secondary-active-color'] = options.buttons.lightBackground.color; - variables['@button-secondary-active-border'] = options.buttons.lightBackground.borderColor; - + variables['@button-secondary-background'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.color); + variables['@button-secondary-color'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.backgroundColor); + variables['@button-secondary-border'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.backgroundColor); + variables['@button-secondary-hover-background'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.backgroundColor); + variables['@button-secondary-hover-color'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.color); + variables['@button-secondary-hover-border'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.borderColor); + variables['@button-secondary-active-background'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.backgroundColor); + variables['@button-secondary-active-color'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.color); + variables['@button-secondary-active-border'] = Layout.convertRGBAtoRGB(options.buttons.lightBackground.borderColor); + } return variables; } return null; } - public static getUrl(url){ + + public static getUrl(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 { identity: { mainColor: string; secondaryColor: string; }; - identityIsCustom:boolean; - backgroundsIsCustom:boolean; - buttonsIsCustom:boolean; + identityIsCustom: boolean; + backgroundsIsCustom: boolean; + buttonsIsCustom: boolean; backgrounds: { dark: { - color: string; //background + color: string; //background } light: { color: string; //background @@ -89,41 +105,41 @@ export class CustomizationOptions { color: string; //background imageUrl: string; imageFile: string; - position:string; + position: string; } }; buttons: { darkBackground: ButtonsCustomization; lightBackground: ButtonsCustomization; }; - + constructor(mainColor: string = null, secondaryColor: string = null) { - this.identity= { + this.identity = { mainColor: mainColor ? mainColor : CustomizationOptions.getIdentity().mainColor, - secondaryColor : secondaryColor ? secondaryColor : CustomizationOptions.getIdentity().secondaryColor, + secondaryColor: secondaryColor ? secondaryColor : CustomizationOptions.getIdentity().secondaryColor, }; this.identityIsCustom = false; this.backgroundsIsCustom = false; this.buttonsIsCustom = false; - this.backgrounds={ - dark : { + this.backgrounds = { + dark: { color: this.identity.mainColor, }, - light : { + light: { color: "#f9f9f9" //CustomizationOptions.getRGBA(this.identity.mainColor,0.05), }, - form : { - color: CustomizationOptions.getRGBA(this.identity.mainColor,0.15), - imageUrl : null, - imageFile : null, + form: { + color: CustomizationOptions.getRGBA(this.identity.mainColor, 0.15), + imageUrl: null, + imageFile: null, position: null } }; - - + + this.buttons = { darkBackground: { - isDefault:true, + isDefault: true, backgroundColor: "#ffffff", color: "#000000", borderStyle: "solid", @@ -137,7 +153,7 @@ export class CustomizationOptions { } }, lightBackground: { - isDefault:true, + isDefault: true, backgroundColor: this.identity.mainColor, color: '#ffffff', borderStyle: "solid", @@ -150,15 +166,16 @@ export class CustomizationOptions { borderColor: this.identity.secondaryColor, } } - + }; } - 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); - if(!current){ + if (!current) { current = Object.assign({}, defaultCO); - }else { + } else { if (current.identity && current.identity.mainColor && current.identity.secondaryColor) { updated = new CustomizationOptions(current.identity.mainColor, current.identity.secondaryColor); } @@ -195,53 +212,55 @@ export class CustomizationOptions { } } return current; - - + + } - public static getIdentity(community:string=null){ - let COLORS= { - default:{ - mainColor:'#4687E6', + + public static getIdentity(community: string = null) { + let COLORS = { + default: { + mainColor: '#4687E6', secondaryColor: '#2D72D6' }, - "covid-19":{ - mainColor:"#03ADEE", + "covid-19": { + mainColor: "#03ADEE", secondaryColor: "#F15157" } }; - if(community && COLORS[community]){ + if (community && COLORS[community]) { return COLORS[community]; } return COLORS.default; } - public static getRGBA(color, 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+')'; + + public static getRGBA(color, 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; } - - public static isForLightBackground(color:string){ + + public static isForLightBackground(color: string) { 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); g = parseInt(color.substring(3, 5), 16); b = parseInt(color.substring(5, 7), 16); - if(color.length == 9) { - a = parseInt(color.substring(7, 9), 16); + if (color.length == 9) { + 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(","); r = parseInt(array[0]); g = parseInt(array[1]); b = parseInt(array[2]); 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 !(r*0.299 + g*0.587 + b*0.114 > 186); /*for(let c of [r,g,b]){ c = c / 255.0; @@ -255,11 +274,12 @@ export class CustomizationOptions { return L > 0.179// (L + 0.05) / (0.05) > (1.0 + 0.05) / (L + 0.05); //use #000000 else use #ffffff */ } - - + + } -export class ButtonsCustomization{ - isDefault:boolean; + +export class ButtonsCustomization { + isDefault: boolean; backgroundColor: string; color: string; borderStyle: string; diff --git a/connect/community/community.service.ts b/connect/community/community.service.ts index acc3b749..d8fe6975 100644 --- a/connect/community/community.service.ts +++ b/connect/community/community.service.ts @@ -122,8 +122,8 @@ export class CommunityService { } else { community.fos = []; } - if (resData.advancedConstraint != null) { - community.selectionCriteria = resData.advancedConstraint; + if (resData.advancedConstraints != null) { + community.selectionCriteria = resData.advancedConstraints; } else { community.selectionCriteria = new SelectionCriteria(); } diff --git a/dashboard/sharedComponents/page-content/page-content.component.ts b/dashboard/sharedComponents/page-content/page-content.component.ts index bc1b1da9..54261153 100644 --- a/dashboard/sharedComponents/page-content/page-content.component.ts +++ b/dashboard/sharedComponents/page-content/page-content.component.ts @@ -13,7 +13,6 @@ import { import {LayoutService, SidebarItem} from "../sidebar/layout.service"; declare var UIkit; -declare var ResizeObserver; @Component({ selector: '[page-content]', @@ -99,23 +98,24 @@ export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy { ngAfterViewInit() { if (typeof document !== "undefined") { - this.observeStickyFooter(); - if (this.shouldSticky && typeof document !== 'undefined') { - this.sticky.header = UIkit.sticky((this.headerSticky ? this.header.nativeElement : this.actions.nativeElement), { - offset: this.offset - }); - this.subscriptions.push(UIkit.util.on(document, 'active', '#' + this.sticky.header.$el.id, () => { - this.isStickyActive = true; - this.cdr.detectChanges(); - })); - this.subscriptions.push(UIkit.util.on(document, 'inactive', '#' + this.sticky.header.$el.id, () => { - this.isStickyActive = false; - this.cdr.detectChanges(); - })); - } if (this.sticky_footer) { - let footer_offset = this.calcStickyFooterOffset(this.sticky_footer.nativeElement); - this.sticky.footer = UIkit.sticky(this.sticky_footer.nativeElement, {bottom: true, offset: footer_offset}); + this.initFooter(); + this.observeStickyFooter(); + } + if (this.shouldSticky && typeof document !== 'undefined') { + setTimeout(() => { + this.sticky.header = UIkit.sticky((this.headerSticky ? this.header.nativeElement : this.actions.nativeElement), { + offset: this.offset + }); + this.subscriptions.push(UIkit.util.on(document, 'active', '#' + this.sticky.header.$el.id, () => { + this.isStickyActive = true; + this.cdr.detectChanges(); + })); + this.subscriptions.push(UIkit.util.on(document, 'inactive', '#' + this.sticky.header.$el.id, () => { + this.isStickyActive = false; + this.cdr.detectChanges(); + })); + }); } } } @@ -124,12 +124,16 @@ export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy { this.subscriptions.forEach(subscription => { if (typeof ResizeObserver !== "undefined" && subscription instanceof ResizeObserver) { subscription.disconnect(); - } else if (typeof ResizeObserver !== "undefined" && subscription instanceof IntersectionObserver) { + } else if (typeof IntersectionObserver !== "undefined" && subscription instanceof IntersectionObserver) { subscription.disconnect(); } }); } - + + initFooter() { + let footer_offset = this.calcStickyFooterOffset(this.sticky_footer.nativeElement); + this.sticky.footer = UIkit.sticky(this.sticky_footer.nativeElement, {bottom: true, offset: footer_offset}); + } /** * Workaround for sticky not update bug when sidebar is toggled. @@ -206,8 +210,7 @@ export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy { let resizeObs = new ResizeObserver(entries => { entries.forEach(entry => { setTimeout(() => { - this.sticky.footer.offset = this.calcStickyFooterOffset(entry.target); - this.cdr.detectChanges(); + this.initFooter(); }); }) }); diff --git a/dashboard/sharedComponents/sidebar/layout.service.ts b/dashboard/sharedComponents/sidebar/layout.service.ts index ed91e514..447d7a5f 100644 --- a/dashboard/sharedComponents/sidebar/layout.service.ts +++ b/dashboard/sharedComponents/sidebar/layout.service.ts @@ -59,7 +59,7 @@ export class LayoutService { /** * Add hasQuickContact: false on data of route config, if the quick-contact fixed button is not needed. */ - private hasQuickContactSubject: BehaviorSubject = new BehaviorSubject(true); + private hasQuickContactSubject: BehaviorSubject = new BehaviorSubject(false); /** * Add activeMenuItem: string on data of route config, if page should activate a specific MenuItem and route url does not match. */ diff --git a/dashboard/sharedComponents/sidebar/sideBar.component.ts b/dashboard/sharedComponents/sidebar/sideBar.component.ts index 2e0c8aa1..39bc1fc1 100644 --- a/dashboard/sharedComponents/sidebar/sideBar.component.ts +++ b/dashboard/sharedComponents/sidebar/sideBar.component.ts @@ -49,7 +49,9 @@ export class SideBarComponent implements OnInit, AfterViewInit, OnDestroy, OnCha } ngAfterViewInit() { - this.toggle(true); + setTimeout(() => { + this.toggle(true); + }); } ngOnChanges(changes: SimpleChanges) { diff --git a/http-interceptor.service.ts b/http-interceptor.service.ts index dadd3781..7b0a4104 100644 --- a/http-interceptor.service.ts +++ b/http-interceptor.service.ts @@ -35,8 +35,11 @@ export class HttpInterceptorService implements HttpInterceptor { return of(response); } else { if (isPlatformServer(this.platformId)) { + if(request.url.startsWith('/assets') || request.url.startsWith('assets')) { + return of(null); + } let headers = new HttpHeaders(); - if(request.withCredentials) { + if(request.withCredentials && !properties.hasMachineCache) { headers = headers.set('Cookie', this.req.get('Cookie')); } const authReq = request.clone({ diff --git a/landingPages/dataProvider/dataProvider.component.ts b/landingPages/dataProvider/dataProvider.component.ts index 625a6b49..7cca836a 100644 --- a/landingPages/dataProvider/dataProvider.component.ts +++ b/landingPages/dataProvider/dataProvider.component.ts @@ -186,8 +186,8 @@ export class DataProviderComponent { this.stickyHeader = false; this.updateDescription(""); - if(data["pv"]) { - this.prevPath = data["pv"]; + if(data["return_path"]) { + this.prevPath = data["return_path"] + (data["search_params"] ? ("?"+data["search_params"]) : ""); } if((typeof document !== 'undefined') && document.referrer) { this.referrer = document.referrer; @@ -845,7 +845,11 @@ export class DataProviderComponent { public addEoscPrevInParams(obj) { 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; } diff --git a/landingPages/dataProvider/relatedDatasourcesTab.component.ts b/landingPages/dataProvider/relatedDatasourcesTab.component.ts index 1ed36512..c8b1b25d 100644 --- a/landingPages/dataProvider/relatedDatasourcesTab.component.ts +++ b/landingPages/dataProvider/relatedDatasourcesTab.component.ts @@ -141,7 +141,11 @@ export class RelatedDatasourcesTabComponent { public addEoscPrevInParams(obj) { 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; } diff --git a/landingPages/landing-utils/availableOn.component.ts b/landingPages/landing-utils/availableOn.component.ts index dc7f0052..6c97de66 100644 --- a/landingPages/landing-utils/availableOn.component.ts +++ b/landingPages/landing-utils/availableOn.component.ts @@ -128,7 +128,11 @@ export class AvailableOnComponent { public addEoscPrevInParams(obj) { 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; } diff --git a/landingPages/landing-utils/fundedBy.component.ts b/landingPages/landing-utils/fundedBy.component.ts index 5f0e3cea..2938557d 100644 --- a/landingPages/landing-utils/fundedBy.component.ts +++ b/landingPages/landing-utils/fundedBy.component.ts @@ -110,7 +110,11 @@ export class FundedByComponent { public addEoscPrevInParams(obj) { 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; } diff --git a/landingPages/landing-utils/metrics/metrics.component.ts b/landingPages/landing-utils/metrics/metrics.component.ts index 61b0dfdf..56762c46 100644 --- a/landingPages/landing-utils/metrics/metrics.component.ts +++ b/landingPages/landing-utils/metrics/metrics.component.ts @@ -8,6 +8,9 @@ import {EnvProperties} from '../../../utils/properties/env-properties'; import {ClickEvent} from "../../../utils/click/click-outside-or-esc.directive"; import {NumberUtils} from "../../../utils/number-utils.class"; import {OpenaireEntities} from "../../../utils/properties/searchFields"; +import {StringUtils} from "../../../utils/string-utils.class"; +import {properties} from "../../../../../environments/environment"; +import {RouterHelper} from "../../../utils/routerHelper.class"; @Component({ selector: 'metrics', @@ -77,7 +80,7 @@ import {OpenaireEntities} from "../../../utils/properties/searchFields"; - + {{metrics.infos.get(key).name}} @@ -151,6 +154,7 @@ export class MetricsComponent { public status: number; public state: number = -1; public openaireEntities = OpenaireEntities; + public routerHelper:RouterHelper = new RouterHelper(); constructor(private metricsService: MetricsService, private cdr: ChangeDetectorRef) { } @@ -313,4 +317,15 @@ export class MetricsComponent { let formatted = NumberUtils.roundNumber(+num); return formatted.number + formatted.size; } + + public addEoscPrevInParams(obj) { + if(properties.adminToolsPortalType == "eosc" && this.prevPath) { + 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; + } } diff --git a/landingPages/landing-utils/metrics/metrics.module.ts b/landingPages/landing-utils/metrics/metrics.module.ts index 10f5391d..fab8e9a2 100644 --- a/landingPages/landing-utils/metrics/metrics.module.ts +++ b/landingPages/landing-utils/metrics/metrics.module.ts @@ -10,10 +10,11 @@ import {MetricsService} from '../../../services/metrics.service'; import {ErrorMessagesModule} from '../../../utils/errorMessages.module'; import {IFrameModule} from "../../../utils/iframe.module"; import {IconsModule} from "../../../utils/icons/icons.module"; +import {RouterModule} from "@angular/router"; @NgModule({ imports: [ - CommonModule, FormsModule, ErrorMessagesModule, IFrameModule, IconsModule + CommonModule, FormsModule, RouterModule, ErrorMessagesModule, IFrameModule, IconsModule ], declarations: [ MetricsComponent diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index 23592e3f..ef502b3b 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -9,10 +9,11 @@ import {StringUtils} from "../../utils/string-utils.class"; }) export class ParsingFunctions { 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::RO-crate', link: 'https://' + (properties.environment != 'production'?'beta.':'') + 'marketplace.eosc-portal.eu/datasources/eosc.psnc.6f0470e3bb9203ec3a7553f3a72a7a1f?q=ROHub', 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::Twitter Data', link: 'https://' + (properties.environment != 'production'?'beta.':'') + 'marketplace.eosc-portal.eu/services?tag=EOSC%3A%3ATwitter+Data', value: 'Twitter Data'} + {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.':'') + '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.':'') + '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.':'') + '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; diff --git a/landingPages/organization/organization.component.ts b/landingPages/organization/organization.component.ts index 127a5135..1f871bd2 100644 --- a/landingPages/organization/organization.component.ts +++ b/landingPages/organization/organization.component.ts @@ -170,8 +170,8 @@ export class OrganizationComponent { this.updateTitle("Organization"); this.updateDescription(""); - if(params["pv"]) { - this.prevPath = params["pv"]; + if(params["return_path"]) { + this.prevPath = params["return_path"] + (params["search_params"] ? ("?"+params["search_params"]) : ""); } if((typeof document !== 'undefined') && document.referrer) { this.referrer = document.referrer; diff --git a/landingPages/project/project.component.ts b/landingPages/project/project.component.ts index 48577593..be2b7c5d 100644 --- a/landingPages/project/project.component.ts +++ b/landingPages/project/project.component.ts @@ -214,8 +214,8 @@ export class ProjectComponent { this.updateTitle(title); this.updateDescription(description); - if(params["pv"]) { - this.prevPath = params["pv"]; + if(params["return_path"]) { + this.prevPath = params["return_path"] + (params["search_params"] ? ("?"+params["search_params"]) : ""); } if((typeof document !== 'undefined') && document.referrer) { this.referrer = document.referrer; @@ -979,7 +979,11 @@ export class ProjectComponent { public addEoscPrevInParams(obj) { 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; } diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index 2e552f33..f43629b5 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -466,7 +466,7 @@ eosc_logo
- diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index f3ac4843..0b281b62 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -208,9 +208,8 @@ export class ResultLandingComponent { this.egiTransferModalOpen = true; } this.updateDescription(""); - - if(data["pv"]) { - this.prevPath = data["pv"]; + if(data["return_path"]) { + this.prevPath = data["return_path"] + (data["search_params"] ? ("?"+data["search_params"]) : ""); } if((typeof document !== 'undefined') && document.referrer) { this.referrer = document.referrer; @@ -723,7 +722,7 @@ export class ResultLandingComponent { } if(!this.identifier) { 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 { // this._location.go(this.linkToLandingPage.split("?")[0] + "?pid=" + this.identifier.id); @@ -924,9 +923,25 @@ export class ResultLandingComponent { 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) { 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; } diff --git a/monitor/how/how.component.less b/monitor/how/how.component.less deleted file mode 100644 index 04459c51..00000000 --- a/monitor/how/how.component.less +++ /dev/null @@ -1,299 +0,0 @@ -@import "~src/assets/openaire-theme/less/_import-variables"; - -@media only screen and (min-width: @breakpoint-small) { - .how .first > div:first-child { - position: relative; - } - - .how .first > div:first-child:after { - content: "we"; - font-size: 20px; - font-weight: 600; - text-align: center; - padding-bottom: 5%; - position: absolute; - background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/1.svg"); - right: -21%; - top: 33%; - width: 20%; - background-size: contain; - background-repeat: no-repeat; - background-position: bottom center; - } - - .how .second > div:first-child { - position: relative; - padding: 0 10% 0 20%; - } - - .how .second > div:first-child:after { - content: "and"; - font-size: 20px; - font-weight: 600; - text-align: center; - padding-bottom: 5%; - position: absolute; - background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/2.svg"); - right: -17%; - top: 33%; - width: 30%; - background-size: contain; - background-repeat: no-repeat; - background-position: bottom center; - } - - .how .third { - position: relative; - } - - .how .third > div:first-child { - padding: 0 14% 0 13%; - } - - .how .third:after { - content: "on which"; - font-size: 20px; - font-weight: 600; - padding-right: 30%; - padding-top: 5%; - padding-bottom: 5%; - position: absolute; - background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/3.svg"); - bottom: -6%; - left: 13%; - transform: translateY(100%); - width: 140px; - background-size: contain; - background-repeat: no-repeat; - background-position: center; - } - - .how .fourth { - padding: 10% 3% 0 3%; - } - - .how .fourth > div:first-child { - position: relative; - padding: 0 16% 0 16%; - } - - .how .fourth> div:first-child:after { - content: "and"; - font-size: 20px; - font-weight: 600; - text-align: center; - padding-bottom: 5%; - position: absolute; - background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/4.svg"); - left: -18%; - top: 36%; - width: 30%; - background-size: contain; - background-repeat: no-repeat; - background-position: bottom center; - } - - .how .fifth { - padding: 11% 2% 0 2%; - } - - .how .fifth > div:first-child { - position: relative; - } - - .how .fifth > div:first-child:after { - content: "We"; - font-size: 20px; - font-weight: 600; - text-align: center; - padding-bottom: 5%; - position: absolute; - background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/5.svg"); - left: -35%; - top: 36%; - width: 30%; - background-size: contain; - background-repeat: no-repeat; - background-position: bottom center; - } - - .how .sixth { - padding: 10% 5% 0 0; - } - - .how .sixth > div:first-child { - padding: 0 15% 0 15%; - } - - .how .final { - padding: 10% 20% 0 20%; - } - - .how .final > div:first-child { - position: relative; - } - - .how .final > div:first-child:before { - content: ""; - position: absolute; - background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/6.svg"); - left: -26%; - top: -20%; - height: 70%; - width: 30%; - background-size: contain; - background-repeat: no-repeat; - background-position: bottom center; - } - - .how .final > div:first-child:after { - content: "We make visualizations, graphs, reports and deliver all in a customisable tool"; - font-size: 20px; - position: absolute; - top: 30%; - width: 250px; - padding: 8% 0 5% 0; - background-size: contain; - background-repeat: no-repeat; - background-position: bottom center; - } -} - -@media only screen and (max-width: @breakpoint-xsmall-max) { - .how .first { - position: relative; - padding-bottom: 30%; - } - - .how .first:after { - content: "we"; - text-align: center; - padding: 10% 34% 10% 0; - position: absolute; - background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/3.svg"); - left: 26%; - top: 79%; - background-size: contain; - background-repeat: no-repeat; - background-position: center; - } - - .how .second { - position: relative; - padding: 0 10% 30% 10%; - } - - .how .second:after { - content: "and"; - text-align: center; - padding: 10% 34% 10% 0; - position: absolute; - background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/3.svg"); - left: 25%; - top: 80%; - background-size: contain; - background-repeat: no-repeat; - background-position: center; - } - - .how .third { - position: relative; - padding: 0 5% 30% 5%; - } - - .how .third:after { - content: "on which"; - font-weight: bold; - text-align: center; - padding: 10% 41% 10% 0; - position: absolute; - background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/3.svg"); - left: 15%; - top: 83%; - background-size: contain; - background-repeat: no-repeat; - background-position: center; - } - - .how .fourth { - position: relative; - padding: 0 0 30% 0; - } - - .how .fourth > div:first-child { - padding: 0 10% 0 10%; - } - - .how .fourth:after { - content: "and"; - text-align: center; - padding: 10% 34% 10% 0; - position: absolute; - background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/3.svg"); - left: 26%; - top: 79%; - background-size: contain; - background-repeat: no-repeat; - background-position: center; - } - - .how .fifth { - position: relative; - padding: 0 2% 30% 2%; - } - - .how .fifth:after { - content: "We"; - text-align: center; - padding: 10% 34% 10% 0; - position: absolute; - background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/3.svg"); - left: 27%; - top: 76%; - background-size: contain; - background-repeat: no-repeat; - background-position: center; - } - - .how .sixth { - padding: 0 5% 30% 0; - } - - .how .sixth > div:first-child { - padding: 0 15% 0 15%; - } - - .how .final { - padding: 20% 0 20% 0; - } - - .how .final > div:first-child { - position: relative; - } - - .how .final > div:first-child:before { - content: ""; - position: absolute; - background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/6.svg"); - left: 34%; - top: -70%; - height: 70%; - width: 30%; - background-size: contain; - background-repeat: no-repeat; - background-position: center; - } - - .how .final > div:first-child:after { - content: "We make visualizations, graphs, reports and deliver all in a customisable tool"; - text-align: center; - position: absolute; - left: -62%; - top: 85%; - width: 300px; - padding: 12% 0 0 54%; - background-size: contain; - background-repeat: no-repeat; - background-position: center; - } -} diff --git a/monitor/how/how.component.ts b/monitor/how/how.component.ts deleted file mode 100644 index 251d3549..00000000 --- a/monitor/how/how.component.ts +++ /dev/null @@ -1,72 +0,0 @@ -import {Component} from "@angular/core"; - -@Component({ - selector: 'how', - template: ` -
-
-
-
- -
-
- Starting from existing
research-related data sources -
-
-
-
- -
-
-
-
- -
-
- build an open, global
and trusted Research graph -
-
-
-
-
-
- -
-
- we perform Statistical
Analysis
and produce
- Open Science Indicators -
-
-
-
- -
-
- furthermore Network
Analysis
producing
- Collaboration Indicators -
-
-
-
- -
-
- Often combine with external data
- (patents, social, company) and - perform
Impact Analysis to - produce
Innovation Indicators -
-
-
-
-
- -
-
-
- `, - styleUrls: ['how.component.less'] -}) -export class HowComponent { - -} diff --git a/monitor/how/how.module.ts b/monitor/how/how.module.ts deleted file mode 100644 index 781800fe..00000000 --- a/monitor/how/how.module.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {NgModule} from "@angular/core"; -import {CommonModule} from "@angular/common"; -import {HowComponent} from "./how.component"; - -@NgModule({ - imports: [CommonModule], - declarations: [HowComponent], - exports: [HowComponent] -}) -export class HowModule { - -} diff --git a/monitor/indicators/indicator-themes.component.ts b/monitor/indicators/indicator-themes.component.ts index 4f48b5e2..fcb11a8e 100644 --- a/monitor/indicators/indicator-themes.component.ts +++ b/monitor/indicators/indicator-themes.component.ts @@ -26,7 +26,7 @@ import {Subscriber} from "rxjs";
Indicator themes that we are covering in the Monitor dashboards.

- This is the current set of indicator themes we cover. We’ll keep enriching it as new requests and data are coming into the OpenAIRE Research Graph. We are at your disposal, should you have any recommendations! + This is the current set of indicator themes we cover. We’ll keep enriching it as new requests and data are coming into the OpenAIRE Graph. We are at your disposal, should you have any recommendations!

Check out the indicator pages (for funders, @@ -50,7 +50,7 @@ import {Subscriber} from "rxjs";

Indicator themes that we are covering in the Monitor dashboards.

- This is the current set of indicator themes we cover. We’ll keep enriching it as new requests and data are coming into the OpenAIRE Research Graph. We are at your disposal, should you have any recommendations! + This is the current set of indicator themes we cover. We’ll keep enriching it as new requests and data are coming into the OpenAIRE Graph. We are at your disposal, should you have any recommendations!

Check out the indicator pages (for funders, diff --git a/monitor/methodology/methodological-approach.component.ts b/monitor/methodology/methodological-approach.component.ts index e4e9bffe..5ddc49c1 100644 --- a/monitor/methodology/methodological-approach.component.ts +++ b/monitor/methodology/methodological-approach.component.ts @@ -32,7 +32,7 @@ import {Breadcrumb} from "../../utils/breadcrumbs/breadcrumbs.component";

  • Coverage and accuracy: As detailed in graph.openaire.eu - multiple data sources are ingested in the OpenAIRE research graph for coverage to the fullest extent + multiple data sources are ingested in the OpenAIRE Graph for coverage to the fullest extent possible, in order to provide meaningful indicators.
  • Clarity and replicability: We describe our construction methodology in @@ -69,7 +69,7 @@ import {Breadcrumb} from "../../utils/breadcrumbs/breadcrumbs.component";

    How? It’s about open data and collaboration.

    • - Built on the OpenAire Research Graph + Built on the OpenAire Graph Linked scholarly information from open initiatives around the world. Beyond publications.
    • @@ -84,7 +84,7 @@ import {Breadcrumb} from "../../utils/breadcrumbs/breadcrumbs.component";
  • - OpenAIRE Research Graph + OpenAIRE Graph
    @@ -105,7 +105,7 @@ import {Breadcrumb} from "../../utils/breadcrumbs/breadcrumbs.component";
  • Coverage and accuracy: As detailed in graph.openaire.eu - multiple data sources are ingested in the OpenAIRE research graph for coverage to the fullest extent + multiple data sources are ingested in the OpenAIRE Graph for coverage to the fullest extent possible, in order to provide meaningful indicators.
  • Clarity and replicability: We describe our construction methodology in @@ -131,7 +131,7 @@ import {Breadcrumb} from "../../utils/breadcrumbs/breadcrumbs.component";
    - OpenAIRE Research Graph + OpenAIRE Graph
    Completeness, inclusion, transparency and replicability @@ -139,7 +139,7 @@ import {Breadcrumb} from "../../utils/breadcrumbs/breadcrumbs.component";

    It’s about open data and collaboration.

    • - Built on the OpenAire Research Graph + Built on the OpenAire Graph Linked scholarly information from open initiatives around the world. Beyond publications.
    • diff --git a/monitor/methodology/methodology.module.ts b/monitor/methodology/methodology.module.ts index 25a8ad77..3d07357c 100644 --- a/monitor/methodology/methodology.module.ts +++ b/monitor/methodology/methodology.module.ts @@ -5,10 +5,7 @@ import {MethodolocigalApproachComponent} from "./methodological-approach.compone import {RouterModule} from "@angular/router"; import {PreviousRouteRecorder} from "../../utils/piwik/previousRouteRecorder.guard"; import {PageContentModule} from "../../dashboard/sharedComponents/page-content/page-content.module"; -import {HowModule} from "../how/how.module"; import {IconsModule} from "../../utils/icons/icons.module"; -import {IconsService} from "../../utils/icons/icons.service"; -import {graph} from "../../utils/icons/icons"; import {BreadcrumbsModule} from "../../utils/breadcrumbs/breadcrumbs.module"; import {SliderTabsModule} from "../../sharedComponents/tabs/slider-tabs.module"; import {HelperModule} from "../../utils/helper/helper.module"; @@ -32,11 +29,8 @@ import {HelperModule} from "../../utils/helper/helper.module"; component: MethodolocigalApproachComponent, canDeactivate: [PreviousRouteRecorder] } - ]), PageContentModule, HowModule, IconsModule, BreadcrumbsModule, SliderTabsModule, HelperModule], + ]), PageContentModule, IconsModule, BreadcrumbsModule, SliderTabsModule, HelperModule], exports: [TerminologyComponent, MethodolocigalApproachComponent] }) export class MethodologyModule { - constructor(private iconsService: IconsService) { - this.iconsService.registerIcons([graph]); - } } diff --git a/monitor/methodology/terminology.component.less b/monitor/methodology/terminology.component.less new file mode 100644 index 00000000..e6212b69 --- /dev/null +++ b/monitor/methodology/terminology.component.less @@ -0,0 +1,3 @@ +.uk-width-medium { + width: 350px; +} diff --git a/monitor/methodology/terminology.component.ts b/monitor/methodology/terminology.component.ts index ded7fbcd..0da0c18c 100644 --- a/monitor/methodology/terminology.component.ts +++ b/monitor/methodology/terminology.component.ts @@ -42,15 +42,14 @@ declare var ResizeObserver;
      - - More information for - OpenAIRE Research Graph - . + + Powered by OpenAIRE graph +
      -
      +
      @@ -87,10 +86,9 @@ declare var ResizeObserver;
      - - More information for - OpenAIRE Research Graph - . + + Powered by OpenAIRE graph +
      @@ -116,7 +114,8 @@ declare var ResizeObserver;
      - ` + `, + styleUrls: ['terminology.component.less'] }) export class TerminologyComponent implements OnInit, OnDestroy, AfterViewInit, AfterContentChecked { public tab: 'entities' | 'attributes' = 'entities'; diff --git a/sdg/sdg.component.ts b/sdg/sdg.component.ts index 1a3dcb53..bb581742 100644 --- a/sdg/sdg.component.ts +++ b/sdg/sdg.component.ts @@ -55,26 +55,26 @@ export class SdgComponent implements OnInit, OnDestroy { this.updateUrl(this.url); this.updateTitle(this.pageTitle); this.updateDescription(this.pageDescription); - this.vocabulariesService.getSDGs(properties).subscribe(data => { + this.subscriptions.push(this.vocabulariesService.getSDGs(properties).subscribe(data => { 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 innerItem.id === this.sdgs[i].id)) + }); + } + this.displayedSdgs = merged; + this.loading = false; + })); + })); let refineParams = null; if(this.customFilter) { let refineValue = StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId))); 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 innerItem.id === this.sdgs[i].id)) - }); - } - this.displayedSdgs = merged; - this.loading = false; - }); } public ngOnDestroy() { diff --git a/searchPages/searchUtils/entitiesSelection.component.ts b/searchPages/searchUtils/entitiesSelection.component.ts index d9da0d6d..9241f78e 100644 --- a/searchPages/searchUtils/entitiesSelection.component.ts +++ b/searchPages/searchUtils/entitiesSelection.component.ts @@ -56,6 +56,7 @@ export class EntitiesSelectionComponent { showPage["" + data['pages'][i]["route"] + ""] = data['pages'][i]["isEnabled"]; } } + this.entities = []; if(this.onlyresults) { if(this.simpleView) { this.entities.push({label: 'All ' + OpenaireEntities.RESULTS.toLowerCase(), value: 'all'}); diff --git a/searchPages/searchUtils/portal-search-result.component.html b/searchPages/searchUtils/portal-search-result.component.html index 8a20d567..9c202293 100644 --- a/searchPages/searchUtils/portal-search-result.component.html +++ b/searchPages/searchUtils/portal-search-result.component.html @@ -3,7 +3,7 @@
    • + [ngClass]="result.type" [class.noColor]="properties.adminToolsPortalType == 'connect'" [class.uk-disabled]="!hasPermission(result)">
      Member
      @@ -49,7 +49,7 @@
    -

    +

    {{result.description | htmlToString}}

    diff --git a/searchPages/searchUtils/portal-search-result.component.less b/searchPages/searchUtils/portal-search-result.component.less index e43a61fd..a631ad17 100644 --- a/searchPages/searchUtils/portal-search-result.component.less +++ b/searchPages/searchUtils/portal-search-result.component.less @@ -11,15 +11,15 @@ @media(min-width: @breakpoint-medium) { .uk-card { - &.funder { + &.funder:not(.noColor) { .setType(@funder-color); } - &.ri { + &.ri:not(.noColor) { .setType(@ri-color); } - &.organization { + &.organization:not(.noColor) { .setType(@organization-color); } } @@ -27,15 +27,15 @@ @media(max-width: @breakpoint-small-max) { .uk-card { - &.funder { + &.funder:not(.noColor) { .setType(@funder-color, bottom); } - &.ri { + &.ri:not(.noColor) { .setType(@ri-color, bottom); } - &.organization { + &.organization:not(.noColor) { .setType(@organization-color, bottom); } } diff --git a/searchPages/searchUtils/portal-search-result.module.ts b/searchPages/searchUtils/portal-search-result.module.ts index ce1ebcf2..96a31172 100644 --- a/searchPages/searchUtils/portal-search-result.module.ts +++ b/searchPages/searchUtils/portal-search-result.module.ts @@ -11,12 +11,13 @@ import {UrlPrefixModule} from "../../utils/pipes/url-prefix.module"; import {IconsService} from "../../utils/icons/icons.service"; import {incognito, restricted} from "../../utils/icons/icons"; import {LogoUrlPipeModule} from "../../utils/pipes/logoUrlPipe.module"; +import {HTMLToStringPipeModule} from "../../utils/pipes/HTMLToStringPipe.module"; @NgModule({ imports: [ CommonModule, FormsModule, RouterModule, ErrorMessagesModule, - AlertModalModule, ManageModule, IconsModule, UrlPrefixModule, LogoUrlPipeModule + AlertModalModule, ManageModule, IconsModule, UrlPrefixModule, LogoUrlPipeModule, HTMLToStringPipeModule ], declarations: [ PortalSearchResultComponent diff --git a/services/metrics.service.ts b/services/metrics.service.ts index 2c401656..4b3adf99 100644 --- a/services/metrics.service.ts +++ b/services/metrics.service.ts @@ -58,7 +58,7 @@ export class MetricsService { info = {}; info.name = result[2]; - info.url = properties.searchLinkToDataProvider+id; + info.url = id; info.numOfDownloads = "0"; info.openaireDownloads = "0"; info.numOfViews = "0"; diff --git a/sharedComponents/input/input.component.ts b/sharedComponents/input/input.component.ts index 5d83e1fa..98f4b9c4 100644 --- a/sharedComponents/input/input.component.ts +++ b/sharedComponents/input/input.component.ts @@ -15,13 +15,12 @@ import { ViewChild, ViewChildren } from "@angular/core"; -import {AbstractControl, UntypedFormArray, UntypedFormControl, ValidatorFn} from "@angular/forms"; +import {AbstractControl, UntypedFormArray, UntypedFormControl, UntypedFormGroup, ValidatorFn} from "@angular/forms"; import {HelperFunctions} from "../../utils/HelperFunctions.class"; import {BehaviorSubject, Subscription} from "rxjs"; import {EnvProperties} from "../../utils/properties/env-properties"; import {properties} from "../../../../environments/environment"; import {ClickEvent} from "../../utils/click/click-outside-or-esc.directive"; -import {element} from "protractor"; export type InputType = 'text' @@ -31,7 +30,8 @@ export type InputType = | 'autocomplete_soft' | 'textarea' | 'select' - | 'chips'; + | 'chips' + | 'year-range'; export interface Option { icon?: string, @@ -48,6 +48,16 @@ export interface Placeholder { static?: boolean } +export interface YearRange { + from: ControlConfiguration, + to: ControlConfiguration +} + +export interface ControlConfiguration { + control: string, + placeholder: string +} + declare var UIkit; /** @@ -63,11 +73,11 @@ declare var UIkit;
    -
    +
    + +
    + +
    +
    -
    +
    + +
    +
    @@ -157,6 +178,7 @@ declare var UIkit;
    +
    @@ -179,7 +201,7 @@ declare var UIkit;
    - {{formControl.errors.error}} + {{errors?.error}} Please provide a valid URL (e.g. https://example.com) @@ -213,7 +235,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang @Input() tooltip: boolean = false; @Input() searchable: boolean = false; /** Text */ - @ViewChild('input') input: ElementRef; + @ViewChildren('input') input: QueryList; /** Textarea options */ @ViewChild('textArea') textArea: ElementRef; @Input('rows') rows: number = 3; @@ -236,6 +258,10 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang @Input() visibleChips: number = 1; @Input() separators: string[] = []; @Input() noWrap: boolean = false; + /** Year Range Configuration */ + @Input() yearRange: YearRange; + public activeIndex: 0 | 1 | null = null; + @Input() visibleRows: number = -1; @Input() extendEnter: () => void = null; @Output() focusEmitter: EventEmitter = new EventEmitter(); @@ -259,7 +285,9 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang @Input() set placeholder(placeholder: string | Placeholder) { - if (typeof placeholder === 'string') { + if(this.type === 'year-range') { + this.placeholderInfo = null; + } else if (typeof placeholder === 'string') { this.placeholderInfo = {label: placeholder, static: false}; } else { if (placeholder.static && (this.type === 'autocomplete' || this.hint)) { @@ -325,9 +353,9 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang @HostListener('window:keydown.arrowLeft', ['$event']) arrowLeft(event: KeyboardEvent) { - if (this.focused) { - event.preventDefault(); + if (this.type === 'chips' && this.focused) { if (this.activeElement.getValue()) { + event.preventDefault(); let index = this.chips.toArray().indexOf(this.activeElement.getValue()); if (index > 0) { this.activeElement.next(this.chips.get(index - 1)); @@ -339,9 +367,9 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang @HostListener('window:keydown.arrowRight', ['$event']) arrowRight(event: KeyboardEvent) { - if (this.focused) { - event.preventDefault(); + if (this.type === 'chips' && this.focused) { if (this.activeElement.getValue()) { + event.preventDefault(); let index = this.chips.toArray().indexOf(this.activeElement.getValue()); if (index < this.chips.length - 1) { this.activeElement.next(this.chips.get(index + 1)); @@ -432,6 +460,22 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang this.unsubscribe(); } + getFormByName(name: string): UntypedFormControl { + if (this.formControl instanceof UntypedFormGroup) { + return this.formControl.get(name); + } else { + return null; + } + } + + get formAsGroup(): UntypedFormGroup { + if (this.formControl instanceof UntypedFormGroup) { + return this.formControl; + } else { + return null; + } + } + get formAsControl(): UntypedFormControl { if (this.formControl instanceof UntypedFormControl) { return this.formControl; @@ -448,6 +492,25 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang } } + get yearRangeActive(): boolean { + if(this.yearRange) { + return this.formAsGroup && (this.getFormByName(this.yearRange.from.control)?.value || this.getFormByName(this.yearRange.to.control)?.value); + } + return false; + } + + get errors(): any { + if(this.formAsGroup) { + return (this.formAsGroup.errors + ?this.formAsGroup.errors:(this.getFormByName(this.yearRange.from.control).errors + ?this.getFormByName(this.yearRange.from.control).errors:this.getFormByName(this.yearRange.to.control).errors)); + } else if(this.formAsControl) { + return this.formAsControl.errors; + } else { + return this.searchControl.errors; + } + } + reset() { this.secure = true; this.unsubscribe(); @@ -455,7 +518,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang if (this.type === 'logoURL') { this.secure = (!this.initValue || this.initValue.includes('https://')); } - if (this.optionsArray) { + if (this.optionsArray?.length > 0) { this.filteredOptions = this.filter(''); this.cdr.detectChanges(); } @@ -475,26 +538,28 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang } })); } - if (this.formControl.validator) { + if (this.formAsControl?.validator) { let validator = this.formControl.validator({} as AbstractControl); this.required = (validator && validator.required); } this.subscriptions.push(this.formControl.valueChanges.subscribe(value => { if (this.formControl.enabled) { - value = (value === '') ? null : value; - if (this.type === 'logoURL') { - this.secure = (!value || value.includes('https://')); - } - if (this.initValue === value || (this.initValue === '' && value === null)) { - this.formControl.markAsPristine(); - } else { - this.formControl.markAsDirty(); - } - if (this.type === 'autocomplete_soft') { - this.filteredOptions = this.filter(value); - this.cdr.detectChanges(); - if (this.focused) { - this.open(true); + if(this.type !== 'year-range') { + value = (value === '') ? null : value; + if (this.type === 'logoURL') { + this.secure = (!value || value.includes('https://')); + } + if (this.initValue === value || (this.initValue === '' && value === null)) { + this.formControl.markAsPristine(); + } else { + this.formControl.markAsDirty(); + } + if (this.type === 'autocomplete_soft') { + this.filteredOptions = this.filter(value); + this.cdr.detectChanges(); + if (this.focused) { + this.open(true); + } } } if ((this.value && value && this.value !== value) || (!this.value && value) || this.value && !value) { @@ -502,8 +567,36 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang } } })); + if(this.formAsGroup) { + let fromControl = this.formAsGroup.get(this.yearRange.from.control); + this.subscriptions.push(fromControl.valueChanges.subscribe(value => { + let from = this.initValue[this.yearRange.from.control]; + if (from === value || (from === '' && value === null)) { + fromControl.markAsPristine(); + } else { + fromControl.markAsDirty(); + } + if(fromControl.valid) { + if(this.activeIndex === 0 && value) { + this.activeIndex = 1; + this.input.get(this.activeIndex).nativeElement.focus(); + } + } + })); + let toControl = this.formAsGroup.get(this.yearRange.to.control); + this.subscriptions.push(toControl.valueChanges.subscribe(value => { + let to = this.initValue[this.yearRange.to.control]; + if (to === value || (to === '' && value === null)) { + toControl.markAsPristine(); + } else { + toControl.markAsDirty(); + } + })); + } if (this.input) { - this.input.nativeElement.disabled = this.formControl.disabled; + this.input.forEach(input => { + input.nativeElement.disabled = this.formControl.disabled; + }); } } @@ -598,14 +691,17 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang } focus(value: boolean, event = null) { + if(!this.activeIndex) { + this.activeIndex = 0; + } if (this.focused) { this.formControl.markAsTouched(); } this.focused = value; this.cdr.detectChanges(); if (this.focused) { - if (this.input) { - this.input.nativeElement.focus(); + if (this.input?.length > 0) { + this.input.get(this.activeIndex).nativeElement.focus(); } else if (this.textArea) { this.textArea.nativeElement.focus(); } else if (this.searchInput) { @@ -618,9 +714,12 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang this.open(true); } } else { + this.activeIndex = null; this.open(false); if (this.input) { - this.input.nativeElement.blur(); + this.input.forEach(input => { + input.nativeElement.blur(); + }) } else if (this.textArea) { this.textArea.nativeElement.blur(); } else if (this.searchInput) { diff --git a/sharedComponents/navigationBar.component.html b/sharedComponents/navigationBar.component.html index 611a4716..5ce946ca 100644 --- a/sharedComponents/navigationBar.component.html +++ b/sharedComponents/navigationBar.component.html @@ -317,7 +317,7 @@