fix(dashboard): Format job queue durations as human-readable h/m/s#4635
fix(dashboard): Format job queue durations as human-readable h/m/s#4635biggamesmallworld wants to merge 1 commit intomasterfrom
Conversation
Display job queue durations in a human-readable format (e.g. "2h 5m 3s") instead of raw milliseconds. Fixes OSS-471 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdded a 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
|
Dashboard Preview: https://admin-dashboard-bf5lh230f-vendure.vercel.app |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/dashboard/src/app/routes/_authenticated/_system/job-queue.tsx`:
- Around line 217-222: The current truthy check in the duration cell (cell: ({
row }) => { return row.original.duration ?
formatDurationMs(row.original.duration) : null; }) will hide zero durations;
replace the truthy check with an explicit null/undefined check (e.g.,
row.original.duration != null) so that 0 is treated as a valid duration and
passed to formatDurationMs, while null/undefined still yields null.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ae5ac506-564f-4d77-a4a2-66606492a584
📒 Files selected for processing (1)
packages/dashboard/src/app/routes/_authenticated/_system/job-queue.tsx
| duration: { | ||
| cell: ({ row }) => { | ||
| return row.original.duration ? `${row.original.duration}ms` : null; | ||
| return row.original.duration | ||
| ? formatDurationMs(row.original.duration) | ||
| : null; | ||
| }, |
There was a problem hiding this comment.
Truthy check would hide duration = 0 instead of showing < 1s.
The condition row.original.duration ? ... treats 0 as falsy. If a job completes instantly (duration of 0ms), this would render nothing instead of < 1s. Use an explicit null check to distinguish between "no duration yet" and "zero duration".
Proposed fix
duration: {
cell: ({ row }) => {
- return row.original.duration
+ return row.original.duration != null
? formatDurationMs(row.original.duration)
: null;
},
},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| duration: { | |
| cell: ({ row }) => { | |
| return row.original.duration ? `${row.original.duration}ms` : null; | |
| return row.original.duration | |
| ? formatDurationMs(row.original.duration) | |
| : null; | |
| }, | |
| duration: { | |
| cell: ({ row }) => { | |
| return row.original.duration != null | |
| ? formatDurationMs(row.original.duration) | |
| : null; | |
| }, |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/dashboard/src/app/routes/_authenticated/_system/job-queue.tsx`
around lines 217 - 222, The current truthy check in the duration cell (cell: ({
row }) => { return row.original.duration ?
formatDurationMs(row.original.duration) : null; }) will hide zero durations;
replace the truthy check with an explicit null/undefined check (e.g.,
row.original.duration != null) so that 0 is treated as a valid duration and
passed to formatDurationMs, while null/undefined still yields null.
|
@biggamesmallworld Nice improvement ,the human-readable duration makes the dashboard much easier to scan 👍 I actually have an open PR that also formats durations (and adds bulk actions support) Would you mind taking a quick look when you get a chance? If everything else looks good from your side, I’m happy to remove the duration formatting part from mine so we can avoid overlap/conflicts as i was about to solve existing conflict there and just keep the bulk action there. |



Description
Display job queue durations in a human-readable format (e.g.
2h 5m 3s,45s,< 1s) instead of raw milliseconds (e.g.125000ms).Fixes OSS-471
Breaking changes
None.
Screenshots
Checklist
📌 Always:
👍 Most of the time: