Merge pull request #11010 from rusikv/bug/lwm2m-device-profile-transport-config

Fixed LWM2M device profile transport configuration "object list" form field value persistence on tab switch
This commit is contained in:
Igor Kulikov 2024-07-01 16:07:03 +03:00 committed by GitHub
commit 228ef344ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -31,7 +31,7 @@ import { distinctUntilChanged, filter, mergeMap, share, tap } from 'rxjs/operato
import { ObjectLwM2M, PAGE_SIZE_LIMIT } from './lwm2m-profile-config.models'; import { ObjectLwM2M, PAGE_SIZE_LIMIT } from './lwm2m-profile-config.models';
import { DeviceProfileService } from '@core/http/device-profile.service'; import { DeviceProfileService } from '@core/http/device-profile.service';
import { Direction } from '@shared/models/page/sort-order'; import { Direction } from '@shared/models/page/sort-order';
import { isDefined, isDefinedAndNotNull, isString } from '@core/utils'; import { isDefined, isDefinedAndNotNull, isObject, isString } from '@core/utils';
import { PageLink } from '@shared/models/page/page-link'; import { PageLink } from '@shared/models/page/page-link';
import { TruncatePipe } from '@shared/pipe/truncate.pipe'; import { TruncatePipe } from '@shared/pipe/truncate.pipe';
@ -90,12 +90,14 @@ export class Lwm2mObjectListComponent implements ControlValueAccessor, OnInit, V
objectsList: [this.objectsList], objectsList: [this.objectsList],
objectLwm2m: [''] objectLwm2m: ['']
}); });
this.lwm2mListFormGroup.valueChanges.subscribe((value) => { this.lwm2mListFormGroup.get('objectsList').valueChanges.subscribe((value) => {
if (!value.length || (value.length && isObject(value[0]))) {
let formValue = null; let formValue = null;
if (this.lwm2mListFormGroup.valid) { if (this.lwm2mListFormGroup.valid) {
formValue = value.objectsList; formValue = value;
} }
this.propagateChange(formValue); this.propagateChange(formValue);
}
}); });
} }