DataLinks: Fixes an issue __series.name is not working in data link (#34932)

This commit is contained in:
Torkel Ödegaard 2021-05-31 08:59:27 +02:00 committed by GitHub
parent ef13f7ece1
commit c7076c9e19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,19 +199,13 @@ export const ContextMenuView: React.FC<ContextMenuProps> = ({
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<MenuItemProps>((link) => {
items: field
.getLinks({
valueRowIndex: dataIdx,
})
.map<MenuItemProps>((link) => {
return {
label: link.title,
ariaLabel: link.title,