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

Units: Add scalable unit option #79411

Merged
merged 5 commits into from Jan 2, 2024
Merged

Units: Add scalable unit option #79411

merged 5 commits into from Jan 2, 2024

Conversation

Develer
Copy link
Contributor

@Develer Develer commented Dec 12, 2023

What is this feature?

This PR provides scale option for unit standard edit option

Which issue(s) does this PR fix?:

Fixes #50975

Special notes for your reviewer:

Please check that:

  • It works as expected from a user's perspective.
  • If this is a pre-GA feature, it is behind a feature toggle.
  • The docs are updated, and if this is a notable improvement, it's added to our What's New doc.

@Develer Develer added area/frontend no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes area/dataviz Anything that relates to Data Visualisation work but is not specific to one panel labels Dec 12, 2023
@Develer Develer added this to the 10.3.x milestone Dec 12, 2023
@Develer Develer self-assigned this Dec 12, 2023
@Develer Develer marked this pull request as ready for review December 12, 2023 19:15
@Develer Develer requested review from grafanabot and a team as code owners December 12, 2023 19:15
@Develer Develer requested review from tskarhed, eledobleefe and mckn and removed request for a team December 12, 2023 19:15
@axelavargas axelavargas self-requested a review December 14, 2023 10:14
@Develer Develer requested review from ryantxu and a team December 18, 2023 12:58
Copy link
Member

@axelavargas axelavargas left a comment

Choose a reason for hiding this comment

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

Hey @Develer 👋🏾 , great job tackling this PR, I gave it a test locally and it works as expected 🥳 .

From my point of view is almost ready, would be great if users could a short description in the UI about this option.

As well, we are missing a few things:

public/app/core/components/OptionsUI/registry.tsx Outdated Show resolved Hide resolved
@nmarrs nmarrs added add to changelog and removed no-changelog Skip including change in changelog/release notes labels Dec 26, 2023
@nmarrs nmarrs requested review from a team and nmarrs and removed request for a team December 26, 2023 22:36
Copy link
Contributor

@nmarrs nmarrs left a comment

Choose a reason for hiding this comment

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

Added some docs and a few tests :) overall LGTM :)

I really like how you did not change the default behavior and instead made this opt-in functionality - this helps us to prevent messing up users' dashboards 💯

Screen.Recording.2024-01-01.at.5.07.47.PM.mov

{ name: 'metric ton (t)', id: 'masst', fn: toFixedUnit('t') },
],
},
{
name: 'Length',
formats: [
{ name: 'millimeter (mm)', id: 'lengthmm', fn: SIPrefix('m', -1) },
{ name: 'millimeter (mm)', id: 'lengthmm', fn: SIPrefix('m', -1, scalable) },
{ name: 'inch (in)', id: 'lengthin', fn: toFixedUnit('in') },
Copy link
Contributor

Choose a reason for hiding this comment

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

inches / feet (and other non worldwide standard measures (fluid ounces etc) can also be considered scalable 🤔 (i.e. 12 inches in 1 ft, 5280ft in 1 mile) - though it seems like our system currently only supports metric scaling 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, indeed, right now it's only system international related units 🙂 We have to implement a separate scaling function for inches and feet.

Copy link
Collaborator

@imatwawana imatwawana left a comment

Choose a reason for hiding this comment

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

Thanks for the update to the docs. Two thoughts:

  1. What's written there makes sense, but I don't understand the underlying logic of what triggers the scaling of units. Should we explain that logic a bit?
  2. Since we're making this default behaviour, and will change the appearance of people's visualizations, I think it warrants a What's new entry.

@Develer
Copy link
Contributor Author

Develer commented Jan 2, 2024

Thanks for the update to the docs. Two thoughts:

  1. What's written there makes sense, but I don't understand the underlying logic of what triggers the scaling of units. Should we explain that logic a bit?
  2. Since we're making this default behaviour, and will change the appearance of people's visualizations, I think it warrants a What's new entry.

Before adding the scaling option, units have scaled by default, so there are no significant changes for the user. Technically, we only added the option to turn off scaling 😁

@imatwawana
Copy link
Collaborator

Thanks for the update to the docs. Two thoughts:

  1. What's written there makes sense, but I don't understand the underlying logic of what triggers the scaling of units. Should we explain that logic a bit?
  2. Since we're making this default behaviour, and will change the appearance of people's visualizations, I think it warrants a What's new entry.

Before adding the scaling option, units have scaled by default, so there are no significant changes for the user. Technically, we only added the option to turn off scaling 😁

Ah okay, I understand. Then it's fine as is.

@Develer Develer merged commit a05f266 into main Jan 2, 2024
23 checks passed
@Develer Develer deleted the 50975-scalable-units branch January 2, 2024 17:40
@summerwollin summerwollin modified the milestones: 10.3.x, 10.3.0 Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add to changelog area/dataviz Anything that relates to Data Visualisation work but is not specific to one panel area/frontend no-backport Skip backport of PR type/docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unit / Stat: Unit selection not being used (autoscaling down)
5 participants