X-Git-Url: https://git.proxmox.com/?p=ceph.git;a=blobdiff_plain;f=ceph%2Fsrc%2Fpybind%2Fmgr%2Fdashboard%2Ffrontend%2Fsrc%2Fapp%2Fceph%2Fnfs%2Fnfs-form-client%2Fnfs-form-client.component.ts;fp=ceph%2Fsrc%2Fpybind%2Fmgr%2Fdashboard%2Ffrontend%2Fsrc%2Fapp%2Fceph%2Fnfs%2Fnfs-form-client%2Fnfs-form-client.component.ts;h=f7b4cc0fdf883ae3137e3fcf6189e19b9c97f1a7;hp=15e7d7d5ccebbd56512f1dc524c59548ef35845f;hb=aee94f6923ba628a85d855d0c5316d0da78bfa2a;hpb=27f45121cc74e31203777ad565f78d8aad9b92a2 diff --git a/ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.ts b/ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.ts index 15e7d7d5c..f7b4cc0fd 100644 --- a/ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.ts +++ b/ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.ts @@ -1,5 +1,5 @@ import { Component, ContentChild, Input, OnInit, TemplateRef } from '@angular/core'; -import { FormArray, FormControl, NgForm, Validators } from '@angular/forms'; +import { UntypedFormArray, UntypedFormControl, NgForm, Validators } from '@angular/forms'; import _ from 'lodash'; @@ -21,19 +21,21 @@ export class NfsFormClientComponent implements OnInit { @ContentChild('squashHelper', { static: true }) squashHelperTpl: TemplateRef; - nfsSquash: any[] = Object.keys(this.nfsService.nfsSquash); - nfsAccessType: any[] = this.nfsService.nfsAccessType; + nfsSquash: any[] = []; + nfsAccessType: any[] = []; icons = Icons; - clientsFormArray: FormArray; + clientsFormArray: UntypedFormArray; constructor(private nfsService: NfsService) {} ngOnInit() { + this.nfsSquash = Object.keys(this.nfsService.nfsSquash); + this.nfsAccessType = this.nfsService.nfsAccessType; _.forEach(this.clients, (client) => { const fg = this.addClient(); fg.patchValue(client); }); - this.clientsFormArray = this.form.get('clients') as FormArray; + this.clientsFormArray = this.form.get('clients') as UntypedFormArray; } getNoAccessTypeDescr() { @@ -58,16 +60,16 @@ export class NfsFormClientComponent implements OnInit { } addClient() { - this.clientsFormArray = this.form.get('clients') as FormArray; + this.clientsFormArray = this.form.get('clients') as UntypedFormArray; const REGEX_IP = `(([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\.([0-9]{1,3})([/](\\d|[1-2]\\d|3[0-2]))?)`; const REGEX_LIST_IP = `${REGEX_IP}([ ,]{1,2}${REGEX_IP})*`; const fg = new CdFormGroup({ - addresses: new FormControl('', { + addresses: new UntypedFormControl('', { validators: [Validators.required, Validators.pattern(REGEX_LIST_IP)] }), - access_type: new FormControl(''), - squash: new FormControl('') + access_type: new UntypedFormControl(''), + squash: new UntypedFormControl('') }); this.clientsFormArray.push(fg); @@ -75,7 +77,7 @@ export class NfsFormClientComponent implements OnInit { } removeClient(index: number) { - this.clientsFormArray = this.form.get('clients') as FormArray; + this.clientsFormArray = this.form.get('clients') as UntypedFormArray; this.clientsFormArray.removeAt(index); } @@ -84,7 +86,7 @@ export class NfsFormClientComponent implements OnInit { } getValue(index: number, control: string) { - this.clientsFormArray = this.form.get('clients') as FormArray; + this.clientsFormArray = this.form.get('clients') as UntypedFormArray; const client = this.clientsFormArray.at(index) as CdFormGroup; return client.getValue(control); }