diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts index 6048c1f944..82beff220f 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts +++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts @@ -127,9 +127,9 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro } private initWriteValue = (): void => { - const modelValue = {objectIds: null, objectsList: []} as ModelValue; + const modelValue = {objectIds: [], objectsList: []} as ModelValue; modelValue.objectIds = this.getObjectsFromJsonAllConfig(); - if (modelValue.objectIds !== null) { + if (modelValue.objectIds.length > 0) { const sortOrder = { property: 'id', direction: Direction.ASC @@ -205,13 +205,13 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro if (this.includesNotZeroInstance(attributeArray, telemetryArray)) { this.addInstances(attributeArray, telemetryArray, objectLwM2MS); } - if (isDefinedAndNotNull(observeArray)) { + if (isDefinedAndNotNull(observeArray) && observeArray.length > 0) { this.updateObserveAttrTelemetryObjects(observeArray, objectLwM2MS, OBSERVE); } - if (isDefinedAndNotNull(attributeArray)) { + if (isDefinedAndNotNull(attributeArray) && attributeArray.length > 0) { this.updateObserveAttrTelemetryObjects(attributeArray, objectLwM2MS, ATTRIBUTE); } - if (isDefinedAndNotNull(telemetryArray)) { + if (isDefinedAndNotNull(telemetryArray) && telemetryArray.length > 0) { this.updateObserveAttrTelemetryObjects(telemetryArray, objectLwM2MS, TELEMETRY); } if (isDefinedAndNotNull(keyNameJson)) { @@ -368,7 +368,7 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro }); } } - return (objectsIds.size > 0) ? Array.from(objectsIds) : null; + return (objectsIds.size > 0) ? Array.from(objectsIds) : []; } private upDateJsonAllConfig = (): void => { diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/profile-config.models.ts b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/profile-config.models.ts index 24f2df4b39..86870d559d 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/profile-config.models.ts +++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/profile-config.models.ts @@ -59,7 +59,7 @@ export const SECURITY_CONFIG_MODE_NAMES = new Map( ); export interface ModelValue { - objectIds: string[] | null, + objectIds: string[], objectsList: ObjectLwM2M[] }