From: Aashish Sharma Date: Fri, 12 Nov 2021 10:05:38 +0000 (+0530) Subject: mgr/dashboard: dashboard does not show degraded objects if they are less than 0.5... X-Git-Tag: v16.2.8~295^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=5754c452a73548ff60ec541394be7d5bd9b86a89;p=ceph.git mgr/dashboard: dashboard does not show degraded objects if they are less than 0.5% under "Dashboard->Capacity->Objects block This PR is intended to fix this issue Fixes: https://tracker.ceph.com/issues/53242 Signed-off-by: Aashish Sharma (cherry picked from commit 4def9d89c51ec2715066d119330a0f692fcf2f88) --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts index 8f671f791132b..cedcd06b6975c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts @@ -340,8 +340,9 @@ describe('HealthComponent', () => { expect(component['calcPercentage'](undefined, 1)).toEqual(0); expect(component['calcPercentage'](null, 1)).toEqual(0); expect(component['calcPercentage'](0, 1)).toEqual(0); - expect(component['calcPercentage'](2.346, 10)).toEqual(23); - expect(component['calcPercentage'](2.35, 10)).toEqual(24); + expect(component['calcPercentage'](1, 100000)).toEqual(0.01); + expect(component['calcPercentage'](2.346, 10)).toEqual(23.46); + expect(component['calcPercentage'](2.56, 10)).toEqual(25.6); }); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts index d90e17e1f07d3..00c72395aac9d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts @@ -249,6 +249,6 @@ export class HealthComponent implements OnInit, OnDestroy { return 0; } - return Math.round((dividend / divisor) * 100); + return Math.ceil((dividend / divisor) * 100 * 100) / 100; } }