Skip to content

Commit 2129b86

Browse files
add mime type to content downloading label
1 parent e750669 commit 2129b86

2 files changed

Lines changed: 31 additions & 8 deletions

File tree

x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ describe('getSeriesAndDomain', () => {
229229
"showTooltip": true,
230230
"tooltipProps": Object {
231231
"colour": "#ca8eae",
232-
"value": "Content downloading: 0.552ms",
232+
"value": "Content downloading (CSS): 0.552ms",
233233
},
234234
},
235235
"x": 0,
@@ -281,7 +281,7 @@ describe('getSeriesAndDomain', () => {
281281
"showTooltip": true,
282282
"tooltipProps": Object {
283283
"colour": "#9170b8",
284-
"value": "Content downloading: 3.068ms",
284+
"value": "Content downloading (JS): 3.068ms",
285285
},
286286
},
287287
"x": 1,
@@ -386,7 +386,7 @@ describe('getSeriesAndDomain', () => {
386386
"showTooltip": true,
387387
"tooltipProps": Object {
388388
"colour": "#ca8eae",
389-
"value": "Content downloading: 0.552ms",
389+
"value": "Content downloading (CSS): 0.552ms",
390390
},
391391
},
392392
"x": 0,
@@ -399,7 +399,7 @@ describe('getSeriesAndDomain', () => {
399399
"showTooltip": true,
400400
"tooltipProps": Object {
401401
"colour": "#9170b8",
402-
"value": "Content downloading: 2.793ms",
402+
"value": "Content downloading (JS): 2.793ms",
403403
},
404404
},
405405
"x": 1,

x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.ts

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,23 @@ const getColourForMimeType = (mimeType?: string) => {
3838
return colourPalette[key];
3939
};
4040

41+
const getFriendlyTooltipValue = ({
42+
value,
43+
timing,
44+
mimeType,
45+
}: {
46+
value: number;
47+
timing: Timings;
48+
mimeType?: string;
49+
}) => {
50+
let label = FriendlyTimingLabels[timing];
51+
if (timing === Timings.Receive && mimeType) {
52+
const formattedMimeType: MimeType = MimeTypesMap[mimeType];
53+
label += ` (${FriendlyMimetypeLabels[formattedMimeType]})`;
54+
}
55+
return `${label}: ${formatValueForDisplay(value)}ms`;
56+
};
57+
4158
export const getSeriesAndDomain = (items: NetworkItems) => {
4259
const getValueForOffset = (item: NetworkItem) => {
4360
return item.requestSentTime;
@@ -92,9 +109,11 @@ export const getSeriesAndDomain = (items: NetworkItems) => {
92109
colour,
93110
showTooltip: true,
94111
tooltipProps: {
95-
value: `${FriendlyTimingLabels[timing]}: ${formatValueForDisplay(
96-
y - currentOffset
97-
)}ms`,
112+
value: getFriendlyTooltipValue({
113+
value: y - currentOffset,
114+
timing,
115+
mimeType: item.mimeType,
116+
}),
98117
colour,
99118
},
100119
},
@@ -118,7 +137,11 @@ export const getSeriesAndDomain = (items: NetworkItems) => {
118137
showTooltip: hasTotal,
119138
tooltipProps: hasTotal
120139
? {
121-
value: `${FriendlyTimingLabels.receive}: ${formatValueForDisplay(total)}ms`,
140+
value: getFriendlyTooltipValue({
141+
value: total,
142+
timing: Timings.Receive,
143+
mimeType: item.mimeType,
144+
}),
122145
colour: mimeTypeColour,
123146
}
124147
: undefined,

0 commit comments

Comments
 (0)