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)
|
||||
.filter(hasDefinedTupleValue)
|
||||
.map(([name, value]) => {
|
||||
const current = transformUnit(name, value);
|
||||
const max = transformUnit(name, value);
|
||||
.map(([name, rawMax]) => {
|
||||
const rawCurrent = used[name] ?? "0";
|
||||
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
|
||||
|
||||
return (
|
||||
<div key={name} className={cssNames("param", kebabCase(name))}>
|
||||
<span className="title">{name}</span>
|
||||
<span className="value">
|
||||
{`${used[name]} / ${value}`}
|
||||
{`${rawCurrent} / ${rawMax}`}
|
||||
</span>
|
||||
<LineProgress
|
||||
max={max}
|
||||
value={current}
|
||||
tooltip={(
|
||||
<p>
|
||||
{`Set: ${value}. Usage: ${usage}%`}
|
||||
{`Set: ${rawMax}. Usage: ${usage}%`}
|
||||
</p>
|
||||
)}
|
||||
/>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user