From 8c619f18e9ab66da725d5d5fe1ab8417bc9b34bd Mon Sep 17 00:00:00 2001 From: Avan Thakkar Date: Wed, 10 Nov 2021 03:07:33 +0530 Subject: [PATCH] mgr/dashboard: provisioned values is misleading in RBD image table Fixes: https://tracker.ceph.com/issues/46617 Signed-off-by: Avan Thakkar Adding hint in image table similar to the one in rbd-details. (cherry picked from commit 4ee2f2a9b79e246dfa56ad371b0718f0171eee3e) --- .../block/rbd-list/rbd-list.component.html | 20 ++++++++++ .../block/rbd-list/rbd-list.component.spec.ts | 37 +++++++++++++++++++ .../ceph/block/rbd-list/rbd-list.component.ts | 10 ++++- 3 files changed, 65 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.html index 875814d57bc68..7287beefcf2bb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.html @@ -29,6 +29,26 @@ [innerHtml]="'Only available for RBD images with fast-diff enabled'"> + + N/A + {{row.disk_usage | dimlessBinary}} + + + + N/A + {{row.total_disk_usage | dimlessBinary}} + + {{ value.pool_name }} { }); }); + describe('handling of provisioned columns', () => { + const images = [ + { + name: 'img1', + pool_name: 'rbd', + features: ['layering', 'exclusive-lock'], + disk_usage: null, + total_disk_usage: null + }, + { + name: 'img2', + pool_name: 'rbd', + features: ['layering', 'exclusive-lock', 'object-map', 'fast-diff'], + disk_usage: 1024, + total_disk_usage: 1024 + } + ]; + + beforeEach(() => { + component.images = images; + refresh({ executing_tasks: [], finished_tasks: [] }); + spyOn(rbdService, 'list').and.callFake(() => + of([{ pool_name: 'rbd', status: 1, value: images }]) + ); + fixture.detectChanges(); + }); + + it('should display N/A for Provisioned & Total Provisioned columns if disk usage is null', () => { + const spans = 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'); + }); + }); + describe('handling of deletion', () => { beforeEach(() => { fixture.detectChanges(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts index 8bc297da62fd0..0ffb25695c8d2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts @@ -56,6 +56,10 @@ export class RbdListComponent extends ListWithDetails implements OnInit { deleteTpl: TemplateRef; @ViewChild('removingStatTpl', { static: true }) removingStatTpl: TemplateRef; + @ViewChild('provisionedNotAvailableTooltipTpl', { static: true }) + provisionedNotAvailableTooltipTpl: TemplateRef; + @ViewChild('totalProvisionedNotAvailableTooltipTpl', { static: true }) + totalProvisionedNotAvailableTooltipTpl: TemplateRef; permission: Permission; tableActions: CdTableAction[]; @@ -230,14 +234,16 @@ export class RbdListComponent extends ListWithDetails implements OnInit { prop: 'disk_usage', cellClass: 'text-center', flexGrow: 1, - pipe: this.dimlessBinaryPipe + pipe: this.dimlessBinaryPipe, + cellTemplate: this.provisionedNotAvailableTooltipTpl }, { name: $localize`Total provisioned`, prop: 'total_disk_usage', cellClass: 'text-center', flexGrow: 1, - pipe: this.dimlessBinaryPipe + pipe: this.dimlessBinaryPipe, + cellTemplate: this.totalProvisionedNotAvailableTooltipTpl }, { name: $localize`Parent`, -- 2.39.5