]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: disable cluster selection in NFS export editing form 37995/head
authorKiefer Chang <kiefer.chang@suse.com>
Wed, 4 Nov 2020 03:00:21 +0000 (11:00 +0800)
committerLaura Paduano <lpaduano@suse.com>
Wed, 18 Nov 2020 10:58:15 +0000 (11:58 +0100)
We should not allow changing an export's cluster because an export ID
might live in one cluster but not in another one. Editing a non-existing
export in a cluster causes an error.

Fixes: https://tracker.ceph.com/issues/47373
Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
(cherry picked from commit d678d8076c2a4c5edfe489d553e3c8770462f023)

 Conflicts:
src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.spec.ts
 - Some imports differ from master; remove SummaryService and CephReleaseNamePipe from providers
   and no longer needed test case; also remove not working docsUrl (and related lines) from
   nfs-form.component.ts

src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts

index bcc51a84de0a2bf30b70d004bec9c7ecacc51e21..4d1c0c7aa4ef84006d8ae30facee2f40e20454f6 100644 (file)
@@ -113,6 +113,7 @@ describe('NfsFormComponent', () => {
       transportTCP: true,
       transportUDP: true
     });
+    expect(component.nfsForm.get('cluster_id').disabled).toBeFalsy();
   });
 
   it('should prepare data when selecting an cluster', () => {
@@ -136,6 +137,12 @@ describe('NfsFormComponent', () => {
     expect(component.nfsForm.getValue('daemons')).toEqual([]);
   });
 
+  it('should not allow changing cluster in edit mode', () => {
+    component.isEdit = true;
+    component.ngOnInit();
+    expect(component.nfsForm.get('cluster_id').disabled).toBeTruthy();
+  });
+
   describe('should submit request', () => {
     beforeEach(() => {
       component.nfsForm.patchValue({
index 0beec9fc3bef69c96ea549226458e9dc46bb28de..b32f7b8de599217173b950be6c5ceb224c48901f 100644 (file)
@@ -116,6 +116,7 @@ export class NfsFormComponent implements OnInit {
 
         this.getData(promises);
       });
+      this.nfsForm.get('cluster_id').disable();
     } else {
       this.action = this.actionLabels.CREATE;
       this.getData(promises);