-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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(dashboard): Fix BigNumber causing dashboard to crash when overflowing #19688
Conversation
…board to crash when overflowing
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.
Great work! 🚀 Let's get some more eyes on this just to be safe, but this is a really important fix, therefore tagging it for 1.5 👍
Note for testers - I'm not going to create an ephemeral test env, as importing the linked test dashboard fails. Please use your local setups |
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.
LGTM. Thanks for the fix @kgabryje!
…wing (apache#19688) * fix(dashboard): fix(plugin-chart-echarts): Fix BigNumber causing dashboard to crash when overflowing * Add tooltips for truncated titles * Fix type (cherry picked from commit ee85466)
…wing (apache#19688) * fix(dashboard): fix(plugin-chart-echarts): Fix BigNumber causing dashboard to crash when overflowing * Add tooltips for truncated titles * Fix type (cherry picked from commit ee85466)
🏷️ preset:2022.13 |
…wing (apache#19688) * fix(dashboard): fix(plugin-chart-echarts): Fix BigNumber causing dashboard to crash when overflowing * Add tooltips for truncated titles * Fix type
SUMMARY
The big number chart (and the whole browser) is crashing when it tries to calculate maximum font size that fits in the chart container. We do this in a loop, which breaks when width and height of big number text is less or equal the width and height of chart container. The loop goes 1) are big number dimensions smaller than chart container? 2) if not, decrease font size by 1, recalculate dimensions, try again. The problem is that under some circumstances the container height passed to chart through props is... negative. That means we'll never satisfy the condition to break the loop and we'll keep decreasing the font size infinitely.
Why is the calculated chart height negative? We calculate it with a formula
containerHeight - headerHeight
. The problem is that our css allows the header to overflow the container, soheaderHeight > containerHeight
.This PR fixes the css so that it doesn't allow title to overflow. I limited the title to maximum 2 lines. If it's truncated, we display a tooltip with a full title on hover.
Moreover, I set the chart to have minimum height of 20px as a failsafe to ensure we never pass a negative value again.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
Screen.Recording.2022-04-13.at.12.56.33.mov
After:
Screen.Recording.2022-04-13.at.12.59.24.mov
TESTING INSTRUCTIONS
dashboard_export_20220413T130001.zip
ADDITIONAL INFORMATION