Browse Source

UI: Fixed alarm rules console errors

pull/14942/head
ArtemDzhereleiko 6 months ago
committed by Vladyslav Prykhodko
parent
commit
9aec9f03ca
  1. 2
      ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-dialog.component.ts
  2. 2
      ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.html
  3. 5
      ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.ts
  4. 3
      ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition.component.ts

2
ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-dialog.component.ts

@ -180,7 +180,7 @@ export class AlarmRuleDialogComponent extends DialogComponent<AlarmRuleDialogCom
});
} else {
this.fieldFormGroup.get('name').markAsTouched();
this.entitySelect.entityAutocompleteMarkAsTouched();
this.entitySelect?.entityAutocompleteMarkAsTouched();
}
}

2
ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.html

@ -125,7 +125,7 @@
<section class="tb-form-panel stroked">
<div class="flex flex-row items-center justify-between">
<div class="tb-form-panel-title">{{ 'alarm-rule.type' | translate }}</div>
<tb-toggle-select formControlName="type" selectMediaBreakpoint="xs" [disabled]="isNoData">
<tb-toggle-select formControlName="type" selectMediaBreakpoint="xs">
<tb-toggle-option *ngFor="let alarmConditionType of alarmConditionTypes" [value]="alarmConditionType">
{{ alarmConditionTypeTranslation.get(alarmConditionType) | translate }}
</tb-toggle-option>

5
ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.ts

@ -228,6 +228,11 @@ export class CfAlarmRuleConditionDialogComponent extends DialogComponent<CfAlarm
if (this.isNoData && this.conditionFormGroup.get('type').value !== AlarmRuleConditionType.SIMPLE) {
this.conditionFormGroup.get('type').patchValue(AlarmRuleConditionType.SIMPLE);
}
if (this.isNoData) {
this.conditionFormGroup.get('type').disable({emitEvent: false});
} else {
this.conditionFormGroup.get('type').enable({emitEvent: false});
}
}
private hasNoData(data: Array<AlarmRuleFilter>) {

3
ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition.component.ts

@ -295,6 +295,9 @@ export class CfAlarmRuleConditionComponent implements ControlValueAccessor, Vali
}
}).afterClosed().subscribe((result) => {
if (result) {
if (!this.modelValue) {
this.modelValue = {} as AlarmRuleCondition;
}
this.modelValue.schedule = result;
this.updateModel();
}

Loading…
Cancel
Save