From aa573dbc474b6ff053db7cad063caa217f9fdd6b Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Thu, 1 Aug 2024 12:56:06 +0300 Subject: [PATCH 1/5] UI: Update target on resend message --- .../src/app/shared/components/entity/entity-list.component.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui-ngx/src/app/shared/components/entity/entity-list.component.ts b/ui-ngx/src/app/shared/components/entity/entity-list.component.ts index a4d7c9bab0..566ba78707 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-list.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-list.component.ts @@ -187,8 +187,10 @@ export class EntityListComponent implements ControlValueAccessor, OnInit, AfterV this.modelValue = [...value]; this.entityService.getEntities(this.entityType, value).subscribe( (entities) => { + this.modelValue = entities.map(entity => entity.id.id); this.entities = entities; this.entityListFormGroup.get('entities').setValue(this.entities); + this.propagateChange(this.modelValue); } ); } else { From 4b00ef6052362efbf8256447566d92d5a28ba3de Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Fri, 2 Aug 2024 12:37:22 +0300 Subject: [PATCH 2/5] UI: Refactoring --- .../sent/sent-notification-dialog.component.html | 1 + .../shared/components/entity/entity-list.component.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html index 16c6e1d7f9..7fadf5763b 100644 --- a/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html +++ b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html @@ -104,6 +104,7 @@ ; @ViewChild('entityAutocomplete') matAutocomplete: MatAutocomplete; @ViewChild('chipList', {static: true}) chipList: MatChipGrid; @@ -187,10 +192,11 @@ export class EntityListComponent implements ControlValueAccessor, OnInit, AfterV this.modelValue = [...value]; this.entityService.getEntities(this.entityType, value).subscribe( (entities) => { - this.modelValue = entities.map(entity => entity.id.id); this.entities = entities; this.entityListFormGroup.get('entities').setValue(this.entities); - this.propagateChange(this.modelValue); + if (this.propagateOnSubscribe) { + this.propagateChange(this.modelValue); + } } ); } else { From e74d6f4534e774c8ebb778815bc947fcf9afb1d3 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Mon, 5 Aug 2024 09:38:48 +0300 Subject: [PATCH 3/5] UI: Refactoring --- .../notification/sent/sent-notification-dialog.component.html | 2 +- .../src/app/shared/components/entity/entity-list.component.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html index 7fadf5763b..2bc622e982 100644 --- a/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html +++ b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html @@ -104,7 +104,7 @@ ; @ViewChild('entityAutocomplete') matAutocomplete: MatAutocomplete; @@ -194,7 +194,7 @@ export class EntityListComponent implements ControlValueAccessor, OnInit, AfterV (entities) => { this.entities = entities; this.entityListFormGroup.get('entities').setValue(this.entities); - if (this.propagateOnSubscribe) { + if (this.syncedIdListPropagator) { this.propagateChange(this.modelValue); } } From eb66fd30cce02425ebf88f5be6f73d8605c67a93 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Mon, 5 Aug 2024 10:21:51 +0300 Subject: [PATCH 4/5] UI: Refactoring --- .../components/entity/entity-list.component.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/ui-ngx/src/app/shared/components/entity/entity-list.component.ts b/ui-ngx/src/app/shared/components/entity/entity-list.component.ts index cac200b81c..7286258c5a 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-list.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-list.component.ts @@ -56,11 +56,6 @@ import { coerceBoolean } from '@shared/decorators/coercion'; provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => EntityListComponent), multi: true - }, - { - provide: NG_VALIDATORS, - useExisting: forwardRef(() => EntityListComponent), - multi: true } ] }) @@ -194,7 +189,8 @@ export class EntityListComponent implements ControlValueAccessor, OnInit, AfterV (entities) => { this.entities = entities; this.entityListFormGroup.get('entities').setValue(this.entities); - if (this.syncedIdListPropagator) { + if (this.syncedIdListPropagator && this.modelValue.length !== entities.length) { + this.modelValue = entities.map(entity => entity.id.id); this.propagateChange(this.modelValue); } } @@ -207,12 +203,6 @@ export class EntityListComponent implements ControlValueAccessor, OnInit, AfterV this.dirty = true; } - validate(): ValidationErrors | null { - return this.entityListFormGroup.valid ? null : { - entities: {valid: false} - }; - } - private reset() { this.entities = []; this.entityListFormGroup.get('entities').setValue(this.entities); From 69ff2bb506c907c714a63524851585ae63670d2d Mon Sep 17 00:00:00 2001 From: Vladyslav Prykhodko Date: Mon, 19 Aug 2024 14:51:53 +0300 Subject: [PATCH 5/5] Update entity-list.component.ts --- .../shared/components/entity/entity-list.component.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ui-ngx/src/app/shared/components/entity/entity-list.component.ts b/ui-ngx/src/app/shared/components/entity/entity-list.component.ts index 7286258c5a..ffa8e915f1 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-list.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-list.component.ts @@ -56,6 +56,11 @@ import { coerceBoolean } from '@shared/decorators/coercion'; provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => EntityListComponent), multi: true + }, + { + provide: NG_VALIDATORS, + useExisting: forwardRef(() => EntityListComponent), + multi: true } ] }) @@ -203,6 +208,12 @@ export class EntityListComponent implements ControlValueAccessor, OnInit, AfterV this.dirty = true; } + validate(): ValidationErrors | null { + return this.entityListFormGroup.valid ? null : { + entities: {valid: false} + }; + } + private reset() { this.entities = []; this.entityListFormGroup.get('entities').setValue(this.entities);