Skip to content

Conversation

@pravesh-sharma
Copy link
Contributor

@pravesh-sharma pravesh-sharma commented Dec 30, 2025

Summary by CodeRabbit

  • Improvements
    • System memory statistics table now features improved sorting capabilities. The "Memory usage" and "Memory bytes" columns can now be sorted alphanumerically, providing users with enhanced control over data organization and presentation. This enables more effective analysis and direct comparison of memory metrics within the dashboard for improved system monitoring and decision-making.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 30, 2025

Walkthrough

Adds alphanumeric sorting configuration to two table column definitions in Memory.jsx, enabling case-insensitive, numeric-aware sorting for "Memory usage" and "Memory bytes" columns.

Changes

Cohort / File(s) Summary
Table Column Sorting Configuration
web/pgadmin/dashboard/static/js/SystemStats/Memory.jsx
Adds sortingFn: 'alphanumeric' to two column header definitions for Memory usage and Memory bytes columns to enable alphanumeric sorting

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: enabling alphanumeric sorting for the Memory usage table by adding sortingFn properties to column definitions.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a5e9315 and 54568f0.

📒 Files selected for processing (1)
  • web/pgadmin/dashboard/static/js/SystemStats/Memory.jsx
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: run-python-tests-pg (windows-latest, 18)
  • GitHub Check: run-python-tests-pg (windows-latest, 17)
  • GitHub Check: run-python-tests-pg (windows-latest, 16)
  • GitHub Check: run-feature-tests-pg (18)
  • GitHub Check: run-feature-tests-pg (13)
  • GitHub Check: run-feature-tests-pg (17)
  • GitHub Check: run-feature-tests-pg (16)
  • GitHub Check: run-feature-tests-pg (14)
  • GitHub Check: run-feature-tests-pg (15)

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
web/pgadmin/dashboard/static/js/SystemStats/Memory.jsx (2)

164-164: Remove gettext() from formatted numeric values.

The use of gettext() around toPrettySize() results for memory_usage and memory_bytes is incorrect. The gettext() function is for translating static UI strings, not for formatting dynamic data values. Formatted memory strings like "1.5 MB" should not be passed through translation functions.

🔎 Proposed fix
-pmu_info_list.push({ icon: '', pid: pmu_info_obj[key]['pid'], name: gettext(pmu_info_obj[key]['name']), memory_usage: gettext(toPrettySize(pmu_info_obj[key]['memory_usage'])), memory_bytes: gettext(toPrettySize(pmu_info_obj[key]['memory_bytes'])) });
+pmu_info_list.push({ icon: '', pid: pmu_info_obj[key]['pid'], name: gettext(pmu_info_obj[key]['name']), memory_usage: toPrettySize(pmu_info_obj[key]['memory_usage']), memory_bytes: toPrettySize(pmu_info_obj[key]['memory_bytes']) });

Note: The gettext() call for name is likely correct if it's a translatable label, so keep that one.


59-65: Alphanumeric sorting won't correctly handle different memory units.

While sortingFn: 'alphanumeric' performs lexicographic string comparison, it cannot correctly sort values across different units (KB, MB, GB, etc.). For example, "999 KB" sorts before "1 GB" alphabetically, even though 999 KB < 1 GB numerically.

A compareSizeVals function already exists in utils.js that correctly converts size strings to bytes for accurate comparison—but it's not being used. The recommended fix is to either:

  1. Configure the columns to use compareSizeVals as a custom sorting function, or
  2. Store raw numeric byte values in separate fields for sorting while displaying the formatted strings

Additionally, wrapping formatted numeric values in gettext() is unnecessary, as gettext is intended for user-facing translatable strings, not computed display values.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a5e9315 and 54568f0.

📒 Files selected for processing (1)
  • web/pgadmin/dashboard/static/js/SystemStats/Memory.jsx
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: run-python-tests-pg (windows-latest, 18)
  • GitHub Check: run-python-tests-pg (windows-latest, 17)
  • GitHub Check: run-python-tests-pg (windows-latest, 16)
  • GitHub Check: run-feature-tests-pg (18)
  • GitHub Check: run-feature-tests-pg (13)
  • GitHub Check: run-feature-tests-pg (17)
  • GitHub Check: run-feature-tests-pg (16)
  • GitHub Check: run-feature-tests-pg (14)
  • GitHub Check: run-feature-tests-pg (15)

@adityatoshniwal adityatoshniwal merged commit a9bf4c2 into pgadmin-org:master Jan 1, 2026
37 checks passed
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