mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix ResourceQuotaDetails quotas displays showing 100% usage
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
f61330611e
commit
bcecb75d14
@ -36,23 +36,24 @@ function renderQuotas(quota: ResourceQuota): JSX.Element[] {
|
|||||||
|
|
||||||
return object.entries(hard)
|
return object.entries(hard)
|
||||||
.filter(hasDefinedTupleValue)
|
.filter(hasDefinedTupleValue)
|
||||||
.map(([name, value]) => {
|
.map(([name, rawMax]) => {
|
||||||
const current = transformUnit(name, value);
|
const rawCurrent = used[name] ?? "0";
|
||||||
const max = transformUnit(name, value);
|
const current = transformUnit(name, rawCurrent);
|
||||||
|
const max = transformUnit(name, rawMax);
|
||||||
const usage = max === 0 ? 100 : Math.ceil(current / max * 100); // special case 0 max as always 100% usage
|
const usage = max === 0 ? 100 : Math.ceil(current / max * 100); // special case 0 max as always 100% usage
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={name} className={cssNames("param", kebabCase(name))}>
|
<div key={name} className={cssNames("param", kebabCase(name))}>
|
||||||
<span className="title">{name}</span>
|
<span className="title">{name}</span>
|
||||||
<span className="value">
|
<span className="value">
|
||||||
{`${used[name]} / ${value}`}
|
{`${rawCurrent} / ${rawMax}`}
|
||||||
</span>
|
</span>
|
||||||
<LineProgress
|
<LineProgress
|
||||||
max={max}
|
max={max}
|
||||||
value={current}
|
value={current}
|
||||||
tooltip={(
|
tooltip={(
|
||||||
<p>
|
<p>
|
||||||
{`Set: ${value}. Usage: ${usage}%`}
|
{`Set: ${rawMax}. Usage: ${usage}%`}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user