UI: LwM2M device profile resource fixed disabled observe checkbox

This commit is contained in:
Vladyslav_Prykhodko 2021-07-01 10:44:48 +03:00 committed by Andrew Shvayka
parent bd558ed4c6
commit 194200da49

View File

@ -164,6 +164,7 @@ export class Lwm2mObserveAttrTelemetryResourcesComponent implements ControlValue
form.get('attribute').valueChanges.pipe(startWith(resource.attribute), takeUntil(this.destroy$)), form.get('attribute').valueChanges.pipe(startWith(resource.attribute), takeUntil(this.destroy$)),
form.get('telemetry').valueChanges.pipe(startWith(resource.telemetry), takeUntil(this.destroy$)) form.get('telemetry').valueChanges.pipe(startWith(resource.telemetry), takeUntil(this.destroy$))
]).subscribe(([attribute, telemetry]) => { ]).subscribe(([attribute, telemetry]) => {
if (!this.disabled) {
if (attribute || telemetry) { if (attribute || telemetry) {
form.get('observe').enable({emitEvent: false}); form.get('observe').enable({emitEvent: false});
} else { } else {
@ -171,6 +172,7 @@ export class Lwm2mObserveAttrTelemetryResourcesComponent implements ControlValue
form.get('observe').patchValue(false, {emitEvent: false}); form.get('observe').patchValue(false, {emitEvent: false});
form.get('attributes').patchValue({}, {emitEvent: false}); form.get('attributes').patchValue({}, {emitEvent: false});
} }
}
}); });
return form; return form;
} }