lwm2m: front fix bug profile updateObserve
This commit is contained in:
parent
8b23bd999f
commit
23373b055e
@ -55,12 +55,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div fxFlex="10">
|
<div fxFlex="10">
|
||||||
<mat-checkbox formControlName="attribute" color="warn"
|
<mat-checkbox formControlName="attribute" color="warn"
|
||||||
|
[checked]="updateObserve(i)"
|
||||||
matTooltip="{{'device-profile.lwm2m.is-attr-tip' | translate}}"
|
matTooltip="{{'device-profile.lwm2m.is-attr-tip' | translate}}"
|
||||||
matTooltipPosition="above">
|
matTooltipPosition="above">
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
</div>
|
</div>
|
||||||
<div fxFlex="10">
|
<div fxFlex="10">
|
||||||
<mat-checkbox formControlName="telemetry" color="primary"
|
<mat-checkbox formControlName="telemetry" color="primary"
|
||||||
|
[checked]="updateObserve(i)"
|
||||||
matTooltip="{{'device-profile.lwm2m.is-telemetry-tip' | translate}}"
|
matTooltip="{{'device-profile.lwm2m.is-telemetry-tip' | translate}}"
|
||||||
matTooltipPosition="above">
|
matTooltipPosition="above">
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
|
|||||||
@ -14,13 +14,13 @@
|
|||||||
/// limitations under the License.
|
/// limitations under the License.
|
||||||
///
|
///
|
||||||
|
|
||||||
import { Component, forwardRef, Input } from '@angular/core';
|
import {Component, forwardRef, Input} from '@angular/core';
|
||||||
import { ControlValueAccessor, FormArray, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms';
|
import {ControlValueAccessor, FormArray, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators} from '@angular/forms';
|
||||||
import { ResourceLwM2M } from '@home/components/profile/device/lwm2m/profile-config.models';
|
import {ResourceLwM2M} from '@home/components/profile/device/lwm2m/profile-config.models';
|
||||||
import { Store } from '@ngrx/store';
|
import {Store} from '@ngrx/store';
|
||||||
import { AppState } from '@core/core.state';
|
import {AppState} from '@core/core.state';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
import {coerceBooleanProperty} from '@angular/cdk/coercion';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tb-profile-lwm2m-observe-attr-telemetry-resource',
|
selector: 'tb-profile-lwm2m-observe-attr-telemetry-resource',
|
||||||
@ -95,7 +95,7 @@ export class Lwm2mObserveAttrTelemetryResourceComponent implements ControlValueA
|
|||||||
} else {
|
} else {
|
||||||
this.resourceFormArray.clear();
|
this.resourceFormArray.clear();
|
||||||
resourcesLwM2M.forEach(resourceLwM2M => {
|
resourcesLwM2M.forEach(resourceLwM2M => {
|
||||||
this.resourceFormArray.push(this.fb.group({
|
this.resourceFormArray.push(this.fb.group( {
|
||||||
id: resourceLwM2M.id,
|
id: resourceLwM2M.id,
|
||||||
name: resourceLwM2M.name,
|
name: resourceLwM2M.name,
|
||||||
observe: resourceLwM2M.observe,
|
observe: resourceLwM2M.observe,
|
||||||
@ -124,4 +124,10 @@ export class Lwm2mObserveAttrTelemetryResourceComponent implements ControlValueA
|
|||||||
trackByParams = (index: number): number => {
|
trackByParams = (index: number): number => {
|
||||||
return index;
|
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});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user