Browse Source

Task/resolve strict template errors in rule settings dialog (#8084)

Resolve strict template errors
main
Kenrick Tandrian 15 hours ago
committed by GitHub
parent
commit
4b14053b2c
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 74
      apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html

74
apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html

@ -6,124 +6,132 @@
(ngSubmit)="onSubmit()" (ngSubmit)="onSubmit()"
> >
<div class="py-3" mat-dialog-content> <div class="py-3" mat-dialog-content>
@if (data.rule.configuration?.threshold; as threshold) {
@if ( @if (
data.rule.configuration?.thresholdMin && data.rule.configuration.thresholdMin &&
data.rule.configuration?.thresholdMax data.rule.configuration.thresholdMax
) { ) {
<div class="w-100"> <div class="w-100">
<h6 class="d-flex mb-0"> <h6 class="d-flex mb-0">
<ng-container i18n>Threshold range</ng-container>: <ng-container i18n>Threshold range</ng-container>:
<gf-value <gf-value
class="ml-1" class="ml-1"
[isPercent]="data.rule.configuration.threshold.unit === '%'" [isPercent]="threshold.unit === '%'"
[locale]="data.locale" [locale]="data.locale"
[precision]="2" [precision]="2"
[value]="settingsForm.get('thresholdMin').value" [value]="settingsForm.get('thresholdMin')?.value"
/> />
<span class="mx-1">-</span> <span class="mx-1">-</span>
<gf-value <gf-value
[isPercent]="data.rule.configuration.threshold.unit === '%'" [isPercent]="threshold.unit === '%'"
[locale]="data.locale" [locale]="data.locale"
[precision]="2" [precision]="2"
[value]="settingsForm.get('thresholdMax').value" [value]="settingsForm.get('thresholdMax')?.value"
/> />
</h6> </h6>
<div class="align-items-center d-flex w-100"> <div class="align-items-center d-flex w-100">
<gf-value <gf-value
[isPercent]="data.rule.configuration.threshold.unit === '%'" [isPercent]="threshold.unit === '%'"
[locale]="data.locale" [locale]="data.locale"
[precision]="2" [precision]="2"
[value]="data.rule.configuration.threshold.min" [value]="threshold.min"
/> />
<mat-slider <mat-slider
class="flex-grow-1" class="flex-grow-1"
[max]="data.rule.configuration.threshold.max" [max]="threshold.max"
[min]="data.rule.configuration.threshold.min" [min]="threshold.min"
[step]="data.rule.configuration.threshold.step" [step]="threshold.step"
> >
<input formControlName="thresholdMin" matSliderStartThumb /> <input formControlName="thresholdMin" matSliderStartThumb />
<input formControlName="thresholdMax" matSliderEndThumb /> <input formControlName="thresholdMax" matSliderEndThumb />
</mat-slider> </mat-slider>
<gf-value <gf-value
[isPercent]="data.rule.configuration.threshold.unit === '%'" [isPercent]="threshold.unit === '%'"
[locale]="data.locale" [locale]="data.locale"
[precision]="2" [precision]="2"
[value]="data.rule.configuration.threshold.max" [value]="threshold.max"
/> />
</div> </div>
</div> </div>
} @else { } @else {
<div class="w-100" [class.d-none]="!data.rule.configuration.thresholdMin"> <div
class="w-100"
[class.d-none]="!data.rule.configuration.thresholdMin"
>
<h6 class="d-flex mb-0"> <h6 class="d-flex mb-0">
<ng-container i18n>Threshold Min</ng-container>: <ng-container i18n>Threshold Min</ng-container>:
<gf-value <gf-value
class="ml-1" class="ml-1"
[isPercent]="data.rule.configuration.threshold.unit === '%'" [isPercent]="threshold.unit === '%'"
[locale]="data.locale" [locale]="data.locale"
[precision]="2" [precision]="2"
[value]="settingsForm.get('thresholdMin').value" [value]="settingsForm.get('thresholdMin')?.value"
/> />
</h6> </h6>
<div class="align-items-center d-flex w-100"> <div class="align-items-center d-flex w-100">
<gf-value <gf-value
[isPercent]="data.rule.configuration.threshold.unit === '%'" [isPercent]="threshold.unit === '%'"
[locale]="data.locale" [locale]="data.locale"
[precision]="2" [precision]="2"
[value]="data.rule.configuration.threshold.min" [value]="threshold.min"
/> />
<mat-slider <mat-slider
class="flex-grow-1" class="flex-grow-1"
name="thresholdMin" name="thresholdMin"
[max]="data.rule.configuration.threshold.max" [max]="threshold.max"
[min]="data.rule.configuration.threshold.min" [min]="threshold.min"
[step]="data.rule.configuration.threshold.step" [step]="threshold.step"
> >
<input formControlName="thresholdMin" matSliderThumb /> <input formControlName="thresholdMin" matSliderThumb />
</mat-slider> </mat-slider>
<gf-value <gf-value
[isPercent]="data.rule.configuration.threshold.unit === '%'" [isPercent]="threshold.unit === '%'"
[locale]="data.locale" [locale]="data.locale"
[precision]="2" [precision]="2"
[value]="data.rule.configuration.threshold.max" [value]="threshold.max"
/> />
</div> </div>
</div> </div>
<div class="w-100" [class.d-none]="!data.rule.configuration.thresholdMax"> <div
class="w-100"
[class.d-none]="!data.rule.configuration.thresholdMax"
>
<h6 class="d-flex mb-0"> <h6 class="d-flex mb-0">
<ng-container i18n>Threshold Max</ng-container>: <ng-container i18n>Threshold Max</ng-container>:
<gf-value <gf-value
class="ml-1" class="ml-1"
[isPercent]="data.rule.configuration.threshold.unit === '%'" [isPercent]="threshold.unit === '%'"
[locale]="data.locale" [locale]="data.locale"
[precision]="2" [precision]="2"
[value]="settingsForm.get('thresholdMax').value" [value]="settingsForm.get('thresholdMax')?.value"
/> />
</h6> </h6>
<div class="align-items-center d-flex w-100"> <div class="align-items-center d-flex w-100">
<gf-value <gf-value
[isPercent]="data.rule.configuration.threshold.unit === '%'" [isPercent]="threshold.unit === '%'"
[locale]="data.locale" [locale]="data.locale"
[precision]="2" [precision]="2"
[value]="data.rule.configuration.threshold.min" [value]="threshold.min"
/> />
<mat-slider <mat-slider
class="flex-grow-1" class="flex-grow-1"
name="thresholdMax" name="thresholdMax"
[max]="data.rule.configuration.threshold.max" [max]="threshold.max"
[min]="data.rule.configuration.threshold.min" [min]="threshold.min"
[step]="data.rule.configuration.threshold.step" [step]="threshold.step"
> >
<input formControlName="thresholdMax" matSliderThumb /> <input formControlName="thresholdMax" matSliderThumb />
</mat-slider> </mat-slider>
<gf-value <gf-value
[isPercent]="data.rule.configuration.threshold.unit === '%'" [isPercent]="threshold.unit === '%'"
[locale]="data.locale" [locale]="data.locale"
[precision]="2" [precision]="2"
[value]="data.rule.configuration.threshold.max" [value]="threshold.max"
/> />
</div> </div>
</div> </div>
} }
}
</div> </div>
<div align="end" mat-dialog-actions> <div align="end" mat-dialog-actions>

Loading…
Cancel
Save