]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: avoid tooltip if disk_usage=null and fast-diff enabled 44149/head
authorAvan Thakkar <athakkar@redhat.com>
Thu, 25 Nov 2021 19:59:17 +0000 (01:29 +0530)
committerAvan Thakkar <athakkar@redhat.com>
Tue, 30 Nov 2021 16:21:33 +0000 (21:51 +0530)
Fixes: https://tracker.ceph.com/issues/53404
Signed-off-by: Avan Thakkar <athakkar@redhat.com>
(cherry picked from commit 071c3b68a131fa9ff3403ccc6ca0e1075d95a048)

src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts

index 7287beefcf2bb8b90da7e9505ab35bb3b4f814ec..ea2bd668fbaa9c3eeb57717dcfe9f833156ce680 100644 (file)
@@ -31,7 +31,7 @@
 
 <ng-template #provisionedNotAvailableTooltipTpl
              let-row="row">
-  <span *ngIf="row.disk_usage === null; else provisioned"
+  <span *ngIf="row.disk_usage === null && !row.features_name.includes('fast-diff'); else provisioned"
         [ngbTooltip]="usageNotAvailableTooltipTpl"
         placement="top"
         i18n>N/A</span>
@@ -41,7 +41,7 @@
 
 <ng-template #totalProvisionedNotAvailableTooltipTpl
              let-row="row">
-  <span *ngIf="row.total_disk_usage === null; else totalProvisioned"
+  <span *ngIf="row.total_disk_usage === null && !row.features_name.includes('fast-diff'); else totalProvisioned"
         [ngbTooltip]="usageNotAvailableTooltipTpl"
         placement="top"
         i18n>N/A</span>
index 89b70071814d864a2a8e38379becda8b8250f245..02cf636ac89e67cf9dadeaaf0bcc0718b6ce38a0 100644 (file)
@@ -95,18 +95,20 @@ describe('RbdListComponent', () => {
   });
 
   describe('handling of provisioned columns', () => {
+    let rbdServiceListSpy: jasmine.Spy;
+
     const images = [
       {
         name: 'img1',
         pool_name: 'rbd',
-        features: ['layering', 'exclusive-lock'],
+        features_name: ['layering', 'exclusive-lock'],
         disk_usage: null,
         total_disk_usage: null
       },
       {
         name: 'img2',
         pool_name: 'rbd',
-        features: ['layering', 'exclusive-lock', 'object-map', 'fast-diff'],
+        features_name: ['layering', 'exclusive-lock', 'object-map', 'fast-diff'],
         disk_usage: 1024,
         total_disk_usage: 1024
       }
@@ -115,19 +117,30 @@ describe('RbdListComponent', () => {
     beforeEach(() => {
       component.images = images;
       refresh({ executing_tasks: [], finished_tasks: [] });
-      spyOn(rbdService, 'list').and.callFake(() =>
-        of([{ pool_name: 'rbd', status: 1, value: images }])
-      );
-      fixture.detectChanges();
+      rbdServiceListSpy = spyOn(rbdService, 'list');
     });
 
     it('should display N/A for Provisioned & Total Provisioned columns if disk usage is null', () => {
-      const spans = fixture.debugElement.nativeElement.querySelectorAll(
+      rbdServiceListSpy.and.callFake(() => of([{ pool_name: 'rbd', status: 1, value: images }]));
+      fixture.detectChanges();
+      const spanWithoutFastDiff = fixture.debugElement.nativeElement.querySelectorAll(
+        '.datatable-body-cell-label span'
+      );
+      // check image with disk usage = null & fast-diff disabled
+      expect(spanWithoutFastDiff[6].textContent).toBe('N/A');
+
+      images[0]['features_name'] = ['layering', 'exclusive-lock', 'object-map', 'fast-diff'];
+      component.images = images;
+      refresh({ executing_tasks: [], finished_tasks: [] });
+
+      rbdServiceListSpy.and.callFake(() => of([{ pool_name: 'rbd', status: 1, value: images }]));
+      fixture.detectChanges();
+
+      const spanWithFastDiff = fixture.debugElement.nativeElement.querySelectorAll(
         '.datatable-body-cell-label span'
       );
-      // check image with disk usage = null
-      expect(spans[6].textContent).toBe('N/A');
-      expect(spans[7].textContent).toBe('N/A');
+      // check image with disk usage = null & fast-diff changed to enabled
+      expect(spanWithFastDiff[6].textContent).toBe('-');
     });
   });