Fix #267: display file sizes in GiB/MiB/KiB instead of GB/MB/KB - #268
Fix #267: display file sizes in GiB/MiB/KiB instead of GB/MB/KB#268palakbhati wants to merge 2 commits into
Conversation
Size formatting used binary (1024-based) division but labeled units as decimal (GB/MB/KB). Relabeled to correct binary unit names (KiB/MiB/GiB) in formatUploadSize, formatFileSize, the activity chart axis label, and a related comment.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
📝 WalkthroughWalkthroughUpdated file-size formatting and activity chart labels to consistently use binary units: KiB, MiB, and GiB. Undefined file sizes now display as ChangesBinary size unit consistency
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
public/js/angular-application.js (1)
636-636: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider using "GiB" for consistency with the rest of the UI.
The chart axis label uses "GiByte" while
formatFileSizeandformatUploadSizeuse "GiB". If the goal is consistent IEC unit labeling across the UI, consider aligning this to "GiB" as well. If the longer form is intentional for chart readability, feel free to disregard.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@public/js/angular-application.js` at line 636, Update the chart axis label in the relevant chart configuration from “Uploaded Data (GiByte)” to “Uploaded Data (GiB)” to match the IEC unit formatting used by formatFileSize and formatUploadSize.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@public/js/components/collection-data-table/collection-data-table.js`:
- Around line 99-104: Update ctrl.formatUploadSize to handle undefined/null
sizes consistently by delegating to DatabusUtils.formatFileSize, or add an
equivalent guard returning "0 KiB" before the existing calculations. Prefer
delegation to remove duplicated formatting logic and prevent "NaN GiB" results.
---
Nitpick comments:
In `@public/js/angular-application.js`:
- Line 636: Update the chart axis label in the relevant chart configuration from
“Uploaded Data (GiByte)” to “Uploaded Data (GiB)” to match the IEC unit
formatting used by formatFileSize and formatUploadSize.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 788fab78-446b-47cc-b0b3-9dc5f42bc351
⛔ Files ignored due to path filters (1)
public/dist/main.jsis excluded by!**/dist/**
📒 Files selected for processing (4)
public/js/angular-application.jspublic/js/components/collection-data-table/collection-data-table.jspublic/js/utils/databus-utils.jsserver/app/common/queries/query-modules/pages.js
Removes duplicated size-formatting logic and inherits the undefined guard (returns '0 KiB' instead of 'NaN GiB').
Size formatting used binary (1024-based) division but labeled units as decimal (GB/MB/KB). Relabeled to correct binary unit names (KiB/MiB/GiB) in formatUploadSize, formatFileSize, the activity chart axis label, and a related comment.
Fixes #267
Problem
File/version sizes in the UI were computed using binary (1024-based)
division but labeled with decimal unit names (GB, MB, KB), which could
confuse users about actual file sizes.
Fix
Relabeled the units to their correct binary names (GiB, MiB, KiB) in:
formatFileSize(databus-utils.js)formatUploadSize(collection-data-table.js)No computation logic was changed — only the unit labels, since the
existing math is already binary-based.
Testing
Rebuilt the frontend bundle locally via webpack and verified in
browser DevTools that the compiled
main.jscorrectly outputsGiB/MiB/KiBinstead ofGB/MB/KB.Summary by CodeRabbit
0 KiB.