Skip to content

Introduce helper for consistently displaying data size units - #277

Merged
mxsrc merged 1 commit into
mainfrom
display-units
Mar 26, 2026
Merged

mxsrc merged 1 commit into
mainfrom
display-units

Conversation

@mxsrc

@mxsrc mxsrc commented Mar 22, 2026 •

Copy link
Copy Markdown
Contributor

We display a lot of data sizes in the frontend, it's important to handle this correctly and consistently. The formatBytes helper used to always use binary (base 1024) units, in some places incorrectly. In other places manual calculations were used to calculate decimal units. The updated formatBytes helper takes an additional decimal/binary argument that allows to toggle between both modes, giving XB/XiB units respectively. Using the i-infix ensures there is no ambiguity, yet we still need to ensure to consistently use binary units for memory only.

@mxsrc
mxsrc requested a review from EbiRider March 22, 2026 22:22

@EbiRider EbiRider left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

that's a great refactor, should help keep things consistent, i face similar issue with the limits config for the sliders but those are more difficult to align because their purpose are different in each screen

@mxsrc

mxsrc commented Mar 26, 2026

Copy link
Copy Markdown
Contributor Author

Yeah, those were purposely left out in this because the change is not as straight forward.

@mxsrc
mxsrc merged commit 43778a3 into main Mar 26, 2026
2 checks passed
@mxsrc
mxsrc deleted the display-units branch March 26, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants