From d913723451ca9619a9deffaa9eb1780cc83c9260 Mon Sep 17 00:00:00 2001 From: aishyandapalli Date: Mon, 21 Aug 2023 11:56:23 -0700 Subject: [PATCH] [10.2.x] Exemplars: Move all the exemplar fields with links to the top in ExemplarMarker (#72697) Exemplars - add fields with links to the top --- .../panel/timeseries/plugins/ExemplarMarker.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/public/app/plugins/panel/timeseries/plugins/ExemplarMarker.tsx b/public/app/plugins/panel/timeseries/plugins/ExemplarMarker.tsx index cda2b2b5f9b..80df6125ebe 100644 --- a/public/app/plugins/panel/timeseries/plugins/ExemplarMarker.tsx +++ b/public/app/plugins/panel/timeseries/plugins/ExemplarMarker.tsx @@ -122,9 +122,13 @@ export const ExemplarMarker = ({ }, [setIsOpen]); const renderMarker = useCallback(() => { - // Put the traceID field in front. - const traceIDField = dataFrame.fields.find((field) => field.name === 'traceID') || dataFrame.fields[0]; - const orderedDataFrameFields = [traceIDField, ...dataFrame.fields.filter((field) => traceIDField !== field)]; + //Put fields with links on the top + const fieldsWithLinks = + dataFrame.fields.filter((field) => field.config.links?.length && field.config.links?.length > 0) || []; + const orderedDataFrameFields = [ + ...fieldsWithLinks, + ...dataFrame.fields.filter((field) => !fieldsWithLinks.includes(field)), + ]; const timeFormatter = (value: number) => { return dateTimeFormat(value, {