-
Notifications
You must be signed in to change notification settings - Fork 84
Improved pluralization handling throughout Admin UI #6930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
This PR successfully centralizes pluralization logic across the Admin UI by introducing a reusable pluralize utility function. The refactoring replaces numerous inline ternary operators with consistent function calls, improving code maintainability and readability.
Key changes:
- Added
pluralize(count, singular, plural)utility function inutils.ts - Updated
MONITOR_UPDATE_NAMESto store [singular, plural] tuples, properly handling non-countable terms (e.g., "In review") by using identical forms - Refactored 7 components/hooks to use the centralized utility instead of inline ternary logic
- Simplified message construction in DataHub sync by removing complex "is/are" logic
Impact:
- Improves code consistency across the codebase
- Makes pluralization logic more testable and maintainable
- No functional changes to user-facing text (behavior preserved)
- Minor cleanup opportunity:
isAssetListprop inMonitorResultDescriptionis now unused
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- The refactoring is straightforward and well-executed. All pluralization logic has been properly preserved through the tuple approach, with non-countable terms correctly using identical singular/plural forms. The changes are purely structural improvements with no functional impact on user-facing behavior. The only minor issue is an unused prop that can be cleaned up.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| clients/admin-ui/src/features/common/utils.ts | 5/5 | Added simple pluralize utility function that returns singular or plural form based on count |
| clients/admin-ui/src/features/data-discovery-and-detection/action-center/constants.ts | 5/5 | Updated MONITOR_UPDATE_NAMES to store [singular, plural] tuples instead of single strings; properly handles non-pluralizable terms by using identical forms |
| clients/admin-ui/src/features/data-discovery-and-detection/action-center/MonitorResultDescription.tsx | 4/5 | Removed isAssetList-dependent pluralization logic in favor of centralized pluralize() utility; isAssetList prop now unused in logic but still accepted |
Additional Comments (1)
-
clients/admin-ui/src/features/data-discovery-and-detection/action-center/MonitorResult.tsx, line 114-117 (link)style:
isAssetListprop is no longer used byMonitorResultDescriptionand can be removed
8 files reviewed, 2 comments
...dmin-ui/src/features/data-discovery-and-detection/action-center/MonitorResultDescription.tsx
Show resolved
Hide resolved
a028dc2 to
aeb3b75
Compare
Ticket ENG-1669
Description Of Changes
Refactored pluralization logic across the Admin UI to use a centralized
pluralizeutility function instead of inline ternary operators. This improves consistency, readability, and maintainability.Code Changes
MonitorResultto usepluralize()for asset/field/system countsMonitorResultDescriptionto handle plural forms for all monitor update typesInProgressMonitorTaskItemto usepluralize()for field countsMONITOR_UPDATE_NAMESconstant to store [singular, plural] tuplesDatahubDataSyncTabto usepluralize()for dataset countsuseMonitorConfigTableto usepluralize()for project countsPrivacyRequestDetailsManualTaskTabto usepluralize()for task countsSteps to Confirm
Pre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works