From 238f81fa6881d0f784f015b5273431db7798146f Mon Sep 17 00:00:00 2001 From: Volker Theile Date: Thu, 29 Apr 2021 13:21:11 +0200 Subject: [PATCH] mgr/dashboard: disable NFSv3 support in dashboard Fixes: https://tracker.ceph.com/issues/49718 Related to: https://github.com/ceph/ceph/pull/40154 Signed-off-by: Volker Theile (cherry picked from commit 864a362389e988bc9aab23f66da608b4ceab74c0) --- .../src/app/ceph/nfs/nfs-form/nfs-form.component.html | 3 ++- .../app/ceph/nfs/nfs-form/nfs-form.component.spec.ts | 11 ++++++++++- .../src/app/ceph/nfs/nfs-form/nfs-form.component.ts | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.html index 11c4ccb22af3a..3da1e5820f70e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.html @@ -322,7 +322,8 @@ class="custom-control-input" id="protocolNfsv3" name="protocolNfsv3" - formControlName="protocolNfsv3"> + formControlName="protocolNfsv3" + disabled> diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.spec.ts index 4ebc1288de30b..12663f8003938 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.spec.ts @@ -98,7 +98,7 @@ describe('NfsFormComponent', () => { daemons: [], fsal: { fs_name: 'a', name: '', rgw_user_id: '', user_id: '' }, path: '', - protocolNfsv3: true, + protocolNfsv3: false, protocolNfsv4: true, pseudo: '', sec_label_xattr: 'security.selinux', @@ -145,6 +145,15 @@ describe('NfsFormComponent', () => { expect(component.nfsForm.get('cluster_id').disabled).toBeTruthy(); }); + it('should mark NFSv4 protocol as required', () => { + component.nfsForm.patchValue({ + protocolNfsv4: false + }); + component.nfsForm.updateValueAndValidity({ emitEvent: false }); + expect(component.nfsForm.valid).toBeFalsy(); + expect(component.nfsForm.get('protocolNfsv4').hasError('required')).toBeTruthy(); + }); + describe('should submit request', () => { beforeEach(() => { component.nfsForm.patchValue({ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts index 5234be1404e8e..2b110abb48016 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts @@ -174,7 +174,7 @@ export class NfsFormComponent extends CdForm implements OnInit { }) }), path: new FormControl(''), - protocolNfsv3: new FormControl(true, { + protocolNfsv3: new FormControl(false, { validators: [ CdValidators.requiredIf({ protocolNfsv4: false }, (value: boolean) => { return !value; -- 2.39.5