From 062f1a23c4f55a1d98c185f53f490795c4c89145 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 10 Jan 2023 02:25:03 +0200 Subject: [PATCH 01/13] [Explore | master & Library | angular-14]: composer.ts: [Bug fix] Add parenthesis around ternary operator in method composeEmailForExplore() - empty or wrong body | contact-us.component.html: Added #captchaElem in | contact-us.component.ts: Added ViewChild for captchaElem and added method "resetRecaptcha()" | contact.component.html: Added #contactUs in | contact.component.ts: Added ViewChild for contactUs and call contactUsComponent.resetRecaptcha() on reset method. --- contact-us/contact-us.component.html | 2 +- contact-us/contact-us.component.ts | 9 ++++++++- utils/email/composer.ts | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/contact-us/contact-us.component.html b/contact-us/contact-us.component.html index 11285a71..ad78e795 100644 --- a/contact-us/contact-us.component.html +++ b/contact-us/contact-us.component.html @@ -26,7 +26,7 @@
- +
diff --git a/contact-us/contact-us.component.ts b/contact-us/contact-us.component.ts index 19c1a9dc..e86006a2 100644 --- a/contact-us/contact-us.component.ts +++ b/contact-us/contact-us.component.ts @@ -1,7 +1,8 @@ -import {Component, EventEmitter, Input, Output} from '@angular/core'; +import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core'; import {FormGroup} from '@angular/forms'; import {EnvProperties} from "../utils/properties/env-properties"; import {properties} from "../../../environments/environment"; +import {RecaptchaComponent} from "ng-recaptcha"; @Component({ selector: 'contact-us', @@ -18,6 +19,8 @@ export class ContactUsComponent { @Input() public scrollspy: boolean = false; @Input() public sending: boolean = false; @Output() sendEmitter: EventEmitter = new EventEmitter(); + @ViewChild('captchaElem') captchaElem: RecaptchaComponent; + public properties: EnvProperties = properties; public send() { @@ -29,4 +32,8 @@ export class ContactUsComponent { public handleRecaptcha(captchaResponse: string) { this.contactForm.get('recaptcha').setValue(captchaResponse); } + + public resetRecaptcha() { + this.captchaElem.reset(); + } } diff --git a/utils/email/composer.ts b/utils/email/composer.ts index 4fc023a1..14de4338 100644 --- a/utils/email/composer.ts +++ b/utils/email/composer.ts @@ -86,7 +86,7 @@ export class Composer { + "Name: " + contactForm.name + "
" + "Surname: " + contactForm.surname + "
" + "Email: " + contactForm.email + "
" - + "Affiliation: " + contactForm.affiliation ? contactForm.affiliation : '-' + "
" + + "Affiliation: " + (contactForm.affiliation ? contactForm.affiliation : '-') + "
" + "

" + contactForm.message + "

