diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-instances.component.html b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-instances.component.html
index e9e805177f..2ccfd45616 100644
--- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-instances.component.html
+++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-instances.component.html
@@ -32,6 +32,7 @@
@@ -40,14 +41,16 @@
diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-instances.component.ts b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-instances.component.ts
index 04528e4abc..adf0d60db0 100644
--- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-instances.component.ts
+++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-instances.component.ts
@@ -161,6 +161,13 @@ export class Lwm2mObserveAttrTelemetryInstancesComponent implements ControlValue
const resources = deepClone(instance.get('resources').value as ResourceLwM2M[]);
if (value && type === 'observe') {
resources.forEach(resource => resource[type] = resource.telemetry || resource.attribute);
+ } else if (!value && type !== 'observe') {
+ resources.forEach(resource => {
+ resource[type] = value;
+ if (resource.observe && !(resource.telemetry || resource.attribute)) {
+ resource.observe = false;
+ }
+ });
} else {
resources.forEach(resource => resource[type] = value);
}
@@ -190,6 +197,15 @@ export class Lwm2mObserveAttrTelemetryInstancesComponent implements ControlValue
return isDefinedAndNotNull(resources) && resources.every(resource => resource[type]);
}
+ disableObserve(instance: AbstractControl): boolean {
+ return this.disabled || !(
+ this.getIndeterminate(instance, 'telemetry') ||
+ this.getIndeterminate(instance, 'attribute') ||
+ this.getChecked(instance, 'telemetry') ||
+ this.getChecked(instance, 'attribute')
+ );
+ }
+
get isExpend(): boolean {
return this.instancesFormArray.length === 1;
}
diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-resources.component.ts b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-resources.component.ts
index bced631596..8af08d8f36 100644
--- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-resources.component.ts
+++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-resources.component.ts
@@ -129,7 +129,7 @@ export class Lwm2mObserveAttrTelemetryResourcesComponent implements ControlValue
private updatedResources(resources: ResourceLwM2M[]): void {
if (resources.length === this.resourcesFormArray.length) {
- this.resourcesFormArray.patchValue(resources, {emitEvent: false});
+ this.resourcesFormArray.patchValue(resources, {onlySelf: true});
} else {
if (this.valueChange$) {
this.valueChange$.unsubscribe();
@@ -144,7 +144,7 @@ export class Lwm2mObserveAttrTelemetryResourcesComponent implements ControlValue
if (this.disabled) {
this.resourcesFormGroup.disable({emitEvent: false});
}
- this.valueChange$ = this.resourcesFormGroup.valueChanges.subscribe(value => {
+ this.valueChange$ = this.resourcesFormGroup.valueChanges.subscribe(() => {
this.updateModel(this.resourcesFormGroup.getRawValue().resources);
});
}