Skip to content

refactor(aurora-portal): extract shared formatBytes utility with binary and decimal support#511

Open
mark-karnaukh-extern-sap wants to merge 2 commits intomainfrom
mark-shared-format-bytes-utility
Open

refactor(aurora-portal): extract shared formatBytes utility with binary and decimal support#511
mark-karnaukh-extern-sap wants to merge 2 commits intomainfrom
mark-shared-format-bytes-utility

Conversation

@mark-karnaukh-extern-sap
Copy link
Contributor

@mark-karnaukh-extern-sap mark-karnaukh-extern-sap commented Feb 18, 2026

Summary

Extracts duplicated inline formatBytes implementations from multiple components into a single shared utility supporting both binary (IEC) and decimal (SI) unit systems.


Changes

New

  • src/client/utils/formatBytes.ts — shared utility with formatBytes, formatBytesDecimal, formatBytesBinary

Updated

  • SizeDisplay.tsx — replaced inline implementation with formatBytesDecimal
  • ContainerListView.tsx — replaced inline implementation with shared utility
  • List.tsx — replaced inline implementation with shared utility

Tests

  • formatBytes.test.ts — new, full coverage of both unit systems, edge cases, decimals option
  • SizeDisplay.test.tsx — updated expected values to match SI output
  • ImageDetailsView.test.tsx — fixed size inputs to SI-round boundaries
  • DeleteImageModal.test.tsx — fixed size: 1024size: 1000

Notes

SizeDisplay uses formatBytesDecimal (SI) — appropriate since OpenStack APIs return raw byte counts, not binary-aligned values. Test fixtures that previously used binary boundaries (e.g. 1073741824, 1024) were updated to SI-round equivalents (e.g. 1000000000, 1000) to produce clean expected values.

Checklist

  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have made corresponding changes to the documentation (if applicable).
  • My changes generate no new warnings or errors.

@mark-karnaukh-extern-sap mark-karnaukh-extern-sap changed the title refactor(aurora-portal): extract shared formatBytes utility with binary and decimal support refactor(aurora-portal): extract shared format bytes utility with binary and decimal support Feb 18, 2026
@mark-karnaukh-extern-sap mark-karnaukh-extern-sap changed the title refactor(aurora-portal): extract shared format bytes utility with binary and decimal support refactor(aurora-portal): extract shared formatBytes utility with binary and decimal support Feb 18, 2026
@mark-karnaukh-extern-sap mark-karnaukh-extern-sap linked an issue Feb 18, 2026 that may be closed by this pull request
5 tasks
@mark-karnaukh-extern-sap mark-karnaukh-extern-sap marked this pull request as ready for review February 19, 2026 15:46
@mark-karnaukh-extern-sap mark-karnaukh-extern-sap requested a review from a team as a code owner February 19, 2026 15:46
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.

object-storage-ui: FormatBytes - Shared byte formatting utility

3 participants

Comments