Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v11.0.x] StateTimeline: Fix data links causing unrendering of string fields #85307

Merged
merged 1 commit into from Mar 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions public/app/core/components/GraphNG/GraphNG.tsx
Expand Up @@ -106,14 +106,14 @@ export class GraphNG extends Component<GraphNGProps, GraphNGState> {

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
const withLinks = frames.some((frame) => frame.fields.some((field) => (field.config.links?.length ?? 0) > 0));

const dimFields = fields ?? {
x: fieldMatchers.get(FieldMatcherID.firstTimeField).get({}),
y: withLinks ? () => true : matchY,
y: withLinks ? () => true : matchYDefault,
};

const alignedFrame = preparePlotFrameFn(frames, dimFields, props.timeRange);
Expand Down Expand Up @@ -150,7 +150,7 @@ export class GraphNG extends Component<GraphNGProps, GraphNGState> {
// filter join field and dimFields.y
alignedFrameFinal = {
...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])),
};
}

Expand Down