From 8dd94f6802d1ee2e3ec28cc13f6ead6885caa45c Mon Sep 17 00:00:00 2001 From: kurilova Date: Tue, 18 Feb 2025 12:35:41 +0000 Subject: [PATCH 1/2] Clear form when Create new profile click and then Discard changes click --- .../risk-assessment/profile-form/profile-form.component.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/ui/src/app/pages/risk-assessment/profile-form/profile-form.component.ts b/modules/ui/src/app/pages/risk-assessment/profile-form/profile-form.component.ts index 763645cc1..76cee50dd 100644 --- a/modules/ui/src/app/pages/risk-assessment/profile-form/profile-form.component.ts +++ b/modules/ui/src/app/pages/risk-assessment/profile-form/profile-form.component.ts @@ -114,6 +114,8 @@ export class ProfileFormComponent implements OnInit, AfterViewInit { if (profile && this.nameControl) { this.updateNameValidator(profile); this.fillProfileForm(this.profileFormat, profile); + } else { + this.profileForm.reset(); } } else if (this.profile != profile) { // prevent select profile before user confirmation From a964c375737deac8a059b2bf82f6b02a287dfe43 Mon Sep 17 00:00:00 2001 From: kurilova Date: Tue, 18 Feb 2025 12:51:13 +0000 Subject: [PATCH 2/2] Fix test --- .../risk-assessment/profile-form/profile-form.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ui/src/app/pages/risk-assessment/profile-form/profile-form.component.ts b/modules/ui/src/app/pages/risk-assessment/profile-form/profile-form.component.ts index 76cee50dd..2666e7853 100644 --- a/modules/ui/src/app/pages/risk-assessment/profile-form/profile-form.component.ts +++ b/modules/ui/src/app/pages/risk-assessment/profile-form/profile-form.component.ts @@ -373,7 +373,7 @@ export class ProfileFormComponent implements OnInit, AfterViewInit { }); question.answer = answer; } else { - question.answer = this.profileForm.value[index]?.trim(); + question.answer = this.profileForm.value[index]?.trim() || ''; } questions.push(question); });