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

fix(discover): Check yAxis list contains equation functions when adding widget from discover #29153

Merged
merged 7 commits into from
Oct 12, 2021

Conversation

edwardgou-sentry
Copy link
Contributor

With #29087 users will be able to add equations to all widget visualization types.

When adding a widget from discover, we need to make sure that any equations passed into the Y-Axis must have their comprising functions included as Y-Axis values as well (otherwise the equation will not work). This change will enforce this check when pulling Y-Axis values from discover to the Add to Dashboard widget modal.

@@ -430,11 +442,67 @@ describe('EventsV2 > SaveQueryButtonGroup', function () {
wrapper.find('DiscoverQueryMenu').find('Button').first().simulate('click');
wrapper.find('MenuItem').first().simulate('click');
await tick();
await wrapper.update();
await tick();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is tick called twice here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found that subsequent tests will have leaky data without the second tick(). This looks like something to do with enzyme component handling. Removed wrapper.update() since it wasn't actually doing anything here.

return (
!parsed.error &&
parsed.tc.functions.every(
({term}) => typeof term === 'string' && yAxis.includes(term)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to check if the equation is on aggregates? Because we can add equations on non aggregatesike transaction.duration.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aggregates are filtered out ahead of time, so shouldn't be necessary to check again. 👍

@edwardgou-sentry edwardgou-sentry merged commit f6e5df0 into master Oct 12, 2021
@edwardgou-sentry edwardgou-sentry deleted the fix/dnd-add-widget-check-y-axis-equation branch October 12, 2021 15:29
@github-actions github-actions bot locked and limited conversation to collaborators Oct 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants