diff --git a/public/app/plugins/panel/timeseries/plugins/ContextMenuPlugin.tsx b/public/app/plugins/panel/timeseries/plugins/ContextMenuPlugin.tsx index 006cf73ac5f..9d1e122b062 100644 --- a/public/app/plugins/panel/timeseries/plugins/ContextMenuPlugin.tsx +++ b/public/app/plugins/panel/timeseries/plugins/ContextMenuPlugin.tsx @@ -10,16 +10,8 @@ import { MenuItem, UPlotConfigBuilder, } from '@grafana/ui'; -import { - CartesianCoords2D, - DataFrame, - DataFrameView, - getFieldDisplayName, - InterpolateFunction, - TimeZone, -} from '@grafana/data'; +import { CartesianCoords2D, DataFrame, getFieldDisplayName, InterpolateFunction, TimeZone } from '@grafana/data'; import { useClickAway } from 'react-use'; -import { getFieldLinksSupplier } from '../../../../features/panel/panellinks/linkSuppliers'; import { pluginLog } from '@grafana/ui/src/components/uPlot/utils'; interface ContextMenuPluginProps { @@ -207,28 +199,22 @@ export const ContextMenuView: React.FC = ({ const hasLinks = field.config.links && field.config.links.length > 0; if (hasLinks) { - const linksSupplier = getFieldLinksSupplier({ - display: displayValue, - name: field.name, - view: new DataFrameView(data), - rowIndex: dataIdx, - colIndex: seriesIdx, - field: field.config, - hasLinks, - }); - - if (linksSupplier) { + if (field.getLinks) { items.push({ - items: linksSupplier.getLinks(replaceVariables).map((link) => { - return { - label: link.title, - ariaLabel: link.title, - url: link.href, - target: link.target, - icon: `${link.target === '_self' ? 'link' : 'external-link-alt'}` as IconName, - 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'}` as IconName, + onClick: link.onClick, + }; + }), }); } }