mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
TimeSeries: Use original frames for creating data links (#91598)
This commit is contained in:
parent
d93f5bab83
commit
1b6362a807
@ -132,25 +132,36 @@ export class GraphNG extends Component<GraphNGProps, GraphNGState> {
|
||||
if (withLinks) {
|
||||
const timeZone = Array.isArray(this.props.timeZone) ? this.props.timeZone[0] : this.props.timeZone;
|
||||
|
||||
alignedFrame.fields.forEach((field) => {
|
||||
field.getLinks = getLinksSupplier(
|
||||
alignedFrame,
|
||||
field,
|
||||
{
|
||||
...field.state?.scopedVars,
|
||||
__dataContext: {
|
||||
value: {
|
||||
data: [alignedFrame],
|
||||
field: field,
|
||||
frame: alignedFrame,
|
||||
frameIndex: 0,
|
||||
// for links gen we need to use original frames but with the aligned/joined data values
|
||||
let linkFrames = frames.map((frame, frameIdx) => ({
|
||||
...frame,
|
||||
fields: alignedFrame.fields.filter(
|
||||
(field, fieldIdx) => fieldIdx === 0 || field.state?.origin?.frameIndex === frameIdx
|
||||
),
|
||||
length: alignedFrame.length,
|
||||
}));
|
||||
|
||||
linkFrames.forEach((linkFrame, frameIndex) => {
|
||||
linkFrame.fields.forEach((field) => {
|
||||
field.getLinks = getLinksSupplier(
|
||||
linkFrame,
|
||||
field,
|
||||
{
|
||||
...field.state?.scopedVars,
|
||||
__dataContext: {
|
||||
value: {
|
||||
data: linkFrames,
|
||||
field: field,
|
||||
frame: linkFrame,
|
||||
frameIndex,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
replaceVariables,
|
||||
timeZone,
|
||||
dataLinkPostProcessor
|
||||
);
|
||||
replaceVariables,
|
||||
timeZone,
|
||||
dataLinkPostProcessor
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
// filter join field and fields.y
|
||||
|
Loading…
Reference in New Issue
Block a user