Merge pull request #3588 from vvlladd28/bug/entity-select/alias-type
UI: Fixed null id in entity-select component
This commit is contained in:
commit
d4535e317c
@ -97,10 +97,6 @@ export class EntitySelectComponent implements ControlValueAccessor, OnInit, Afte
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.entitySelectFormGroup.get('entityType').valueChanges.subscribe(
|
this.entitySelectFormGroup.get('entityType').valueChanges.subscribe(
|
||||||
(value) => {
|
(value) => {
|
||||||
if(value === AliasEntityType.CURRENT_TENANT || value === AliasEntityType.CURRENT_USER ||
|
|
||||||
value === AliasEntityType.CURRENT_USER_OWNER) {
|
|
||||||
this.modelValue.id = NULL_UUID;
|
|
||||||
}
|
|
||||||
this.updateView(value, this.modelValue.id);
|
this.updateView(value, this.modelValue.id);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -140,20 +136,23 @@ export class EntitySelectComponent implements ControlValueAccessor, OnInit, Afte
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateView(entityType: EntityType | AliasEntityType | null, entityId: string | null) {
|
updateView(entityType: EntityType | AliasEntityType | null, entityId: string | null) {
|
||||||
if (this.modelValue.entityType !== entityType ||
|
if (this.modelValue.entityType !== entityType || this.modelValue.id !== entityId) {
|
||||||
this.modelValue.id !== entityId) {
|
this.modelValue = {
|
||||||
this.modelValue = {
|
entityType,
|
||||||
entityType,
|
id: this.modelValue.entityType !== entityType ? null : entityId
|
||||||
id: this.modelValue.entityType !== entityType ? null : entityId
|
};
|
||||||
};
|
|
||||||
if (this.modelValue.entityType && (this.modelValue.id ||
|
if (this.modelValue.entityType === AliasEntityType.CURRENT_TENANT
|
||||||
this.modelValue.entityType === AliasEntityType.CURRENT_TENANT ||
|
|| this.modelValue.entityType === AliasEntityType.CURRENT_USER
|
||||||
this.modelValue.entityType === AliasEntityType.CURRENT_USER ||
|
|| this.modelValue.entityType === AliasEntityType.CURRENT_USER_OWNER) {
|
||||||
this.modelValue.entityType === AliasEntityType.CURRENT_USER_OWNER)) {
|
this.modelValue.id = NULL_UUID;
|
||||||
this.propagateChange(this.modelValue);
|
}
|
||||||
} else {
|
|
||||||
this.propagateChange(null);
|
if (this.modelValue.entityType && this.modelValue.id) {
|
||||||
}
|
this.propagateChange(this.modelValue);
|
||||||
|
} else {
|
||||||
|
this.propagateChange(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user