Skip to content

Adopt the design-system workflow icons and make them theme-aware - #34142

Open
anuj-kumary wants to merge 4 commits into
mainfrom
workflow-icons
Open

anuj-kumary wants to merge 4 commits into
mainfrom
workflow-icons

Conversation

@anuj-kumary

Copy link
Copy Markdown
Member

Describe your changes:

The workflow node and control icons baked literal hex, so tw:text-* on them was inert and they never followed the theme. ic_undo.svg / ic_redo.svg at #545A84 were close to invisible on the dark control bar, and the start/end discs stayed light-tinted. This was the known follow-up left open when #34003 merged.

Design supplied 12 single-tone glyphs (#717680, 20×20), which I added to the core icon library rather than dropping into assets/svg.

Why the library lane matters. icons/ runs a replaceHardcodedColors pass that rewrites every hex fill/stroke to currentColor, and its SVGR config injects stroke={color}. So these are themeable by construction — no hand-editing of SVGs:

icons/workflow-*.svg  →  yarn icons:generate  →  src/icons/Workflow*.tsx
                                              →  src/icons/index.ts (auto)

NodeIconUtils.tsx and CustomControls.tsx now import from @openmetadata/ui-core-components/icons, and the 20 replaced assets are deleted. ic_star.svg stays as the node fallback — design hasn't supplied one.

Naming follows the library's existing convention: kebab-case source files in a prefixed family, exactly like the existing data-* (7), total-* (4) and test-* (4) groups.

Two things the first cut got wrong, both caught by rendering it

Size. The call sites drew start/end at 32px and task nodes at 16px. That balanced before because the old start/end assets were 32px discs holding a ~16px glyph; design ships bare glyphs, so 32px rendered them double-size. All four call sites are 16px now.

Colour. Dropping the baked hex also dropped the canvas's per-node-type colour coding. Each subtype now maps to the hue its old icon carried, through utility tokens that flip:

node light dark
Start #067647 #47cd89
End #b42318 #f97066
Check #b54708 #fdb022
Action #2e90fa #53b1fd
User Approval #dd2590 #f670c7

⚠️ Worth knowing for future work: the -600 shades looked correct but are pinned. UntitledUIThemeProvider writes --tw-color-utility-{success,error,warning,brand}-600 as inline styles on <html> from the tenant theme, and inline declarations outrank .dark-mode, so they hold a single value in both themes. Measuring on the sign-in page hides this because the provider hasn't run yet — measured after login, -500 and -700 flip and -600 does not.

Icons default to tw:text-quaternary, whose light value is #717680 — design's exact export — so an unmapped subtype keeps their tone.

Type of change:

  • Bug fix

High-level design:

N/A — icon-library additions plus two consuming components.

Tests:

Use cases covered

  • Workflow canvas node icons and the zoom-bar undo/redo render correctly in both themes, at consistent size, with per-node-type colour preserved.
  • New icons are discoverable in Storybook (Icons → Library).

Unit tests

  • No new unit tests — icon-component swaps with no branching logic. Existing suites cover the consumers.
  • npx jest src/components/WorkflowDefinitions src/utils/NodeIcon → 99 passed, 12 suites.

Backend integration tests

  • Not applicable.

Ingestion integration tests

  • Not applicable.

Playwright (UI) tests

  • Not added — presentational change.

Manual testing performed

  1. Ran the UI against a local stack, opened /workflows/AIAssetApprovalWorkflow/workflow (12 nodes) and read computed stroke and rendered size off each node icon, in both themes and after login so the theme provider is active.
  2. Confirmed every mapped hue flips (table above) and that all icons render at an identical 16px.
  3. Verified all 12 appear in Storybook via Icons.stories.tsx, which enumerates src/icons/index.ts automatically — no story changes needed.

Gates: yarn lint 0 errors · yarn tw-audit 0 errors · tsc clean for the changed files.

UI screen recording / screenshots:

Note for anyone pulling this branch

After core-components is rebuilt, Vite serves a stale pre-bundled dep copy and the page dies with does not provide an export named 'WorkflowCheckConditions'. Clear it:

rm -rf openmetadata-ui/src/main/resources/ui/node_modules/.vite
yarn --cwd openmetadata-ui/src/main/resources/ui start --force

Known follow-ups (not in this PR)

  • Three assets still bake hex and design hasn't covered them: ic_click.svg (#4C526C, empty-canvas message), ic_add.svg, and ic_star.svg (the node fallback), plus workflow.svg in the page header.
  • The colour mapping is my approximation of the hues the old icons carried. DataCompleteness was lime #AAC436 and maps to the same green as Start, because the token scale has no lime. If design has specific per-node-type colours, those should win.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: not applicable.
  • For UI changes: I attached a screen recording and/or screenshots above.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

🤖 Generated with Claude Code

@anuj-kumary anuj-kumary added safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check labels Sep 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@github-actions github-actions Bot added the UI UI specific issues label Sep 28, 2026
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 74%
73.95% (107640/145557) 59.22% (65952/111363) 60.5% (21782/36001)

The workflow node and control icons baked literal hex, so tw:text-* on them
was inert and they never followed the theme - ic_undo/ic_redo at #545A84 were
close to invisible on the dark control bar, and the start/end discs stayed
light-tinted.

Design supplied 12 single-tone glyphs (#717680, 20x20). They go through the
core library's regular icon lane, whose replaceHardcodedColors pass rewrites
every hex fill/stroke to currentColor and whose SVGR config injects
stroke={color}. So they are themeable by construction, with no hand-editing:

  icons/workflow-*.svg -> yarn icons:generate -> src/icons/Workflow*.tsx
                                              -> src/icons/index.ts

NodeIconUtils and CustomControls now import from
@openmetadata/ui-core-components/icons, and the 20 replaced assets are gone.
ic_star.svg stays as the node fallback - design has not supplied one.

Two things the first cut got wrong, both caught by rendering it:

Size. The call sites drew start/end at 32px and task nodes at 16px. That
balanced before because the old start/end assets were 32px discs holding a
~16px glyph; design ships bare glyphs, so 32px rendered them double-size. All
four call sites are 16px now.

Colour. Dropping the baked hex also dropped the canvas's per-node-type colour
coding. Each subtype now maps to the hue its old icon carried, through utility
tokens that flip:

  start   #067647 -> #47cd89     action   #2e90fa -> #53b1fd
  end     #b42318 -> #f97066     approval #dd2590 -> #f670c7
  check   #b54708 -> #fdb022

The -600 shades looked right but are pinned: UntitledUIThemeProvider writes
--tw-color-utility-{success,error,warning,brand}-600 as inline styles on
<html> from the tenant theme, so they hold one value in both themes. Measuring
on the sign-in page hides this because the provider has not run yet; measured
after login, -500 and -700 flip and -600 does not.

Icons default to text-quaternary, whose light value is #717680 - design's
exact export - so an unmapped node keeps their tone.
@anuj-kumary anuj-kumary self-assigned this Sep 28, 2026
Review feedback: the icons carried style={{ width, height }}.

A size class cannot simply be concatenated here. The getters supply a default
and nine call sites override it, so 'tw:size-8' and 'tw:size-4' would both land
on the element and Tailwind's own stylesheet order - not the class attribute -
would pick the winner. cx/tailwind-merge is not exported from the core package,
so there is nothing to dedupe them.

The getters now take a size token and emit exactly one class, which removes the
collision:

  ICON_SIZE_CLASS = { sm: 'tw:size-4', md: 'tw:size-8' }
  getNodeIcon(subType, { size: 'sm' })

md stays the default because the knowledge graph (CustomNode,
KnowledgeGraphInspectorParts) calls these with no options and relies on 32px.

Both getters now share one renderNodeIcon helper rather than repeating the
prop-merging, and className still composes so a caller can add to it.

Verified on the canvas: icons render with style absent and
class="size-4 text-utility-success-700", 16px as before.
Review feedback: the exported files carried width="20" height="20" on the root
<svg>.

They were inert - generate-icons.mjs strips the root width/height and SVGR
re-injects width={size} height={size} - and all 189 existing source icons carry
them the same way, so ours matched the library. But they read as hardcoded
sizing in the diff, which is the opposite of the point.

Removed from all 12. Regenerating produces byte-identical components, which
confirms the attributes never reached the output.
@gitar-bot

gitar-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Workflow canvas icons now use theme-aware glyphs and subtype color tokens.

Adopts design-system workflow icons and makes them theme-aware by routing all 12 glyphs through the icon library's replaceHardcodedColors pass, which rewrites hex values to currentColor for automatic theme support. Sizes all call sites to 16px, maps each node subtype to appropriate utility token colors that flip between themes, and deletes 20 replaced assets. No issues found.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

🤖 Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 1 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 1 warning(s) across 1 changed file(s).

Count Rule
1 no-restricted-imports
All findings
Location Rule Message
🟡 src/utils/NodeIconUtils.tsx:29:1 no-restricted-imports '../assets/svg/ic_star.svg' import is restricted from being used by a pattern. Do not import SVG icons directly from assets/ paths; use the designated abstracti

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@sonarqubecloud

Copy link
Copy Markdown

This branch was successfully deployed

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

Labels

safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant