mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 00:25:46 -06:00
Heatmap: Clean up datalink code (#72296)
This commit is contained in:
parent
19b239fba0
commit
67a6a99e04
@ -125,18 +125,21 @@ const HeatmapHoverCell = ({ data, hover, showHistogram, scopedVars, replaceVars
|
||||
|
||||
for (const field of visibleFields ?? []) {
|
||||
const hasLinks = field.config.links && field.config.links.length > 0;
|
||||
|
||||
if (hasLinks && data.heatmap) {
|
||||
let appropriateScopedVars = scopedVars.filter(
|
||||
(sv) => sv && sv.__dataContext && sv.__dataContext.value.field.name === nonNumericOrdinalDisplay
|
||||
)[0];
|
||||
field.getLinks = getLinksSupplier(data.heatmap, field, appropriateScopedVars ?? {}, replaceVars);
|
||||
const appropriateScopedVars = scopedVars.find(
|
||||
(scopedVar) =>
|
||||
scopedVar && scopedVar.__dataContext && scopedVar.__dataContext.value.field.name === nonNumericOrdinalDisplay
|
||||
);
|
||||
|
||||
field.getLinks = getLinksSupplier(data.heatmap, field, appropriateScopedVars || {}, replaceVars);
|
||||
}
|
||||
|
||||
if (field.getLinks) {
|
||||
const v = field.values[index];
|
||||
const disp = field.display ? field.display(v) : { text: `${v}`, numeric: +v };
|
||||
const value = field.values[index];
|
||||
const display = field.display ? field.display(value) : { text: `${value}`, numeric: +value };
|
||||
|
||||
field.getLinks({ calculatedValue: disp, valueRowIndex: index }).forEach((link) => {
|
||||
field.getLinks({ calculatedValue: display, valueRowIndex: index }).forEach((link) => {
|
||||
const key = `${link.title}/${link.href}`;
|
||||
if (!linkLookup.has(key)) {
|
||||
links.push(link);
|
||||
|
@ -48,7 +48,7 @@ export const HeatmapPanel = ({
|
||||
for (const series of data.series) {
|
||||
for (const field of series.fields) {
|
||||
if (field.state?.scopedVars) {
|
||||
scopedVarsFromRawData.push(field.state?.scopedVars);
|
||||
scopedVarsFromRawData.push(field.state.scopedVars);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user