Skip to content

Commit

Permalink
conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed Jan 24, 2023
1 parent 0abf725 commit 9d2345a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ export const TimingDetails = ({ step }: { step: JourneyStep }) => {
<EuiLoadingContent lines={1} />
) : (
<ThresholdIndicator
currentFormatted={formatMillisecond(item.value, 1)}
currentFormatted={formatMillisecond(item.value, { digits: 1 })}
current={Number(item.value.toFixed(1))}
previous={Number(prevValue.toFixed(1))}
previousFormatted={formatMillisecond(prevValue, 1)}
previousFormatted={formatMillisecond(prevValue, { digits: 1 })}
/>
),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,9 +491,12 @@ export const colourPalette: ColourPalette = { ...TIMING_PALETTE, ...MIME_TYPE_PA
export const formatTooltipHeading = (index: number, fullText: string): string =>
isNaN(index) ? fullText : `${index}. ${fullText}`;

export const formatMillisecond = (ms: number, maxMillis = 1000) => {
export const formatMillisecond = (
ms: number,
{ maxMillis = 1000, digits }: { digits?: number; maxMillis?: number }
) => {
if (ms < maxMillis) {
return `${ms.toFixed(digits??0)} ms`;
return `${ms.toFixed(digits ?? 0)} ms`;
}
return `${(ms / 1000).toFixed(digits ?? 1)} s`;
};
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const BreakdownLegend = () => {
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiText css={{ whiteSpace: 'nowrap' }} size="s">
{formatMillisecond(value)}
{formatMillisecond(value, {})}
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const NetworkTimingsDonut = () => {
data={networkTimings.timingsWithLabels}
layout={PartitionLayout.sunburst}
valueAccessor={(d: Datum) => d?.value}
valueFormatter={(d: number) => formatMillisecond(d)}
valueFormatter={(d: number) => formatMillisecond(d, {})}
layers={[
{
groupByRollup: (d: Datum) => d.label,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function WaterfallChartMarkers() {
{
dataValue: offset,
details: label,
header: formatMillisecond(offset, 4000),
header: formatMillisecond(offset, { maxMillis: 4000 }),
},
]}
marker={<WaterfallMarkerIcon field={field} label={label} />}
Expand Down

0 comments on commit 9d2345a

Please sign in to comment.