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

Gauge: Simplify gauge dimension panel options #76216

Merged
merged 12 commits into from
Nov 17, 2023

Conversation

nmarrs
Copy link
Contributor

@nmarrs nmarrs commented Oct 9, 2023

Update the gauge panel with a similar approach taken in bar gauge panel (see this PR) for handling auto / manual gauge sizing options. By default auto size will use a reasonable hardcoded value (though in the future this could be made smarter) while manual allows user to explicitly determine the size of their gauge.

UX

Screen.Recording.2023-11-07.at.1.43.59.PM.mov

Demo dashboard.txt

Related to #71690 + #46819

For docs changes see #76240

Created a follow-up issue for adding an overflow notice inside of VizRepeater

@nmarrs nmarrs requested a review from torkelo October 9, 2023 20:46
@nmarrs nmarrs self-assigned this Oct 9, 2023
@grafana-delivery-bot grafana-delivery-bot bot added this to the 10.2.x milestone Oct 9, 2023
@github-actions github-actions bot added the levitate breaking change A label indicating a breaking change and assigned by Levitate. label Oct 9, 2023
Copy link
Member

@torkelo torkelo left a comment

Choose a reason for hiding this comment

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

yes, something like this was what I had in mind. It could even be a bit smarter, if where to use alignment factors like BarGauge, then it would know the longest gauge name and value and have a better sense of size constraint (but maybe not needed for a first iteration)

@nmarrs nmarrs mentioned this pull request Oct 30, 2023
3 tasks
@github-actions github-actions bot removed the levitate breaking change A label indicating a breaking change and assigned by Levitate. label Nov 7, 2023
@nmarrs nmarrs force-pushed the cleanup-gauge-panel-layout-options branch from c86c496 to 722a522 Compare November 7, 2023 21:57
@nmarrs nmarrs changed the title [POC] Gauge Panels: Simplify / remove min viz height panel options Gauge: Simplify gauge dimension panel options Nov 7, 2023
@nmarrs nmarrs marked this pull request as ready for review November 7, 2023 22:08
@nmarrs nmarrs requested review from a team and Eve832 as code owners November 7, 2023 22:08
@nmarrs nmarrs requested review from Develer and adela-almasan and removed request for a team November 7, 2023 22:08
@nmarrs nmarrs requested review from Clarity-89, eledobleefe and academo and removed request for a team November 7, 2023 22:08
@nmarrs nmarrs modified the milestones: 10.2.x, 10.3.x Nov 7, 2023
@nmarrs nmarrs added add to changelog no-backport Skip backport of PR labels Nov 7, 2023
@@ -29,8 +29,9 @@ composableKinds: PanelCfg: {
common.SingleStatBaseOptions
showThresholdLabels: bool | *false
showThresholdMarkers: bool | *true
minVizWidth: uint32 | *75
minVizHeight: uint32 | *75
sizing: common.BarGaugeSizing & (*"auto" | _)
Copy link
Contributor Author

@nmarrs nmarrs Nov 7, 2023

Choose a reason for hiding this comment

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

We can rename the BarGaugeSizing to just GaugeSizing or maybe even something even more generic like VizSizing to make it more universal if desired - I don't feel too strongly on need to do this 🤷‍♂️

@nmarrs nmarrs mentioned this pull request Nov 7, 2023
3 tasks
@nmarrs
Copy link
Contributor Author

nmarrs commented Nov 7, 2023

@torkelo I've updated this PR to have the same handling of gauge dimensions as recent bar gauge PR (Auto / Manual sizing option that hides extra panel options by default)

},
defaultValue: defaultOptions.sizing,
showIf: (options: Options) => options.orientation !== VizOrientation.Auto,
})
.addNumberInput({
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @nmarrs Would you mind to replace number input with slider input?

Suggested change
.addNumberInput({
.addSliderInput({
path: 'minVizWidth',
name: 'Min width',
description: 'Minimum column width (vertical orientation)',
defaultValue: defaultOptions.minVizWidth,
settings: {
min: 0,
max: 300,
step: 1,
},
showIf: (options: Options) =>
options.sizing === BarGaugeSizing.Manual && options.orientation === VizOrientation.Vertical,
})
.addSliderInput({
path: 'minVizHeight',
name: 'Min height',
description: 'Minimum row height (horizontal orientation)',
defaultValue: defaultOptions.minVizHeight,
settings: {
min: 0,
max: 300,
step: 1,
},
showIf: (options: Options) =>
options.sizing === BarGaugeSizing.Manual && options.orientation === VizOrientation.Horizontal,
});

Copy link
Contributor

Choose a reason for hiding this comment

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

please, adjust max value as needed 🙂

Copy link
Contributor

Choose a reason for hiding this comment

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

600 max value should be more than enough. In other cases, if e.g. user wants a bigger gauge - auto move should cover that. Let me know what you think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

checking it out locally now :) goal is to get this merged today (and associated docs PR) 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

600 seems reasonable enough 👍 updated PR with requested changes

@Develer
Copy link
Contributor

Develer commented Nov 17, 2023

@nmarrs btw, just noticed, shouldn't Gauge size show also in auto layout orientation mode?

@nmarrs
Copy link
Contributor Author

nmarrs commented Nov 17, 2023

@nmarrs btw, just noticed, shouldn't Gauge size show also in auto layout orientation mode?

@Develer for the gauge panel auto layout behaves differently from the bar gauge panel (no need for overflow handling as it lays out gauges neatly in available space) so including the gauge size option in that case doesn't really make as much sense IMO (nor do the gauge size options have any impact on gauge behavior when in auto mode (in the code))
Screenshot 2023-11-17 at 11 31 24 AM

@nmarrs nmarrs enabled auto-merge (squash) November 17, 2023 19:51
@nmarrs nmarrs merged commit 3e08abf into main Nov 17, 2023
21 checks passed
@nmarrs nmarrs deleted the cleanup-gauge-panel-layout-options branch November 17, 2023 19:59
@aangelisc aangelisc modified the milestones: 10.3.x, 10.2.3 Dec 21, 2023
Comment on lines -21 to +23
minVizHeight: 75,
minVizWidth: 75,
minVizHeight: 200,
minVizWidth: 200,
Copy link
Member

Choose a reason for hiding this comment

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

@nmarrs this is a pretty big breaking change, radically changing the look of thousands of panels that used to show many gauges now just show a few and with a scrollbar.

Copy link

@melroy89 melroy89 Jan 3, 2024

Choose a reason for hiding this comment

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

You bet it caused regression issues.. Not cool nmarrs.

@melroy89
Copy link

melroy89 commented Jan 3, 2024

I bet I got regression on this PR .....

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants