From 094a11d63f3f6bd653f0b3de68acb1856e422a92 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 13b94a6cc189f..3251ca267db7b 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 @@ -321,7 +321,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 01da887fefb66..ce3c8bf0d7212 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 @@ -94,7 +94,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', @@ -141,6 +141,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 5e89174e48610..f742bcac24136 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 @@ -167,7 +167,7 @@ export class NfsFormComponent 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