From 03b647c525542c8553d6f39dcc434146eaf70de1 Mon Sep 17 00:00:00 2001 From: nickAS21 Date: Thu, 4 Mar 2021 17:19:07 +0200 Subject: [PATCH] Lwm2m: front: validateObject on the start fix bug --- ...ice-profile-transport-configuration.component.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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 2fa7c1cb9a..519ecc2981 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 @@ -219,9 +219,9 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro this.updateObserveAttrTelemetryObjects(telemetryArray, clientObserveAttrTelemetry, TELEMETRY); } if (isDefinedAndNotNull(keyNameJson)) { - this.configurationValue.observeAttr.keyName = deepClone(this.validateKeyNameObjects(keyNameJson, attributeArray, telemetryArray)); - keyNameJson = this.configurationValue.observeAttr.keyName; - this.updateKeyNameObjects(keyNameJson, clientObserveAttrTelemetry); + this.configurationValue.observeAttr.keyName = this.validateKeyNameObjects(keyNameJson, attributeArray, telemetryArray); + this.upDateJsonAllConfig(); + this.updateKeyNameObjects(clientObserveAttrTelemetry); } } return {clientLwM2M: clientObserveAttrTelemetry}; @@ -260,14 +260,13 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro }); } - private updateKeyNameObjects = (nameJson: JsonObject, clientObserveAttrTelemetry: ObjectLwM2M[]): void => { - const keyName = JSON.parse(JSON.stringify(nameJson)); - Object.keys(keyName).forEach(key => { + private updateKeyNameObjects = (clientObserveAttrTelemetry: ObjectLwM2M[]): void => { + Object.keys(this.configurationValue.observeAttr.keyName).forEach(key => { const [objectId, instanceId, resourceId] = Array.from(key.substring(1).split('/'), Number); clientObserveAttrTelemetry.find(objectLwm2m => objectLwm2m.id === objectId) .instances.find(instance => instance.id === instanceId) .resources.find(resource => resource.id === resourceId) - .keyName = keyName[key]; + .keyName = this.configurationValue.observeAttr.keyName[key]; }); }