Browse Source

lwm2m: front fix bug create profile lwm2mConfig

pull/4313/head
nickAS21 5 years ago
parent
commit
156c8cc287
  1. 12
      ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts
  2. 2
      ui-ngx/src/app/modules/home/components/profile/device/lwm2m/profile-config.models.ts

12
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 => {

2
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<SECURITY_CONFIG_MODE, string>(
);
export interface ModelValue {
objectIds: string[] | null,
objectIds: string[],
objectsList: ObjectLwM2M[]
}

Loading…
Cancel
Save