Merge pull request #9177 from rusikv/enhancement/pie-flot-common-settings
Validation for pie flot common settings
This commit is contained in:
commit
5171f9d5fc
@ -21,15 +21,24 @@
|
|||||||
<section fxLayout="column" fxLayout.gt-xs="row" fxLayoutGap.gt-xs="8px">
|
<section fxLayout="column" fxLayout.gt-xs="row" fxLayoutGap.gt-xs="8px">
|
||||||
<mat-form-field fxFlex class="mat-block">
|
<mat-form-field fxFlex class="mat-block">
|
||||||
<mat-label translate>widgets.chart.radius</mat-label>
|
<mat-label translate>widgets.chart.radius</mat-label>
|
||||||
<input matInput type="number" min="0" formControlName="radius">
|
<input matInput type="number" step="0.1" min="0" max="1" formControlName="radius">
|
||||||
|
<mat-error *ngIf="flotPieWidgetSettingsForm.get('radius').hasError('min') || flotPieWidgetSettingsForm.get('radius').hasError('max')">
|
||||||
|
{{ 'widgets.chart.common-pie-settings-range-error' | translate }}
|
||||||
|
</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field fxFlex class="mat-block">
|
<mat-form-field fxFlex class="mat-block">
|
||||||
<mat-label translate>widgets.chart.inner-radius</mat-label>
|
<mat-label translate>widgets.chart.inner-radius</mat-label>
|
||||||
<input matInput type="number" min="0" formControlName="innerRadius">
|
<input matInput type="number" step="0.1" min="0" max="1" formControlName="innerRadius">
|
||||||
|
<mat-error *ngIf="flotPieWidgetSettingsForm.get('innerRadius').hasError('min') || flotPieWidgetSettingsForm.get('innerRadius').hasError('max')">
|
||||||
|
{{ 'widgets.chart.common-pie-settings-range-error' | translate }}
|
||||||
|
</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field fxFlex class="mat-block">
|
<mat-form-field fxFlex class="mat-block">
|
||||||
<mat-label translate>widgets.chart.tilt</mat-label>
|
<mat-label translate>widgets.chart.tilt</mat-label>
|
||||||
<input matInput type="number" min="0" formControlName="tilt">
|
<input matInput type="number" step="0.1" min="0" max="1" formControlName="tilt">
|
||||||
|
<mat-error *ngIf="flotPieWidgetSettingsForm.get('tilt').hasError('min') || flotPieWidgetSettingsForm.get('tilt').hasError('max')">
|
||||||
|
{{ 'widgets.chart.common-pie-settings-range-error' | translate }}
|
||||||
|
</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</section>
|
</section>
|
||||||
<mat-slide-toggle formControlName="showLabels" class="slide-block">
|
<mat-slide-toggle formControlName="showLabels" class="slide-block">
|
||||||
|
|||||||
@ -59,9 +59,9 @@ export class FlotPieWidgetSettingsComponent extends WidgetSettingsComponent {
|
|||||||
|
|
||||||
// Common pie settings
|
// Common pie settings
|
||||||
|
|
||||||
radius: [settings.radius, [Validators.min(0)]],
|
radius: [settings.radius, [Validators.min(0), Validators.max(1)]],
|
||||||
innerRadius: [settings.innerRadius, [Validators.min(0)]],
|
innerRadius: [settings.innerRadius, [Validators.min(0), Validators.max(1)]],
|
||||||
tilt: [settings.tilt, [Validators.min(0)]],
|
tilt: [settings.tilt, [Validators.min(0), Validators.max(1)]],
|
||||||
|
|
||||||
// Stroke settings
|
// Stroke settings
|
||||||
|
|
||||||
|
|||||||
@ -4938,6 +4938,7 @@
|
|||||||
"radius": "Radius",
|
"radius": "Radius",
|
||||||
"inner-radius": "Inner radius",
|
"inner-radius": "Inner radius",
|
||||||
"tilt": "Tilt",
|
"tilt": "Tilt",
|
||||||
|
"common-pie-settings-range-error": "Value should be in range from 0 to 1",
|
||||||
"stroke-settings": "Stroke settings",
|
"stroke-settings": "Stroke settings",
|
||||||
"width-pixels": "Width (pixels)",
|
"width-pixels": "Width (pixels)",
|
||||||
"show-labels": "Show labels",
|
"show-labels": "Show labels",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user