Commit a3bd6efa2462c48221f9e073694513452e977587

Authored by Vladyslav_Prykhodko
1 parent 8d3e30e8

UI: Improvement firmware autocomplete

@@ -22,7 +22,7 @@ import { Observable } from 'rxjs'; @@ -22,7 +22,7 @@ import { Observable } from 'rxjs';
22 import { PageData } from '@shared/models/page/page-data'; 22 import { PageData } from '@shared/models/page/page-data';
23 import { Firmware, FirmwareInfo, FirmwareType } from '@shared/models/firmware.models'; 23 import { Firmware, FirmwareInfo, FirmwareType } from '@shared/models/firmware.models';
24 import { catchError, map, mergeMap } from 'rxjs/operators'; 24 import { catchError, map, mergeMap } from 'rxjs/operators';
25 -import { deepClone, isDefinedAndNotNull } from '@core/utils'; 25 +import { deepClone } from '@core/utils';
26 26
27 @Injectable({ 27 @Injectable({
28 providedIn: 'root' 28 providedIn: 'root'
@@ -47,7 +47,7 @@ export class FirmwareAutocompleteComponent implements ControlValueAccessor, OnIn @@ -47,7 +47,7 @@ export class FirmwareAutocompleteComponent implements ControlValueAccessor, OnIn
47 47
48 firmwareFormGroup: FormGroup; 48 firmwareFormGroup: FormGroup;
49 49
50 - modelValue: string | null; 50 + modelValue: string | EntityId | null;
51 51
52 @Input() 52 @Input()
53 type = FirmwareType.FIRMWARE; 53 type = FirmwareType.FIRMWARE;
@@ -182,8 +182,8 @@ export class FirmwareAutocompleteComponent implements ControlValueAccessor, OnIn @@ -182,8 +182,8 @@ export class FirmwareAutocompleteComponent implements ControlValueAccessor, OnIn
182 if (firmwareId !== '') { 182 if (firmwareId !== '') {
183 this.entityService.getEntity(EntityType.FIRMWARE, firmwareId, {ignoreLoading: true, ignoreErrors: true}).subscribe( 183 this.entityService.getEntity(EntityType.FIRMWARE, firmwareId, {ignoreLoading: true, ignoreErrors: true}).subscribe(
184 (entity) => { 184 (entity) => {
185 - this.modelValue = entity.id.id;  
186 - this.firmwareFormGroup.get('firmwareId').patchValue(entity); 185 + this.modelValue = this.useFullEntityId ? entity.id : entity.id.id;
  186 + this.firmwareFormGroup.get('firmwareId').patchValue(entity, {emitEvent: false});
187 }, 187 },
188 () => { 188 () => {
189 this.modelValue = null; 189 this.modelValue = null;