Skip to content

refactor: consolidate count and relative-time formatting utilities#5220

Open
xuang7 wants to merge 1 commit into
apache:mainfrom
xuang7:refactor/relative-time/count-utils
Open

refactor: consolidate count and relative-time formatting utilities#5220
xuang7 wants to merge 1 commit into
apache:mainfrom
xuang7:refactor/relative-time/count-utils

Conversation

@xuang7
Copy link
Copy Markdown
Contributor

@xuang7 xuang7 commented May 26, 2026

What changes were proposed in this PR?

This PR extracts duplicated formatCount and relative-time formatting logic into the shared format.util.ts utility file, and updates inline usages to use the shared utilities. No behavior change.

Any related issues, documentation, discussions?

Closes #5218

How was this PR tested?

Existing automated tests passed.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Opus 4.7

@github-actions github-actions Bot added refactor Refactor the code frontend Changes related to the frontend GUI labels May 26, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 35.48387% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.58%. Comparing base (24f7702) to head (4a06352).

Files with missing lines Patch % Lines
frontend/src/app/common/util/format.util.ts 19.04% 15 Missing and 2 partials ⚠️
...-item/user-computing-unit-list-item.component.html 0.00% 1 Missing ⚠️
...st-item/user-computing-unit-list-item.component.ts 50.00% 1 Missing ⚠️
...t/workflow/detail/hub-workflow-detail.component.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5220      +/-   ##
============================================
+ Coverage     48.55%   48.58%   +0.03%     
  Complexity     2372     2372              
============================================
  Files          1042     1043       +1     
  Lines         39971    39960      -11     
  Branches       4252     4246       -6     
============================================
+ Hits          19408    19415       +7     
+ Misses        19414    19395      -19     
- Partials       1149     1150       +1     
Flag Coverage Δ *Carryforward flag
access-control-service 39.53% <ø> (ø) Carriedforward from 24f7702
agent-service 33.76% <ø> (ø) Carriedforward from 24f7702
amber 51.52% <ø> (ø) Carriedforward from 24f7702
computing-unit-managing-service 0.00% <ø> (ø) Carriedforward from 24f7702
config-service 0.00% <ø> (ø) Carriedforward from 24f7702
file-service 37.99% <ø> (ø) Carriedforward from 24f7702
frontend 40.10% <35.48%> (+0.07%) ⬆️
python 90.51% <ø> (ø) Carriedforward from 24f7702
workflow-compiling-service 56.81% <ø> (ø) Carriedforward from 24f7702

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@Yicong-Huang Yicong-Huang left a comment

Choose a reason for hiding this comment

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

Good change! But I would kindly ask you to provide tests for all those format utils. The coverage is quite low currently.

return new Date(timestamp).toLocaleDateString();
}
}
formatRelativeTime = formatRelativeTime;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just wonder why are these rename to the same name needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI refactor Refactor the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consolidate relative time and count formatting utilities

3 participants