diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-resource.component.html b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-resource.component.html index 86c232d488..ed7be232b3 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-resource.component.html +++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-resource.component.html @@ -55,12 +55,14 @@
diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-resource.component.ts b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-resource.component.ts index 678137140d..f3b2279f8d 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-resource.component.ts +++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-observe-attr-telemetry-resource.component.ts @@ -14,13 +14,13 @@ /// limitations under the License. /// -import { Component, forwardRef, Input } from '@angular/core'; -import { ControlValueAccessor, FormArray, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms'; -import { ResourceLwM2M } from '@home/components/profile/device/lwm2m/profile-config.models'; -import { Store } from '@ngrx/store'; -import { AppState } from '@core/core.state'; +import {Component, forwardRef, Input} from '@angular/core'; +import {ControlValueAccessor, FormArray, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators} from '@angular/forms'; +import {ResourceLwM2M} from '@home/components/profile/device/lwm2m/profile-config.models'; +import {Store} from '@ngrx/store'; +import {AppState} from '@core/core.state'; import _ from 'lodash'; -import { coerceBooleanProperty } from '@angular/cdk/coercion'; +import {coerceBooleanProperty} from '@angular/cdk/coercion'; @Component({ selector: 'tb-profile-lwm2m-observe-attr-telemetry-resource', @@ -95,7 +95,7 @@ export class Lwm2mObserveAttrTelemetryResourceComponent implements ControlValueA } else { this.resourceFormArray.clear(); resourcesLwM2M.forEach(resourceLwM2M => { - this.resourceFormArray.push(this.fb.group({ + this.resourceFormArray.push(this.fb.group( { id: resourceLwM2M.id, name: resourceLwM2M.name, observe: resourceLwM2M.observe, @@ -124,4 +124,10 @@ export class Lwm2mObserveAttrTelemetryResourceComponent implements ControlValueA trackByParams = (index: number): number => { return index; } + + updateObserve = (index: number): void =>{ + if (this.resourceFormArray.at(index).value.attribute === false && this.resourceFormArray.at(index).value.telemetry === false) { + this.resourceFormArray.at(index).patchValue({observe: false}); + } + } }