Skip to content

Add status filter and highlight failed runs on dashboard#7

Open
marawan206 wants to merge 1 commit into
mainfrom
dashboard-failure-visibility
Open

Add status filter and highlight failed runs on dashboard#7
marawan206 wants to merge 1 commit into
mainfrom
dashboard-failure-visibility

Conversation

@marawan206

Copy link
Copy Markdown
Contributor

Since CI failures currently have no notifications, the dashboard is the only place anyone sees them — so this makes failures easier to spot, plus some cleanup.

Changes

  • Status filter (Failed / In Progress / Success) on the Workflow Results table. The /gitcommit API has no status parameter, so this filters the rows already loaded for the current page, client-side. A caption under the filters states the scope ("Showing N of M runs on this page matching …") so it's not mistaken for a global filter.
  • Failed rows are tinted red for at-a-glance scanning.
  • Stable React keys (result id) instead of array index in the results table.
  • One shared formatDuration (utils/format.ts) replacing three diverging formatters — the old calculateTimeDifference rendered e.g. 1.5 minute / 30 sec while the stats card rendered 1.5m / 45s. Now consistent everywhere (workflow table, workflow detail, stats).
  • Removed a stray console.log left in the filter effect.

Verification

pnpm build and pnpm lint both pass. Changes are presentational + client-side filtering; no API or data-model changes.

Follow-ups (backend-gated, not in this PR)

  • A real status filter and global success-rate need a server-side param / aggregate endpoint on api.comfy.org — the current stats cards are necessarily scoped to the loaded page ("in current view"). Worth a backend ticket.

Surface CI failures more directly and tidy up shared formatting:

- Add a Status filter (Failed / In Progress / Success) to the workflow
  results table. The /gitcommit API has no status param, so it filters
  the current page client-side, with a caption making the scope clear.
- Highlight failed rows with a subtle red tint for at-a-glance scanning.
- Use stable React keys (result id) instead of array index.
- Consolidate three diverging duration/time formatters into a single
  formatDuration helper in utils/format.ts.
- Remove a stray console.log left in the filter effect.
@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comfyci Ready Ready Preview, Comment Jun 12, 2026 10:02pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR consolidates duration formatting across the codebase and adds a client-side workflow status filter. A new shared formatDuration utility is introduced, three components migrate from local or imported helpers to this shared implementation, and the workflow results page gains a Status dropdown filter that displays matching results with count summaries.

Changes

Duration Formatting and Status Filtering

Layer / File(s) Summary
Duration Formatting Utility
utils/format.ts
New formatDuration(seconds: number) function formats durations into human-readable strings (seconds, minutes, or hours+minutes), returning '—' for non-finite or non-positive values.
Duration Formatting Adoption
components/StatsDashboard.tsx, pages/index.tsx, pages/workflow/[id].tsx
StatsDashboard, index, and workflow pages switch from local calculateTimeDifference or in-file helpers to the shared formatDuration utility for displaying run durations—no time for duplication anymore! All usage sites adopt the unified formatting logic.
Status Filter Feature
pages/index.tsx
Introduces client-side status filtering with statusFilter state, a new Status dropdown control, visibleResults computed filtering of paged results, conditional count summaries, and updated table rendering. The "Clear all" action now resets status filters. Removes the exported calculateTimeDifference function and a debug console.log statement.
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dashboard-failure-visibility
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch dashboard-failure-visibility

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@utils/format.ts`:
- Around line 7-9: The current conversion computes hrs = Math.floor(mins / 60)
and rem = Math.round(mins % 60), but rounding can make rem == 60 (e.g., "1h
60m"); update the logic in utils/format.ts to detect rem === 60 and if so
increment hrs by 1 and set rem to 0 before returning the formatted string
(referencing the hrs and rem variables used in the diff).
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 69be722a-b2e5-4ecf-8b96-d94ac51632e8

📥 Commits

Reviewing files that changed from the base of the PR and between ba00db2 and dc834f0.

📒 Files selected for processing (4)
  • components/StatsDashboard.tsx
  • pages/index.tsx
  • pages/workflow/[id].tsx
  • utils/format.ts

Comment thread utils/format.ts
Comment on lines +7 to +9
const hrs = Math.floor(mins / 60)
const rem = Math.round(mins % 60)
return `${hrs}h ${rem}m`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Fix hour-boundary rounding (1h 60m can appear).

At Line 8, rounding remainder minutes can produce 60, which renders invalid hour/minute output (time rhyme: minutes shouldn’t hit sixty twice).

Suggested patch
 export function formatDuration(seconds: number): string {
     if (!isFinite(seconds) || seconds <= 0) return '—'
     if (seconds < 60) return `${Math.round(seconds)}s`
     const mins = seconds / 60
-    if (mins < 60) return `${mins.toFixed(1)}m`
-    const hrs = Math.floor(mins / 60)
-    const rem = Math.round(mins % 60)
+    const totalMinutes = Math.round(mins)
+    if (totalMinutes < 60) return `${mins.toFixed(1)}m`
+    const hrs = Math.floor(totalMinutes / 60)
+    const rem = totalMinutes % 60
     return `${hrs}h ${rem}m`
 }
📝 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.

Suggested change
const hrs = Math.floor(mins / 60)
const rem = Math.round(mins % 60)
return `${hrs}h ${rem}m`
export function formatDuration(seconds: number): string {
if (!isFinite(seconds) || seconds <= 0) return '—'
if (seconds < 60) return `${Math.round(seconds)}s`
const mins = seconds / 60
const totalMinutes = Math.round(mins)
if (totalMinutes < 60) return `${mins.toFixed(1)}m`
const hrs = Math.floor(totalMinutes / 60)
const rem = totalMinutes % 60
return `${hrs}h ${rem}m`
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@utils/format.ts` around lines 7 - 9, The current conversion computes hrs =
Math.floor(mins / 60) and rem = Math.round(mins % 60), but rounding can make rem
== 60 (e.g., "1h 60m"); update the logic in utils/format.ts to detect rem === 60
and if so increment hrs by 1 and set rem to 0 before returning the formatted
string (referencing the hrs and rem variables used in the diff).

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.

1 participant