Skip to content

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

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

refactor: consolidate count and relative-time formatting utilities#5220
xuang7 wants to merge 3 commits 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-commenter commented May 26, 2026

Codecov Report

❌ Patch coverage is 90.32258% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.67%. Comparing base (8a7366f) to head (739580c).

Files with missing lines Patch % Lines
...-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.57%   48.67%   +0.09%     
  Complexity     2379     2379              
============================================
  Files          1042     1043       +1     
  Lines         39971    39977       +6     
  Branches       4252     4252              
============================================
+ Hits          19415    19457      +42     
+ Misses        19410    19376      -34     
+ Partials       1146     1144       -2     
Flag Coverage Δ *Carryforward flag
access-control-service 39.53% <ø> (ø) Carriedforward from 8a7366f
agent-service 33.76% <ø> (ø) Carriedforward from 8a7366f
amber 51.58% <ø> (ø) Carriedforward from 8a7366f
computing-unit-managing-service 0.00% <ø> (ø) Carriedforward from 8a7366f
config-service 0.00% <ø> (ø) Carriedforward from 8a7366f
file-service 37.99% <ø> (ø) Carriedforward from 8a7366f
frontend 40.26% <90.32%> (+0.24%) ⬆️
python 90.46% <ø> (ø) Carriedforward from 8a7366f
workflow-compiling-service 56.81% <ø> (ø) Carriedforward from 8a7366f

*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