[v10.0.x] Canvas: Fix data links (#73453)
Canvas: Fix data links (#73332)
(cherry picked from commit 451d5a25b2)
Co-authored-by: Adela Almasan <88068998+adela-almasan@users.noreply.github.com>
This commit is contained in:
co-authored by
Adela Almasan
parent
42df01b07d
commit
2a897f3264
@@ -1,6 +1,6 @@
|
||||
import { isNumber, isString } from 'lodash';
|
||||
|
||||
import { AppEvents, Field, LinkModel, PluginState, SelectableValue } from '@grafana/data';
|
||||
import { AppEvents, Field, getFieldDisplayName, LinkModel, PluginState, SelectableValue } from '@grafana/data';
|
||||
import { hasAlphaPanels } from 'app/core/config';
|
||||
|
||||
import appEvents from '../../../core/app_events';
|
||||
@@ -114,8 +114,8 @@ export function getDataLinks(ctx: DimensionContext, cfg: TextConfig, textData: s
|
||||
frames?.forEach((frame) => {
|
||||
const visibleFields = frame.fields.filter((field) => !Boolean(field.config.custom?.hideFrom?.tooltip));
|
||||
|
||||
if (cfg.text?.field && visibleFields.some((f) => f.name === cfg.text?.field)) {
|
||||
const field = visibleFields.filter((field) => field.name === cfg.text?.field)[0];
|
||||
if (cfg.text?.field && visibleFields.some((f) => getFieldDisplayName(f, frame) === cfg.text?.field)) {
|
||||
const field = visibleFields.filter((field) => getFieldDisplayName(field, frame) === cfg.text?.field)[0];
|
||||
if (field?.getLinks) {
|
||||
const disp = field.display ? field.display(textData) : { text: `${textData}`, numeric: +textData! };
|
||||
field.getLinks({ calculatedValue: disp }).forEach((link) => {
|
||||
|
||||
Reference in New Issue
Block a user