mirror of
https://github.com/ceph/ceph
synced 2025-02-23 02:57:21 +00:00
mgr/dashboard: avoid tooltip if disk_usage=null and fast-diff enabled
Fixes: https://tracker.ceph.com/issues/53404 Signed-off-by: Avan Thakkar <athakkar@redhat.com>
This commit is contained in:
parent
0f7791fa24
commit
071c3b68a1
@ -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>
|
||||
|
@ -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
|
||||
expect(spans[6].textContent).toBe('N/A');
|
||||
expect(spans[7].textContent).toBe('N/A');
|
||||
// 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 & fast-diff changed to enabled
|
||||
expect(spanWithFastDiff[6].textContent).toBe('-');
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user