" + "
"; email.recipients = admins; From eddd7e00b9062eb177d3d3db59b9f169da4c1366 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 11 Jan 2023 15:35:13 +0200 Subject: [PATCH 02/13] Number round: Add level of round and round to 1 decimal --- utils/number-utils.class.ts | 66 +++++++++++++++++--------------- utils/pipes/number-round.pipe.ts | 9 ++--- 2 files changed, 39 insertions(+), 36 deletions(-) diff --git a/utils/number-utils.class.ts b/utils/number-utils.class.ts index 5abe2ce5..064f0c05 100644 --- a/utils/number-utils.class.ts +++ b/utils/number-utils.class.ts @@ -1,38 +1,44 @@ +export enum Level { + NONE, + K, + M, + B +} + + export interface NumberSize { number: number; - size: "B" | "M" | "K" | ""; + size: "B" | "M" | "K" | "" count: number; } -export class NumberUtils{ +export class NumberUtils { - public static roundNumber(num: number):any { - //console.log("Trying to round number: "+ num); - var roundNum: NumberSize = null; - var initialNum = num; - if (num >= 1000000000) { - num = num / 1000000; - num = Math.round(num); - roundNum = {number: num, size: "B", count: initialNum}; - } else if(num >= 1000000) { - num=num/1000000; - num= Math.round(num); - roundNum = { number: num, size: "M", count: initialNum}; - }else if( num >= 1000){ - num=num/1000; - num= Math.round(num); - roundNum = { number: num, size: "K", count: initialNum}; - }else if (num >= 100) { - num=num/100; - num= Math.round(num); - num=num*100; - roundNum = { number: num, size: "" , count: initialNum}; - }else{ - roundNum = { number: num, size: "" , count: initialNum}; - } - return roundNum; + public static roundNumber(num: number, level: Level = Level.NONE): any { + var roundNum: NumberSize; + var initialNum = num; + if (num >= 1000000000 && level <= Level.B) { + num = num / 1000000; + num = Math.round(num * 10) / 10; + roundNum = {number: num, size: "B", count: initialNum}; + } else if (num >= 1000000 && level <= Level.M) { + num = num / 1000000; + num = Math.round(num * 10) / 10; + roundNum = {number: num, size: "M", count: initialNum}; + } else if (num >= 1000 && level <= Level.K) { + num = num / 1000; + num = Math.round(num * 10) / 10; + roundNum = {number: num, size: "K", count: initialNum}; + } else if (num >= 100) { + num = num / 100; + num = Math.round(num * 10) / 10; + num = num * 100; + roundNum = {number: num, size: "", count: initialNum}; + } else { + roundNum = {number: num, size: "", count: initialNum}; + } + return roundNum; } - - - + + } diff --git a/utils/pipes/number-round.pipe.ts b/utils/pipes/number-round.pipe.ts index d714f472..f84ee548 100644 --- a/utils/pipes/number-round.pipe.ts +++ b/utils/pipes/number-round.pipe.ts @@ -1,18 +1,15 @@ import {Pipe, PipeTransform} from "@angular/core"; -import {NumberSize, NumberUtils} from "../number-utils.class"; +import {Level, NumberSize, NumberUtils} from "../number-utils.class"; import {DecimalPipe} from "@angular/common"; @Pipe({name: 'numberRound'}) export class NumberRoundPipe implements PipeTransform { decimalPipe: DecimalPipe = new DecimalPipe("en"); - - constructor() { - - } + constructor() {} transform(value: number): any { - let size: NumberSize = NumberUtils.roundNumber(value); + let size: NumberSize = NumberUtils.roundNumber(value, Level.M); return this.decimalPipe.transform(size.number) + size.size; } } From 4cd5bcd12b6d41cef384b54aa4a9c3fecbb46a1f Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 11 Jan 2023 15:51:55 +0200 Subject: [PATCH 03/13] Number round: Add decimal argument in order to be dynamic --- utils/number-utils.class.ts | 15 ++++++++------- utils/pipes/number-round.pipe.ts | 12 ++++++++++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/utils/number-utils.class.ts b/utils/number-utils.class.ts index 064f0c05..61054a75 100644 --- a/utils/number-utils.class.ts +++ b/utils/number-utils.class.ts @@ -14,24 +14,25 @@ export interface NumberSize { export class NumberUtils { - public static roundNumber(num: number, level: Level = Level.NONE): any { - var roundNum: NumberSize; - var initialNum = num; + public static roundNumber(num: number, level: Level = Level.NONE, decimal = 0): any { + let roundNum: NumberSize; + let initialNum = num; + let variance = Math.pow(10, decimal); if (num >= 1000000000 && level <= Level.B) { num = num / 1000000; - num = Math.round(num * 10) / 10; + num = Math.round(num * variance) / variance; roundNum = {number: num, size: "B", count: initialNum}; } else if (num >= 1000000 && level <= Level.M) { num = num / 1000000; - num = Math.round(num * 10) / 10; + num = Math.round(num * variance) / variance; roundNum = {number: num, size: "M", count: initialNum}; } else if (num >= 1000 && level <= Level.K) { num = num / 1000; - num = Math.round(num * 10) / 10; + num = Math.round(num * variance) / variance; roundNum = {number: num, size: "K", count: initialNum}; } else if (num >= 100) { num = num / 100; - num = Math.round(num * 10) / 10; + num = Math.round(num * variance) / variance; num = num * 100; roundNum = {number: num, size: "", count: initialNum}; } else { diff --git a/utils/pipes/number-round.pipe.ts b/utils/pipes/number-round.pipe.ts index f84ee548..ab8398ea 100644 --- a/utils/pipes/number-round.pipe.ts +++ b/utils/pipes/number-round.pipe.ts @@ -8,8 +8,16 @@ export class NumberRoundPipe implements PipeTransform { constructor() {} - transform(value: number): any { - let size: NumberSize = NumberUtils.roundNumber(value, Level.M); + transform(value: number, ...args: any[]): any { + let level = Level.NONE; + let decimal = 0; + if(args[0]) { + level = args[0]; + } + if(args[1]) { + decimal = args[1]; + } + let size: NumberSize = NumberUtils.roundNumber(value, level, decimal); return this.decimalPipe.transform(size.number) + size.size; } } From da144c1c77012fa4489dd84f013d499f9df8f72a Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Fri, 13 Jan 2023 11:33:53 +0200 Subject: [PATCH 04/13] Round pipe: Make it HTML in order to add class in number's size --- utils/pipes/number-round.pipe.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/pipes/number-round.pipe.ts b/utils/pipes/number-round.pipe.ts index ab8398ea..62608761 100644 --- a/utils/pipes/number-round.pipe.ts +++ b/utils/pipes/number-round.pipe.ts @@ -18,6 +18,6 @@ export class NumberRoundPipe implements PipeTransform { decimal = args[1]; } let size: NumberSize = NumberUtils.roundNumber(value, level, decimal); - return this.decimalPipe.transform(size.number) + size.size; + return this.decimalPipe.transform(size.number) + (size.size?'' + size.size + '':''); } } From 53400f774505b7461ba5773f3d2d40cfc7091e34 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Fri, 20 Jan 2023 17:31:36 +0200 Subject: [PATCH 05/13] Add shouldUpdate in getStakeholder method. Role-verification: Add userInfoLink if user-info is on other portal --- monitor/services/stakeholder.service.ts | 10 +++------- role-verification/role-verification.component.ts | 7 ++++++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/monitor/services/stakeholder.service.ts b/monitor/services/stakeholder.service.ts index 8b546afd..272cbb39 100644 --- a/monitor/services/stakeholder.service.ts +++ b/monitor/services/stakeholder.service.ts @@ -26,12 +26,8 @@ export class StakeholderService { private promise: Promise; private sub; - constructor(private http: HttpClient, private route: ActivatedRoute) { + constructor(private http: HttpClient) { this.stakeholderSubject = new BehaviorSubject(null); -/* let source = new EventSource(properties.monitorServiceAPIURL + "/stakeholder/events", {withCredentials: true}); - source.addEventListener('message', message => { - console.log(message.data); - });*/ } ngOnDestroy() { @@ -44,8 +40,8 @@ export class StakeholderService { } } - getStakeholder(alias: string): Observable { - if (!this.stakeholderSubject.value || this.stakeholderSubject.value.alias !== alias) { + getStakeholder(alias: string, shouldUpdate: boolean = false): Observable { + if (!this.stakeholderSubject.value || this.stakeholderSubject.value.alias !== alias || shouldUpdate) { this.promise = new Promise((resolve, reject) => { this.sub = this.http.get(properties.monitorServiceAPIURL + '/stakeholder/' + encodeURIComponent(alias), CustomOptions.registryOptions()).pipe(map(stakeholder => { return this.formalize(this.checkIsUpload(stakeholder)); diff --git a/role-verification/role-verification.component.ts b/role-verification/role-verification.component.ts index 326b0d23..1f2b3a72 100644 --- a/role-verification/role-verification.component.ts +++ b/role-verification/role-verification.component.ts @@ -65,7 +65,10 @@ import {Composer} from "../utils/email/composer"; We are unable to process the request. What happened?
  • You are logged in with a different email, than the one you have received the invitation. - Check here the email of your account.
  • + Check + here + here + the email of your account.
  • The invitation has been canceled.
  • The URL is invalid.
