Merge pull request #43905 from rhcs-dashboard/fix-53242-master

mgr/dashboard: dashboard does not show degraded objects if they are less than 0.5% under "Dashboard->Capacity->Objects block

Reviewed-by: Aashish Sharma <aasharma@redhat.com>
Reviewed-by: Avan Thakkar <athakkar@redhat.com>
Reviewed-by: Ernesto Puerta <epuertat@redhat.com>
This commit is contained in:
Ernesto Puerta 2021-11-24 12:47:11 +01:00 committed by GitHub
commit 9623700e7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View 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);
});
});
});

View 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;
}
}