[CSM] Fix total blocking time formatting (#77751)

This commit is contained in:
Shahzad 2020-09-18 15:53:42 +02:00 committed by GitHub
parent 477c812af2
commit e7a8aed594
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View file

@ -28,7 +28,7 @@ export function CoreVitals({ data, loading }: Props) {
<EuiFlexItem>
<CoreVitalItem
title={LCP_LABEL}
value={lcp ? lcp + 's' : '0'}
value={lcp ? lcp + ' s' : '0'}
ranks={lcpRanks}
loading={loading}
thresholds={CoreVitalsThresholds.LCP}
@ -37,7 +37,7 @@ export function CoreVitals({ data, loading }: Props) {
<EuiFlexItem>
<CoreVitalItem
title={FID_LABEL}
value={fid ? fid + 's' : '0'}
value={fid ? fid + ' s' : '0'}
ranks={fidRanks}
loading={loading}
thresholds={CoreVitalsThresholds.FID}

View file

@ -24,7 +24,7 @@ export function formatToSec(
const valueInMs = Number(value ?? 0) / (fromUnit === 'MicroSec' ? 1000 : 1);
if (valueInMs < 1000) {
return valueInMs + ' ms';
return valueInMs.toFixed(0) + ' ms';
}
return (valueInMs / 1000).toFixed(2) + ' s';
}
@ -69,7 +69,7 @@ export function KeyUXMetrics({ data, loading }: Props) {
<EuiFlexItem grow={false} style={STAT_STYLE}>
<EuiStat
titleSize="s"
title={formatToSec(data?.tbt)}
title={formatToSec(data?.tbt, 'ms')}
description={TBT_LABEL}
isLoading={loading}
/>

View file

@ -23,7 +23,7 @@ export interface UXMetrics {
cls: string;
fid: string;
lcp: string;
tbt: string;
tbt: number;
fcp: number;
lcpRanks: number[];
fidRanks: number[];

View file

@ -127,7 +127,7 @@ export async function getWebCoreVitals({
cls: String(cls?.values['50.0']?.toFixed(2) || 0),
fid: ((fid?.values['50.0'] || 0) / 1000).toFixed(2),
lcp: ((lcp?.values['50.0'] || 0) / 1000).toFixed(2),
tbt: ((tbt?.values['50.0'] || 0) / 1000).toFixed(2),
tbt: tbt?.values['50.0'] || 0,
fcp: fcp?.values['50.0'] || 0,
lcpRanks: getRanksPercentages(lcpRanks?.values ?? defaultRanks),

View file

@ -71,7 +71,7 @@ export default function rumServicesApiTests({ getService }: FtrProviderContext)
0,
0,
],
"tbt": "0.00",
"tbt": 0,
}
`);
});