fix(quota): guard remaining usage percent (#1242)
* fix(quota): guard remaining usage percent * test(quota): cover non-finite usage percents * fix(ui): clean up virtual scroll frame --------- Co-authored-by: Isaac Sanchez <isanchez-hawkins@arize.com> Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
committed by
GitHub
co-authored by
Isaac Sanchez
Bohdan Triapitsyn
parent
eb8b9ed715
commit
11e5ab93a9
@@ -40,9 +40,10 @@ export const calculateResetAfterSeconds = (resetAt) => {
|
||||
export const toUsageWindow = ({ usedPercent, windowSeconds, resetAt, valueLabel }) => {
|
||||
const resetAfterSeconds = calculateResetAfterSeconds(resetAt);
|
||||
const resetFormatted = hasResetTimestamp(resetAt) ? formatResetTime(resetAt) : null;
|
||||
const hasFiniteUsedPercent = typeof usedPercent === 'number' && Number.isFinite(usedPercent);
|
||||
return {
|
||||
usedPercent,
|
||||
remainingPercent: usedPercent !== null ? Math.max(0, 100 - usedPercent) : null,
|
||||
remainingPercent: hasFiniteUsedPercent ? Math.max(0, 100 - usedPercent) : null,
|
||||
windowSeconds: windowSeconds ?? null,
|
||||
resetAfterSeconds,
|
||||
resetAt,
|
||||
|
||||
Reference in New Issue
Block a user