diff --git a/packages/server/src/ui/routes/build-view/audit-list/numeric-diff.jsx b/packages/server/src/ui/routes/build-view/audit-list/numeric-diff.jsx index 1370cc2fc..44b5013cf 100644 --- a/packages/server/src/ui/routes/build-view/audit-list/numeric-diff.jsx +++ b/packages/server/src/ui/routes/build-view/audit-list/numeric-diff.jsx @@ -41,7 +41,7 @@ const getUnitFromAudit = (audit, groupId) => { return 'none'; }; -/** @param {number} x @param {{asDelta?: boolean, unit: 'ms'|'bytes'|'none', withSuffix?: boolean}} options */ +/** @param {number} x @param {{asDelta?: boolean, unit: 'ms'|'bytes'|'none', withSuffix?: boolean, preventSecondsConversion?: boolean}} options */ const toDisplay = (x, options) => { const {asDelta = false, withSuffix = false, unit = 'none'} = options; let value = Math.round(x); @@ -51,7 +51,7 @@ const toDisplay = (x, options) => { if (unit === 'ms') { suffix = ' ms'; - if (Math.abs(value) >= 50) { + if (Math.abs(value) >= 500 && !options.preventSecondsConversion) { value /= 1000; fractionDigits = 1; suffix = ' s'; @@ -107,11 +107,18 @@ export const NumericDiff = props => { const boxRight = 100 - (100 * (maxValue - lowerLimit)) / range; const deltaType = getDeltaLabel(delta, 'audit'); const minValueIsCurrentValue = minValue === currentNumericValue; + const hoverDisplay = `${toDisplay(baseNumericValue, {unit, withSuffix: true})} to ${toDisplay( + currentNumericValue, + { + withSuffix: true, + unit, + } + )}`; if (props.showAsNarrow) { return ( -