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 5ce7620e32..1711f11ade 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 @@ -73,8 +73,7 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro this.requiredValue = coerceBooleanProperty(value); } - private propagateChange = (v: any) => { - }; + private propagateChange = (v: any) => { }; constructor(private store: Store, private fb: FormBuilder, @@ -141,7 +140,7 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro } private updateWriteValue = (value: any): void => { - const objectsList = deepClone(value.objectsList); + const objectsList = value.objectsList; this.lwm2mDeviceProfileTransportConfFormGroup.patchValue({ objectIds: value, observeAttrTelemetry: {clientLwM2M: this.getObserveAttrTelemetryObjects(objectsList)}, @@ -251,12 +250,12 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro } private getObserveAttrTelemetryObjects = (listObject: ObjectLwM2M[]): ObjectLwM2M [] => { - const clientObserveAttr = deepClone(listObject); + const clientObserveAttr = listObject; if (this.configurationValue[this.observeAttr]) { - const observeArray = this.configurationValue[this.observeAttr][this.observe] as Array; - const attributeArray = this.configurationValue[this.observeAttr][this.attribute] as Array; - const telemetryArray = this.configurationValue[this.observeAttr][this.telemetry] as Array; - const keyNameJson = this.configurationValue[this.observeAttr][this.keyName] as JsonObject; + const observeArray = this.configurationValue[this.observeAttr][this.observe]; + const attributeArray = this.configurationValue[this.observeAttr][this.attribute]; + const telemetryArray = this.configurationValue[this.observeAttr][this.telemetry]; + const keyNameJson = this.configurationValue[this.observeAttr][this.keyName]; if (this.includesInstancesNo(attributeArray, telemetryArray)) { this.addInstances(attributeArray, telemetryArray, clientObserveAttr); } diff --git a/ui-ngx/src/app/modules/home/pages/device/lwm2m/security-config-server.component.ts b/ui-ngx/src/app/modules/home/pages/device/lwm2m/security-config-server.component.ts index b9e1ddf6b0..d88115e266 100644 --- a/ui-ngx/src/app/modules/home/pages/device/lwm2m/security-config-server.component.ts +++ b/ui-ngx/src/app/modules/home/pages/device/lwm2m/security-config-server.component.ts @@ -15,19 +15,17 @@ /// import { Component, forwardRef, Inject, Input, OnInit } from '@angular/core'; - -import { - ControlValueAccessor, - FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators -} from '@angular/forms'; +import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms'; import { - SECURITY_CONFIG_MODE, - SECURITY_CONFIG_MODE_NAMES, - KEY_REGEXP_HEX_DEC, - ServerSecurityConfig, DeviceCredentialsDialogLwm2mData, + KEY_REGEXP_HEX_DEC, + LEN_MAX_PRIVATE_KEY, LEN_MAX_PSK, - LEN_MAX_PRIVATE_KEY, LEN_MAX_PUBLIC_KEY_RPK, LEN_MAX_PUBLIC_KEY_X509 + LEN_MAX_PUBLIC_KEY_RPK, + LEN_MAX_PUBLIC_KEY_X509, + SECURITY_CONFIG_MODE, + SECURITY_CONFIG_MODE_NAMES, + ServerSecurityConfig } from '@home/pages/device/lwm2m/security-config.models'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; diff --git a/ui-ngx/src/app/modules/home/pages/device/lwm2m/security-config.component.ts b/ui-ngx/src/app/modules/home/pages/device/lwm2m/security-config.component.ts index 3fcd0ae01d..32e1f0736f 100644 --- a/ui-ngx/src/app/modules/home/pages/device/lwm2m/security-config.component.ts +++ b/ui-ngx/src/app/modules/home/pages/device/lwm2m/security-config.component.ts @@ -15,7 +15,7 @@ /// -import {Component, Inject, OnInit } from '@angular/core'; +import { Component, Inject, OnInit } from '@angular/core'; import { DialogComponent } from '@shared/components/dialog.component'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; @@ -24,22 +24,22 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { TranslateService } from '@ngx-translate/core'; import { - SECURITY_CONFIG_MODE_NAMES, - SECURITY_CONFIG_MODE, - SecurityConfigModels, - ClientSecurityConfigPSK, - ClientSecurityConfigRPK, - JSON_ALL_CONFIG, - KEY_REGEXP_HEX_DEC, - DeviceCredentialsDialogLwm2mData, BOOTSTRAP_SERVER, BOOTSTRAP_SERVERS, - LWM2M_SERVER, - ClientSecurityConfigX509, ClientSecurityConfigNoSEC, + ClientSecurityConfigPSK, + ClientSecurityConfigRPK, + ClientSecurityConfigX509, + DeviceCredentialsDialogLwm2mData, getDefaultClientSecurityConfigType, + JSON_ALL_CONFIG, + KEY_REGEXP_HEX_DEC, LEN_MAX_PSK, - LEN_MAX_PUBLIC_KEY_RPK + LEN_MAX_PUBLIC_KEY_RPK, + LWM2M_SERVER, + SECURITY_CONFIG_MODE, + SECURITY_CONFIG_MODE_NAMES, + SecurityConfigModels } from './security-config.models'; import { WINDOW } from '@core/services/window.service'; import { MatTabChangeEvent } from '@angular/material/tabs'; @@ -65,9 +65,9 @@ export class SecurityConfigComponent extends DialogComponent, protected router: Router, @@ -111,23 +111,23 @@ export class SecurityConfigComponent extends DialogComponent { - switch (jsonAllConfig.client.securityConfigClientMode.toString()) { - case SECURITY_CONFIG_MODE.NO_SEC.toString(): + switch (jsonAllConfig.client.securityConfigClientMode) { + case SECURITY_CONFIG_MODE.NO_SEC: break; - case SECURITY_CONFIG_MODE.PSK.toString(): + case SECURITY_CONFIG_MODE.PSK: const clientSecurityConfigPSK = jsonAllConfig.client as ClientSecurityConfigPSK; this.lwm2mConfigFormGroup.patchValue({ identityPSK: clientSecurityConfigPSK.identity, clientKey: clientSecurityConfigPSK.key, }, {emitEvent: false}); break; - case SECURITY_CONFIG_MODE.RPK.toString(): + case SECURITY_CONFIG_MODE.RPK: const clientSecurityConfigRPK = jsonAllConfig.client as ClientSecurityConfigRPK; this.lwm2mConfigFormGroup.patchValue({ clientKey: clientSecurityConfigRPK.key, }, {emitEvent: false}); break; - case SECURITY_CONFIG_MODE.X509.toString(): + case SECURITY_CONFIG_MODE.X509: const clientSecurityConfigX509 = jsonAllConfig.client as ClientSecurityConfigX509; this.lwm2mConfigFormGroup.patchValue({ clientCertificate: clientSecurityConfigX509.x509 @@ -295,7 +295,7 @@ export class SecurityConfigComponent extends DialogComponent { const securityMode = 'securityMode'; - if (this.lwm2mConfigFormGroup.get('bootstrapServer').value[securityMode] === SECURITY_CONFIG_MODE.PSK.toString()) { + if (this.lwm2mConfigFormGroup.get('bootstrapServer').value[securityMode] === SECURITY_CONFIG_MODE.PSK) { this.lwm2mConfigFormGroup.get('bootstrapFormGroup').patchValue({ clientPublicKeyOrId: this.lwm2mConfigFormGroup.get('identityPSK').value }); @@ -303,7 +303,7 @@ export class SecurityConfigComponent extends DialogComponent