@@ -84,6 +87,8 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn public service: "connect" | "monitor" = "monitor"; @Input() public userInfoLinkPrefix = ''; + @Input() + public userInfoLink = null; public user: User; public verification: any; public code: UntypedFormControl; From 9f4be4b29b98118e62dbd6ed6b8cd2b8a3e98b90 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 25 Jan 2023 08:00:35 +0200 Subject: [PATCH 06/13] Bottom: Fix shortView. Sidebar: Add toggle and hover behaviour. --- .../sidebar/layout.service.ts | 13 +++++ .../sidebar/sideBar.component.html | 10 ++-- .../sidebar/sideBar.component.ts | 5 -- .../sidebar/sideBar.module.ts | 7 ++- .../sidebar/sidebar-content.component.ts | 29 +++++++++++ sharedComponents/bottom.component.html | 52 ++++++++++--------- 6 files changed, 79 insertions(+), 37 deletions(-) create mode 100644 dashboard/sharedComponents/sidebar/sidebar-content.component.ts diff --git a/dashboard/sharedComponents/sidebar/layout.service.ts b/dashboard/sharedComponents/sidebar/layout.service.ts index f39048df..ed6e67fc 100644 --- a/dashboard/sharedComponents/sidebar/layout.service.ts +++ b/dashboard/sharedComponents/sidebar/layout.service.ts @@ -17,6 +17,11 @@ export class LayoutService { */ private openSubject: BehaviorSubject = new BehaviorSubject(false); + /** + * Set this to true when sidebar is hovered, otherwise false. + */ + private hoverSubject: BehaviorSubject = new BehaviorSubject(false); + /** * Add hasSidebar: false on data of route config, if sidebar is not needed. */ @@ -164,6 +169,14 @@ export class LayoutService { this.openSubject.next(value); } + get hover(): boolean { + return this.hoverSubject.getValue(); + } + + setHover(value: boolean) { + this.hoverSubject.next(value); + } + get hasSidebar(): Observable { return this.hasSidebarSubject.asObservable(); } diff --git a/dashboard/sharedComponents/sidebar/sideBar.component.html b/dashboard/sharedComponents/sidebar/sideBar.component.html index 22c4cb2a..02e606ac 100644 --- a/dashboard/sharedComponents/sidebar/sideBar.component.html +++ b/dashboard/sharedComponents/sidebar/sideBar.component.html @@ -1,5 +1,5 @@