]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix nfs toggle test 68075/head
authorSyed Ali Ul Hasan <syedaliulhasan19@gmail.com>
Tue, 14 Jul 2026 10:11:43 +0000 (15:41 +0530)
committerSyed Ali Ul Hasan <syedaliulhasan19@gmail.com>
Tue, 21 Jul 2026 09:21:47 +0000 (14:51 +0530)
Fixes: https://tracker.ceph.com/issues/75986
Signed-off-by: Syed Ali Ul Hasan <syedaliulhasan19@gmail.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form-modal.component.ts

index dfc229f32a7bb5a3dbff92ea8eb5e10e22f08ce3..d03d9c4c616b90c1130795b9256a67c8a2915b3a 100644 (file)
@@ -90,7 +90,6 @@
             formControlName="mirrorImageSnapshot"
             name="mirrorImageSnapshot"
             (checkedChange)="onMirrorCheckBoxChange()"
-            [attr.disabled]="!peerConfigured.length > 0 ? true : null"
             i18n
             >Mirror Image Snapshot
           </cds-checkbox>
index 056ad5eda53c712263a72d8829f6c524d0b9ed88..d22d33cab1a7a4616e6bf4eeb6031a8d6f5ee437 100644 (file)
@@ -77,12 +77,14 @@ describe('RbdSnapshotFormModalComponent', () => {
 
   // TODO: Fix this test. It is failing after updating the jest.
   // It looks like it is not recognizing if radio button is disabled or not
-  // it('should disable the mirror image snapshot creation when peer is not configured', () => {
-  //   spyOn(rbdMirrorService, 'getPeerForPool').and.returnValue(of([]));
-  //   component.mirroring = 'snapshot';
-  //   component.ngOnInit();
-  //   fixture.detectChanges();
-  //   const radio = fixture.debugElement.nativeElement.querySelector('#mirrorImageSnapshot');
-  //   expect(radio.disabled).toBe(true);
-  // });
+  it('should disable the mirror image snapshot creation when peer is not configured', () => {
+    spyOn(rbdMirrorService, 'getPeerForPool').and.returnValue(of([]));
+    component.mirroring = 'snapshot';
+    component.ngOnInit();
+    fixture.detectChanges();
+    const checkboxElement =
+      fixture.debugElement.nativeElement.querySelector('#mirrorImageSnapshot');
+    const input = checkboxElement.querySelector('input');
+    expect(input.disabled).toBe(true);
+  });
 });
index 60bad211e8de71bace75efdc56205361bfc35938..af9ee6d9b2fcbff322de8f9c12b9f6cddc41ecec 100644 (file)
@@ -62,6 +62,15 @@ export class RbdSnapshotFormModalComponent extends BaseModal implements OnInit {
 
   ngOnInit(): void {
     this.peerConfigured$ = this.rbdMirrorService.getPeerForPool(this.poolName);
+
+    this.peerConfigured$.subscribe((peers) => {
+      const control = this.snapshotForm.get('mirrorImageSnapshot');
+      if (peers && peers.length > 0) {
+        control.enable();
+      } else {
+        control.disable();
+      }
+    });
   }
 
   setSnapName(snapName: string) {