-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(dashboards): Allow functions in top events widget columns #29699
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
feat(dashboards): Allow functions in top events widget columns #29699
Conversation
size-limit report
|
| const fieldStr = generateFieldAsString(field); | ||
| return isAggregateField(fieldStr) || isAggregateEquation(fieldStr); | ||
| }) as QueryFieldValue; | ||
| const columns = fields.filter(field => field !== fieldValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So basically we're saying that the first aggregate field from the bottom up is the y-axis? Can we do something simpler instead like:
const fieldValue = fields[-1]
const columns = fields.slice(0, fields.length -1)
Would that work? because it's a single yAxis that is always required and populated for ton events?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that would work! Updated to this, tested and cleaned up some other convoluted parts of code (don't recall why I made it so complicated lol). Also fixed a bug with default query field.
shruthilayaj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something funky is going on when you save the widget/dashboard. Steps to replicate:
- Add title and eps() as columns
- count() as the yaxis
- orderby count()
- save widget and dashboard
- open widget edit again, columns and y-axis aren't being saved as expected
Good catch, I was able to replicated. Made an update to |
shruthilayaj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Loving the overall simplification!
| return queries; | ||
| } | ||
|
|
||
| if (displayType === DisplayType.TOP_N) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: just combine with the if DisplayType.TABLE statement above
Allow Dashboard Top Events widgets to add aggregate columns so that chart can be sorted by aggregates