Skip to content

fix: correct badge hover colors and completed job status badge colors#290

Open
pggdev wants to merge 1 commit into
volcano-sh:mainfrom
pggdev:fix/badge-hover-color
Open

fix: correct badge hover colors and completed job status badge colors#290
pggdev wants to merge 1 commit into
volcano-sh:mainfrom
pggdev:fix/badge-hover-color

Conversation

@pggdev
Copy link
Copy Markdown

@pggdev pggdev commented May 30, 2026

Summary

fixes #289

  • Replace the default red hover color used by the affected badges with the intended theme hover color.

  • Normalize job status values before applying the badge color mapping.

  • Ensure the Completed job status resolves to the configured green badge color instead of falling back to the default red style.

Screenshots:

Before

Image Image

After

image image

Signed-off-by: pggdev <princegupta.ns153@gmail.com>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request standardizes status handling across the dashboard components (jobs, podgroups, pods, and queues) by normalizing status phases to lowercase and adding hover effects to the status badges. Feedback on these changes highlights two issues: first, the fallback badge style in jobs/columns.tsx defaults to red, which incorrectly styles unknown statuses as failures instead of gray; second, the backend filtering in helpers.ts fails to match podgroups with undefined phases when filtering by 'unknown' because it does not default undefined phases to 'unknown' like the frontend does.

Comment on lines 207 to +213
status === "completed"
? "bg-green-100 text-green-800"
? "bg-green-100 text-green-800 hover:bg-green-100/60"
: status === "running"
? "bg-blue-100 text-blue-800"
? "bg-blue-100 text-blue-800 hover:bg-blue-100/60"
: status === "pending"
? "bg-yellow-100 text-yellow-800"
: "bg-red-100 text-red-800"
? "bg-yellow-100 text-yellow-800 hover:bg-yellow-100/60"
: "bg-red-100 text-red-800 hover:bg-red-100/60"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The fallback badge style defaults to red (bg-red-100 text-red-800 hover:bg-red-100/60), which means any unhandled or unknown status will be styled as a failure. This is inconsistent with jobs-management.tsx where unknown is styled with a gray background.

We should explicitly handle failed and terminated statuses as red, and default to gray for unknown or other unexpected statuses.

              status === "completed"
                ? "bg-green-100 text-green-800 hover:bg-green-100/60"
                : status === "running"
                  ? "bg-blue-100 text-blue-800 hover:bg-blue-100/60"
                  : status === "pending"
                    ? "bg-yellow-100 text-yellow-800 hover:bg-yellow-100/60"
                    : status === "failed" || status === "terminated"
                      ? "bg-red-100 text-red-800 hover:bg-red-100/60"
                      : "bg-gray-100 text-gray-800 hover:bg-gray-100/60"

Comment on lines +222 to 224
if (status && status !== "all" && pg.status?.phase?.toLowerCase() !== status) {
return false;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

When filtering by status, if the user selects unknown, the backend filter will fail to match podgroups with an undefined phase. This is because pg.status?.phase?.toLowerCase() evaluates to undefined, and undefined !== "unknown" is true, causing them to be filtered out.

To align with the frontend mapping (which defaults undefined phase to 'unknown'), we should normalize the phase to 'unknown' on the backend before comparing.

Suggested change
if (status && status !== "all" && pg.status?.phase?.toLowerCase() !== status) {
return false;
}
const pgStatus = pg.status?.phase?.toLowerCase() || "unknown";
if (status && status !== "all" && pgStatus !== status) {
return false;
}

Copy link
Copy Markdown
Contributor

@de6p de6p left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.
lgtm 🚀
cc @JesseStutler

@volcano-sh-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: de6p
Once this PR has been reviewed and has the lgtm label, please assign william-wang for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Badges display incorrect colors in hover and completed job states

3 participants