Skip to content

Fix #267: display file sizes in GiB/MiB/KiB instead of GB/MB/KB - #268

Open
palakbhati wants to merge 2 commits into
dbpedia:masterfrom
palakbhati:fix-267-gib-units
Open

Fix #267: display file sizes in GiB/MiB/KiB instead of GB/MB/KB#268
palakbhati wants to merge 2 commits into
dbpedia:masterfrom
palakbhati:fix-267-gib-units

Conversation

@palakbhati

@palakbhati palakbhati commented Jul 10, 2026

Copy link
Copy Markdown

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)
  • The activity chart axis label (angular-application.js)
  • A related code comment (pages.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.js correctly outputs
GiB/MiB/KiB instead of GB/MB/KB.

Summary by CodeRabbit

  • Bug Fixes
    • Updated file-size formatting to use accurate binary units (KiB, MiB, GiB) across uploads and related displays.
    • Fixed activity chart label/unit text to match the binary-based calculations.
    • Undefined file sizes now display as 0 KiB.
    • Improved consistency between table upload-size values and the underlying chart computations.

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.
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a1281170-afc8-42ce-aa7b-2c17938e75ae

📥 Commits

Reviewing files that changed from the base of the PR and between 6bf8bd1 and 1c776d6.

⛔ Files ignored due to path filters (1)
  • public/dist/main.js is excluded by !**/dist/**
📒 Files selected for processing (1)
  • public/js/components/collection-data-table/collection-data-table.js

📝 Walkthrough

Walkthrough

Updated file-size formatting and activity chart labels to consistently use binary units: KiB, MiB, and GiB. Undefined file sizes now display as 0 KiB.

Changes

Binary size unit consistency

Layer / File(s) Summary
Binary size formatting
public/js/utils/databus-utils.js, public/js/components/collection-data-table/collection-data-table.js
File-size formatters now use binary thresholds, rounding, and KiB/MiB/GiB labels; undefined values return 0 KiB.
Chart unit labels
server/app/common/queries/query-modules/pages.js, public/js/angular-application.js
Activity chart comments and displayed labels now identify scaled uploaded data as GiB.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: switching displayed file sizes from GB/MB/KB to GiB/MiB/KiB.
Linked Issues check ✅ Passed The PR updates the UI labels and size formatting to use binary units, satisfying the linked issue.
Out of Scope Changes check ✅ Passed The changes stay focused on size-unit labeling and formatting, with no obvious unrelated code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
public/js/angular-application.js (1)

636-636: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider using "GiB" for consistency with the rest of the UI.

The chart axis label uses "GiByte" while formatFileSize and formatUploadSize use "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

📥 Commits

Reviewing files that changed from the base of the PR and between 2c775e7 and 6bf8bd1.

⛔ Files ignored due to path filters (1)
  • public/dist/main.js is excluded by !**/dist/**
📒 Files selected for processing (4)
  • public/js/angular-application.js
  • public/js/components/collection-data-table/collection-data-table.js
  • public/js/utils/databus-utils.js
  • server/app/common/queries/query-modules/pages.js

Comment thread public/js/components/collection-data-table/collection-data-table.js
Removes duplicated size-formatting logic and inherits the undefined
guard (returns '0 KiB' instead of 'NaN GiB').
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.

UI bug -> sizes in GB instead of GiB

1 participant