From c913b08b53b863e5c7d249ebfc5cf61ece5880e8 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Thu, 20 Jul 2023 15:13:11 +0300 Subject: [PATCH] UI: Fixed entity select component --- .../components/entity/entity-select.component.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/shared/components/entity/entity-select.component.ts b/ui-ngx/src/app/shared/components/entity/entity-select.component.ts index ccc4a0a079..9427c2ff73 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-select.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-select.component.ts @@ -125,16 +125,23 @@ export class EntitySelectComponent implements ControlValueAccessor, OnInit, Afte if (value.id === NULL_UUID) { value.id = null; } + if (value.entityType === AliasEntityType.CURRENT_TENANT + || value.entityType === AliasEntityType.CURRENT_USER + || value.entityType === AliasEntityType.CURRENT_USER_OWNER) { + value.id = NULL_UUID; + } else if (value.entityType === AliasEntityType.CURRENT_CUSTOMER && !value.id) { + this.modelValue.id = NULL_UUID; + } this.modelValue = value; - this.entitySelectFormGroup.get('entityType').patchValue(value.entityType, {emitEvent: true}); - this.entitySelectFormGroup.get('entityId').patchValue(value, {emitEvent: true}); + this.entitySelectFormGroup.get('entityType').patchValue(value.entityType, {emitEvent: false}); + this.entitySelectFormGroup.get('entityId').patchValue(value, {emitEvent: false}); } else { this.modelValue = { entityType: this.defaultEntityType, id: null }; - this.entitySelectFormGroup.get('entityType').patchValue(this.defaultEntityType, {emitEvent: true}); - this.entitySelectFormGroup.get('entityId').patchValue(null, {emitEvent: true}); + this.entitySelectFormGroup.get('entityType').patchValue(this.defaultEntityType, {emitEvent: false}); + this.entitySelectFormGroup.get('entityId').patchValue(null, {emitEvent: false}); } }