X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fpybind%2Fmgr%2Fdashboard%2Ffrontend%2Fsrc%2Fapp%2Fshared%2Fcomponents%2Fform-modal%2Fform-modal.component.ts;h=59b0d2a8560a13060ba3284905b45b8ec5b6ddd4;hb=aee94f6923ba628a85d855d0c5316d0da78bfa2a;hp=46dd942e909fbf3094f708dbca3ec71547740451;hpb=27f45121cc74e31203777ad565f78d8aad9b92a2;p=ceph.git diff --git a/ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.ts b/ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.ts index 46dd942e9..59b0d2a85 100755 --- a/ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.ts +++ b/ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { FormControl, ValidatorFn, Validators } from '@angular/forms'; +import { UntypedFormControl, ValidatorFn, Validators } from '@angular/forms'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import _ from 'lodash'; @@ -38,14 +38,14 @@ export class FormModalComponent implements OnInit { } createForm() { - const controlsConfig: Record = {}; + const controlsConfig: Record = {}; this.fields.forEach((field) => { controlsConfig[field.name] = this.createFormControl(field); }); this.formGroup = this.formBuilder.group(controlsConfig); } - private createFormControl(field: CdFormModalFieldConfig): FormControl { + private createFormControl(field: CdFormModalFieldConfig): UntypedFormControl { let validators: ValidatorFn[] = []; if (_.isBoolean(field.required) && field.required) { validators.push(Validators.required); @@ -53,7 +53,7 @@ export class FormModalComponent implements OnInit { if (field.validators) { validators = validators.concat(field.validators); } - return new FormControl( + return new UntypedFormControl( _.defaultTo( field.type === 'binary' ? this.dimlessBinaryPipe.transform(field.value) : field.value, null @@ -89,6 +89,9 @@ export class FormModalComponent implements OnInit { if (error === 'required') { return $localize`This field is required.`; } + if (error === 'pattern') { + return $localize`Size must be a number or in a valid format. eg: 5 GiB`; + } return $localize`An error occurred.`; }