mirror of
https://github.com/skooner-k8s/skooner.git
synced 2026-08-24 04:16:18 +00:00
Remove comparing a string and a number
Comparing [:155] a string [:154] (from string literal "" [:154] ) and a number [:155] (from number literal 85 [:155] ) might behave differently than you expect, as implicit conversion is performed. Replace `''` with `0` because we use it to display number near the percent sign.
This commit is contained in:
@@ -151,7 +151,7 @@ function percent(node: Node, used: number | string | null, resource: ResourceTyp
|
||||
const result = unparser(used);
|
||||
|
||||
const available = getNodeResourcesAvailable(node, resource);
|
||||
const displayPercent = available ? _.round(Number(used) / available * 100, 1) : '';
|
||||
const displayPercent = available ? _.round(Number(used) / available * 100, 1) : 0;
|
||||
const className = displayPercent >= 85 ? 'contentPanel_warn' : undefined;
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user