Repository navigation
refactor(ui): migrate StatusBadge to core Badge + Storybook - #33884
shah-harshit wants to merge 3 commits into
Conversation
Replace the legacy div + status-badge.less implementation of StatusBadge and StatusBadgeV2 with the core `@openmetadata/ui-core-components` Badge, keeping the exact public API so all call sites stay untouched. Each StatusType maps to the nearest core Badge (utility-scale) color via a new STATUS_TYPE_TO_BADGE_COLOR map; the utility palette auto-flips in dark, so every status gains dark-mode support with no per-status CSS. - v1 keeps label-keyed icons, v2 keeps status-keyed icons + showIcon/externalIcon - Preserve `status-badge`/`status-badge-v2`/`status-badge-label` + status hook classes so existing consumer LESS overrides and Playwright locators keep working - Delete status-badge.less (-149 lines) - Add core Storybook StatusBadge story (status -> color reference, light/dark) - Add StatusBadge unit test (label, testid, hook classes, color mapping) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
ExploreSearchCard's @openmetadata/ui-core-components mock returns an explicit
subset, so after StatusBadge moved onto the core Badge it resolved undefined
("Element type is invalid"). Pass the real Badge through, matching the
existing toOwnerRef passthrough.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Code Review ✅ Approved 1 closed / 1 findings🟡 Medium risk · Migrates shared status badges, changing colors, icon rendering, and dark-mode styling. Migrates legacy ✅ 1 closed✅ Edge Case: Badge's inset outline paints over consumer border-color overrides
OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|



Summary
StatusBadgeandStatusBadgeV2off thediv+status-badge.lessimplementation onto the core@openmetadata/ui-core-componentsBadge — the go-forward design system.label/status/dataTestId/className/externalIcon/showIcon), so all 14 call sites stay untouched; v1 keeps label-keyed icons, v2 keeps status-keyed icons +showIcon/externalIcon.STATUS_TYPE_TO_BADGE_COLORmap: eachStatusType→ nearest core Badge (utility-scale) color. The utility palette auto-flips in dark, so every status gains dark-mode support with no per-status CSS (supersedes the interim.lessdark turnaround in fix(ui-core): dark-mode support for features empty-placeholder gradient #33876).status-badge/status-badge-v2/status-badge-label+ per-status hook classes so existing consumer LESS overrides (Explore DataQualityTab, ContractDetailTab, GlossaryHeader) and Playwright locators keep matching.status-badge.less(−149 lines).Light mode
Legacy pills used
border-radius: md, so the migration uses Badgetype="color"(rounded-md), notpill-color(rounded-full), to stay close to the original shape. Colors shift to the design-system utility palette by design (that is the point of the migration); the closest hue is chosen per status to minimize the shift.Notes / follow-ups
Explore/.../DataQualityTab.lessandContractDetailTab.lessre-color specific badges with raw@red-9/@green-9at higher specificity — these keep winning (unchanged light), but carry pre-existing dark gaps (raw palette, static). Out of scope here; separate cleanup.StatusBadgeV2's old.status-badge-v2.success .anticon { color: transparent }hack is dropped with the.less; success now shows its colored icon.Testing
yarn test StatusBadge.test.tsx— 3 passed (label, testid, hook classes, status→utility-color mapping).yarn teston consumers (EntityStatusBadge, Explore + Profiler DataQualityTab) — 79 passed.eslint --fix+prettieron changed files — 0 errors.tsc --noEmit— no errors in changed files.The PR appears safe to merge after a non-blocking visual compatibility issue with retained consumer border overrides is addressed.
Findings
Summary
This PR migrates both legacy status-badge variants to the core Badge component, centralizes status-to-utility-color mapping, removes the legacy LESS implementation, and adds unit and Storybook coverage.
StatusType.Reviews (1) · Last reviewed commit: "refactor(ui): migrate StatusBadge to cor..."