mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
StateTimeline: Fix data links causing unrendering of string fields (#85260)
This commit is contained in:
parent
08d603e660
commit
1ffeb7c365
@ -106,14 +106,14 @@ export class GraphNG extends Component<GraphNGProps, GraphNGState> {
|
|||||||
|
|
||||||
const preparePlotFrameFn = preparePlotFrame ?? defaultPreparePlotFrame;
|
const preparePlotFrameFn = preparePlotFrame ?? defaultPreparePlotFrame;
|
||||||
|
|
||||||
const matchY = fieldMatchers.get(FieldMatcherID.byTypes).get(new Set([FieldType.number, FieldType.enum]));
|
const matchYDefault = fieldMatchers.get(FieldMatcherID.byTypes).get(new Set([FieldType.number, FieldType.enum]));
|
||||||
|
|
||||||
// if there are data links, we have to keep all fields so they're index-matched, then filter out dimFields.y
|
// if there are data links, we have to keep all fields so they're index-matched, then filter out dimFields.y
|
||||||
const withLinks = frames.some((frame) => frame.fields.some((field) => (field.config.links?.length ?? 0) > 0));
|
const withLinks = frames.some((frame) => frame.fields.some((field) => (field.config.links?.length ?? 0) > 0));
|
||||||
|
|
||||||
const dimFields = fields ?? {
|
const dimFields = fields ?? {
|
||||||
x: fieldMatchers.get(FieldMatcherID.firstTimeField).get({}),
|
x: fieldMatchers.get(FieldMatcherID.firstTimeField).get({}),
|
||||||
y: withLinks ? () => true : matchY,
|
y: withLinks ? () => true : matchYDefault,
|
||||||
};
|
};
|
||||||
|
|
||||||
const alignedFrame = preparePlotFrameFn(frames, dimFields, props.timeRange);
|
const alignedFrame = preparePlotFrameFn(frames, dimFields, props.timeRange);
|
||||||
@ -150,7 +150,7 @@ export class GraphNG extends Component<GraphNGProps, GraphNGState> {
|
|||||||
// filter join field and dimFields.y
|
// filter join field and dimFields.y
|
||||||
alignedFrameFinal = {
|
alignedFrameFinal = {
|
||||||
...alignedFrame,
|
...alignedFrame,
|
||||||
fields: alignedFrame.fields.filter((field, i) => i === 0 || matchY(field, alignedFrame, [alignedFrame])),
|
fields: alignedFrame.fields.filter((field, i) => i === 0 || dimFields.y(field, alignedFrame, [alignedFrame])),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user