Browse Source

Merge pull request #5778 from ArtemDzhereleiko/bug-fix/device-profile-alarm-rule/constant-boolean

[3.3.3] UI: Fixed constant type and boolean value type form
pull/5872/head
Igor Kulikov 5 years ago
committed by GitHub
parent
commit
a3f95008cd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      ui-ngx/src/app/modules/home/components/filter/boolean-filter-predicate.component.ts
  2. 6
      ui-ngx/src/app/modules/home/components/filter/key-filter-dialog.component.ts

7
ui-ngx/src/app/modules/home/components/filter/boolean-filter-predicate.component.ts

@ -109,8 +109,11 @@ export class BooleanFilterPredicateComponent implements ControlValueAccessor, Va
} }
private updateModel() { private updateModel() {
const predicate: BooleanFilterPredicate = this.booleanFilterPredicateFormGroup.getRawValue(); let predicate: BooleanFilterPredicate = null;
predicate.type = FilterPredicateType.BOOLEAN; if (this.booleanFilterPredicateFormGroup.valid) {
predicate = this.booleanFilterPredicateFormGroup.getRawValue();
predicate.type = FilterPredicateType.BOOLEAN;
}
this.propagateChange(predicate); this.propagateChange(predicate);
} }

6
ui-ngx/src/app/modules/home/components/filter/key-filter-dialog.component.ts

@ -134,6 +134,10 @@ export class KeyFilterDialogComponent extends
} }
); );
} }
if (valueType === EntityKeyValueType.BOOLEAN && this.isConstantKeyType) {
this.keyFilterFormGroup.get('value').clearValidators();
this.keyFilterFormGroup.get('value').updateValueAndValidity();
}
}); });
this.keyFilterFormGroup.get('key.type').valueChanges.pipe( this.keyFilterFormGroup.get('key.type').valueChanges.pipe(
@ -148,7 +152,7 @@ export class KeyFilterDialogComponent extends
this.showAutocomplete = false; this.showAutocomplete = false;
} }
if (this.data.telemetryKeysOnly) { if (this.data.telemetryKeysOnly) {
if (type === EntityKeyType.CONSTANT) { if (type === EntityKeyType.CONSTANT && (this.keyFilterFormGroup.get('valueType').value !== EntityKeyValueType.BOOLEAN)) {
this.keyFilterFormGroup.get('value').setValidators(Validators.required); this.keyFilterFormGroup.get('value').setValidators(Validators.required);
this.keyFilterFormGroup.get('value').updateValueAndValidity(); this.keyFilterFormGroup.get('value').updateValueAndValidity();
} else { } else {

Loading…
Cancel
Save