From 0905058657f45b4603c90df2845baf7c07a8daa2 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Tue, 18 Oct 2022 14:13:31 +0100 Subject: [PATCH] Revert data links code for sorted vector case (#57175) (#57183) (cherry picked from commit 9c514748f76be1ecc041c8176de1e813a9ee3e4f) Co-authored-by: Victor Marin <36818606+mdvictor@users.noreply.github.com> --- .../grafana-data/src/vector/SortedVector.ts | 4 -- .../timeseries/plugins/ContextMenuPlugin.tsx | 42 +++++++------------ 2 files changed, 15 insertions(+), 31 deletions(-) diff --git a/packages/grafana-data/src/vector/SortedVector.ts b/packages/grafana-data/src/vector/SortedVector.ts index b6837bbe14f..0d66dff6ded 100644 --- a/packages/grafana-data/src/vector/SortedVector.ts +++ b/packages/grafana-data/src/vector/SortedVector.ts @@ -16,10 +16,6 @@ export class SortedVector implements Vector { return this.source.get(this.order[index]); } - getOrderIndex(index: number): number { - return this.order[index]; - } - toArray(): T[] { return vectorToArray(this); } diff --git a/public/app/plugins/panel/timeseries/plugins/ContextMenuPlugin.tsx b/public/app/plugins/panel/timeseries/plugins/ContextMenuPlugin.tsx index d8976238285..4e19f11ce24 100644 --- a/public/app/plugins/panel/timeseries/plugins/ContextMenuPlugin.tsx +++ b/public/app/plugins/panel/timeseries/plugins/ContextMenuPlugin.tsx @@ -2,15 +2,7 @@ import { css as cssCore, Global } from '@emotion/react'; import React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react'; import { useClickAway } from 'react-use'; -import { - CartesianCoords2D, - DataFrame, - getFieldDisplayName, - InterpolateFunction, - SortedVector, - TimeZone, - ValueLinkConfig, -} from '@grafana/data'; +import { CartesianCoords2D, DataFrame, getFieldDisplayName, InterpolateFunction, TimeZone } from '@grafana/data'; import { ContextMenu, GraphContextMenuHeader, @@ -257,27 +249,23 @@ export const ContextMenuView: React.FC = ({ const hasLinks = field.config.links && field.config.links.length > 0; - const valueLinkConfig: ValueLinkConfig = {}; - - if (field.values instanceof SortedVector) { - valueLinkConfig.valueRowIndex = field.values.getOrderIndex(dataIdx); - } else { - valueLinkConfig.valueRowIndex = dataIdx; - } - if (hasLinks) { if (field.getLinks) { items.push({ - items: field.getLinks(valueLinkConfig).map((link) => { - return { - label: link.title, - ariaLabel: link.title, - url: link.href, - target: link.target, - icon: link.target === '_self' ? 'link' : 'external-link-alt', - onClick: link.onClick, - }; - }), + items: field + .getLinks({ + valueRowIndex: dataIdx, + }) + .map((link) => { + return { + label: link.title, + ariaLabel: link.title, + url: link.href, + target: link.target, + icon: link.target === '_self' ? 'link' : 'external-link-alt', + onClick: link.onClick, + }; + }), }); } }