From 8a4936e9346c47738892569cc802637aacc9ecf2 Mon Sep 17 00:00:00 2001 From: Patrick Nawracay Date: Thu, 6 Dec 2018 12:59:20 +0100 Subject: [PATCH] mgr/dashboard: Fix renaming of pools The validation fails to allow dots in pool names and as such, it wasn't allowed to create or rename pools with dots in their names. Fixes: https://tracker.ceph.com/issues/37534 Signed-off-by: Patrick Nawracay --- .../src/app/ceph/pool/pool-form/pool-form.component.spec.ts | 4 ++++ .../src/app/ceph/pool/pool-form/pool-form.component.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts index 9507b5fb84a..91160ec98c7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts @@ -229,6 +229,10 @@ describe('PoolFormComponent', () => { formHelper.expectErrorChange('name', 'wrong format with spaces', 'pattern'); }); + it('should validate with dots in pool name', () => { + formHelper.expectValidChange('name', 'pool.default.bar', true); + }); + it('validates poolType', () => { formHelper.expectError('poolType', 'required'); formHelper.expectValidChange('poolType', 'erasure'); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts index a17802a574c..4a8424f350e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts @@ -100,7 +100,7 @@ export class PoolFormComponent implements OnInit { this.form = new CdFormGroup( { name: new FormControl('', { - validators: [Validators.pattern('[A-Za-z0-9_-]+'), Validators.required] + validators: [Validators.pattern('[\\.A-Za-z0-9_-]+'), Validators.required] }), poolType: new FormControl('', { validators: [Validators.required] -- 2.39.5