ui: make Metrics page charts responsive to viewport width#170977
Open
virajchogle wants to merge 1 commit into
Open
ui: make Metrics page charts responsive to viewport width#170977virajchogle wants to merge 1 commit into
virajchogle wants to merge 1 commit into
Conversation
Fixes: cockroachdb#170975 Epic: CRDB-64261 Release note (ui change): Fixed a bug on the DB Console Metrics page where the Summary panel was clipped on viewports narrower than ~1350px. Charts now resize to fit the available width.
Contributor
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Thank you for contributing to CockroachDB. Please ensure you have followed the guidelines for creating a PR. My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI. I have added a few people who may be able to assist in reviewing:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
uPlot charts on the Metrics page were hardcoded to 947px wide and .visualization used width: fit-content, so the right-hand Summary panel was clipped on viewports narrower than ~1350px (e.g. 13" MacBook Pro at default Retina scaling). No scrollbar appeared because the layout panel uses overflow: hidden.
Replace the fixed width with the container's actual clientWidth at chart creation time, add a ResizeObserver to call uPlot.setSize() on resize, and switch .visualization to width: 100%. Remove the hardcoded min-width: 947px from the loading spinner wrapper.
bars.ts (BarGraph component) has the same hardcoded width; left as a follow-up to keep this PR scoped to the reported Metrics page bug.
Fixes: #170975
Epic: CRDB-64261
Release note (ui change): Fixed a bug on the DB Console Metrics page where the Summary panel was clipped on viewports narrower than ~1350px. Charts now resize to fit the available width.