Skip to content

Commit

Permalink
Merge pull request #11617 from tvu20/Bug-2043068
Browse files Browse the repository at this point in the history
Bug 2043068: <x> available of <y> text disappears in Utilization item if x is 0
  • Loading branch information
openshift-ci[bot] committed Jun 16, 2022
2 parents a6a56fb + 8ea98c2 commit c832a49
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,18 @@ export const UtilizationItem: React.FC<UtilizationItemProps> = React.memo(

let humanMax: string;
let humanAvailable: string;
if (!_.isNil(current) && max) {
if (max) {
const currentUtilization = current ?? 0;
const percentage = (100 * currentUtilization) / max;
humanMax = humanizeValue(max).string;
const percentage = (100 * current) / max;

if (percentage >= 90) {
chartStyle[0] = { data: { fill: chartStatusColors[AreaChartStatus.ERROR] } };
} else if (percentage >= 80) {
chartStyle[0] = { data: { fill: chartStatusColors[AreaChartStatus.WARNING] } };
}

humanAvailable = humanizeValue(max - current).string;
humanAvailable = humanizeValue(max - currentUtilization).string;
}

const chart = (
Expand Down

0 comments on commit c832a49

Please sign in to comment.