]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: dashboard does not show degraded objects if they are less than 0.5... 43905/head
authorAashish Sharma <aashishsharma@localhost.localdomain>
Fri, 12 Nov 2021 10:05:38 +0000 (15:35 +0530)
committerAashish Sharma <aashishsharma@localhost.localdomain>
Mon, 22 Nov 2021 09:41:31 +0000 (15:11 +0530)
This PR is intended to fix this issue

Fixes: https://tracker.ceph.com/issues/53242
Signed-off-by: Aashish Sharma <aasharma@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts

index 8f671f791132b5811d994bda629708000e88ca60..cedcd06b6975ce07862bc040a47e8fb45156a357 100644 (file)
@@ -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);
     });
   });
 });
index d90e17e1f07d3a8837622b9f72121a4e79c4fde6..00c72395aac9de5d73e953b50b77458f17a7b095 100644 (file)
@@ -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;
   }
 }