Skip to content

fix(ui): apply icon-image classes to the <img> instead of its wrapper span - #32110

Merged
Rohit0301 merged 4 commits into
mainfrom
icon-component-refactor
Aug 27, 2026
Merged

Rohit0301 merged 4 commits into
mainfrom
icon-component-refactor

Conversation

@Rohit0301

@Rohit0301 Rohit0301 commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #

I worked on ... because ...
Screenshot 2026-08-26 at 5 53 46 PM
Screenshot 2026-08-26 at 5 55 57 PM
Screenshot 2026-08-26 at 5 56 05 PM
Screenshot 2026-08-26 at 5 57 10 PM
Screenshot 2026-08-26 at 5 58 23 PM
Screenshot 2026-08-26 at 5 58 48 PM

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

High-level design:

N/A — small change.

Tests:

Use cases covered

Unit tests

Backend integration tests

Ingestion integration tests

Playwright (UI) tests

Manual testing performed

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • 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: I updated the migration scripts or explained why it is not needed.
  • 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.

Summary by Gitar

  • Refactored Icon component properties:
    • Replaced wrapperStyle with imageClassName in IconProps to apply image-specific styling directly to underlying images and built-in icons
    • Updated callers including TagsV1, CertificationTag, TagChip, DataProductUtils, and DomainUtils to use imageClassName or Tailwind layout classes appropriately

This will update automatically on new commits.

Greptile Summary

The PR moves icon-specific classes from the Icon wrapper to the rendered image or built-in icon while retaining wrapper classes for layout.

  • Adds an imageClassName prop and removes wrapperStyle.
  • Updates tag, certification, domain, and data-product icon callers to use the revised styling contract.
  • Aligns the affected unit-test expectations with the new contract.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the previously reported Icon and CertificationTag contract issues are resolved by the current implementation and updated assertions.

Important Files Changed

Filename Overview
openmetadata-ui/src/main/resources/ui/src/components/common/Icon/Icon.tsx Separates wrapper layout classes from image classes and merges both class inputs for built-in SVG icons.
openmetadata-ui/src/main/resources/ui/src/components/common/Icon/Icon.interface.ts Replaces the wrapper-style API with an image-specific class-name property.
openmetadata-ui/src/main/resources/ui/src/components/common/CertificationTag/CertificationTag.tsx Applies 14px sizing directly to custom certification images while retaining explicit fallback-icon dimensions.
openmetadata-ui/src/main/resources/ui/src/components/common/Icon/Icon.test.tsx Updates the Icon test suite after removal of the wrapper-style contract.
openmetadata-ui/src/main/resources/ui/src/components/common/CertificationTag/CertificationTag.test.tsx Aligns the mocked Icon expectation with CertificationTag’s revised image-class contract.

Reviews (4): Last reviewed commit: "unit test fix" | Re-trigger Greptile

@Rohit0301 Rohit0301 self-assigned this Aug 26, 2026
@Rohit0301 Rohit0301 added the safe to test Add this label to run secure Github workflows on PRs label Aug 26, 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 Aug 26, 2026
@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), 26 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), 26 warning(s) across 7 changed file(s).

Count Rule
11 openmetadata-imports/no-circular-imports
4 react-hooks/exhaustive-deps
3 sonarjs/cyclomatic-complexity
3 openmetadata-imports/no-lower-layer-page-imports
2 sonarjs/no-duplicate-string
1 openmetadata-imports/no-internal-barrel-imports
1 sonarjs/cognitive-complexity
1 sonarjs/no-nested-conditional
All findings
Location Rule Message
🟡 src/components/Tag/TagsV1/TagsV1.component.tsx:34:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/components/Tag/TagsV1/TagsV1.component.tsx:35:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/components/Tag/TagsV1/TagsV1.component.tsx:36:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/components/common/CertificationTag/CertificationTag.tsx:21:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/components/common/atoms/TagChip/TagChip.tsx:88:4 sonarjs/cyclomatic-complexity {"message":"Function has a complexity of 11 which is greater than 10 authorized.","cost":1,"secondaryLocations":[{"line":88,"column":3,"endLine":88,"endColumn":
🟡 src/pages/TagPage/TagPage.tsx:72:1 openmetadata-imports/no-internal-barrel-imports Import the internal module directly instead of its index barrel so unrelated siblings do not enter the bundle graph.
🟡 src/pages/TagPage/TagPage.tsx:138:20 sonarjs/cognitive-complexity Refactor this function to reduce its Cognitive Complexity from 24 to the 15 allowed.
🟡 src/pages/TagPage/TagPage.tsx:138:20 sonarjs/cyclomatic-complexity {"message":"Function has a complexity of 25 which is greater than 10 authorized.","cost":15,"secondaryLocations":[{"line":138,"column":19,"endLine":138,"endColu
🟡 src/pages/TagPage/TagPage.tsx:277:6 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 'tagItem'. Either include it or remove the dependency array.
🟡 src/pages/TagPage/TagPage.tsx:302:9 sonarjs/no-nested-conditional Extract this nested ternary operation into an independent statement.
🟡 src/pages/TagPage/TagPage.tsx:326:9 react-hooks/exhaustive-deps The 'activeTabHandler' function makes the dependencies of useCallback Hook (at line 496) change on every render. To fix this, wrap the definition of 'activeTabH
🟡 src/pages/TagPage/TagPage.tsx:407:21 sonarjs/no-duplicate-string Define a constant instead of duplicating this literal 5 times.
🟡 src/pages/TagPage/TagPage.tsx:457:21 sonarjs/no-duplicate-string Define a constant instead of duplicating this literal 3 times.
🟡 src/pages/TagPage/TagPage.tsx:723:6 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 'fetchFeedCount'. Either include it or remove the dependency array.
🟡 src/pages/TagPage/TagPage.tsx:796:6 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array.
🟡 src/utils/ClassificationUtils.tsx:29:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/utils/DataProductUtils.tsx:32:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/DataProductUtils.tsx:33:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/DataProductUtils.tsx:34:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/DataProductUtils.tsx:35:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/DataProductUtils.tsx:47:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/utils/DataProductUtils.tsx:186:35 sonarjs/cyclomatic-complexity {"message":"Function has a complexity of 19 which is greater than 10 authorized.","cost":9,"secondaryLocations":[{"line":186,"column":34,"endLine":186,"endColum
🟡 src/utils/DomainUtils.tsx:29:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/DomainUtils.tsx:30:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.
🟡 src/utils/DomainUtils.tsx:40:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/utils/DomainUtils.tsx:41:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.

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

make ui-checkstyle-changed

@gitar-bot

gitar-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 2 resolved / 2 findings

Applies icon-image classes to the underlying img element instead of its wrapper span across icon components and utilities, addressing both named-icon branch drops caller className and tw:mr-4 changes right margin from 4px to 16px findings.

✅ 2 resolved
✅ Bug: tw:mr-4 changes right margin from 4px to 16px

📄 openmetadata-ui/src/main/resources/ui/src/components/Tag/TagsV1/TagsV1.component.tsx:150 📄 openmetadata-ui/src/main/resources/ui/src/components/common/atoms/TagChip/TagChip.tsx:94
The old inline style wrapperStyle={{ marginRight: 4 }} was 4px, but it was replaced with the Tailwind class tw:mr-4, which is 1rem (16px) on the default spacing scale — a 4x increase. This is a visual regression in the icon spacing for tags/chips. Use tw:mr-1 (0.25rem = 4px) to preserve the original spacing.

✅ Edge Case: Named-icon branch drops caller className (layout classes lost)

📄 openmetadata-ui/src/main/resources/ui/src/components/common/Icon/Icon.tsx:62-69 📄 openmetadata-ui/src/main/resources/ui/src/components/common/atoms/TagChip/TagChip.tsx:93-97
In the ICON_MAP branch the SVG component now receives className={imageClassName} instead of the caller's className. Callers that pass layout classes via className (e.g. TagChip, whose icon prop may be an ICON_MAP name, and TagsV1) lose their tw:mr-*/tw:shrink-0 spacing when a named icon is rendered instead of a URL image, since those callers only set className and not imageClassName. Consider merging both (e.g. className={classNames(className, imageClassName)}) so layout classes still apply to the single-element icon variant.

Options

Display: compact → Showing less information.

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

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 67%
67.14% (80643/120109) 51.56% (49329/95670) 52.52% (14753/28089)

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit b7791c12c42026b9050ed827b633c30fdcc6eff1 in Playwright run 32972339020, attempt 1.

✅ 605 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 1h 2m 35s

⏱️ Max setup 6m 8s · max shard execution 20m 36s · max shard-job elapsed before upload 26m 34s · reporting 3s

🌐 215.52 requests/attempt · 2.87 app boots/UI scenario · 20.06% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 20.06% (convergence target: at most 15%).
  • Browser traffic was 215.52 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.87 per UI scenario (1826 boots / 637 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 153 0 0 0 0 0
✅ Shard chromium-02 163 0 0 0 0 0
✅ Shard chromium-03 135 0 0 0 0 0
✅ Shard data-asset-rules-01 61 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard ingestion-01 1 0 0 0 0 0
✅ Shard reindex-01 2 0 0 0 0 0
✅ Shard search-01 11 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@Rohit0301
Rohit0301 added this pull request to the merge queue Aug 26, 2026
@anuj-kumary
anuj-kumary removed this pull request from the merge queue due to a manual request Aug 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — manual (2026-08-26T19:56:12Z)

Blocked the queue: ui-checkstyle

@anuj-kumary
anuj-kumary added this pull request to the merge queue Aug 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-08-27T00:43:20Z)

Blocked the queue: ui-checkstyle

@Rohit0301
Rohit0301 added this pull request to the merge queue Aug 27, 2026
Merged via the queue into main with commit c5bdcfb Aug 27, 2026
94 of 96 checks passed
@Rohit0301
Rohit0301 deleted the icon-component-refactor branch August 27, 2026 07:42
ShaileshParmar11 pushed a commit that referenced this pull request Aug 27, 2026
* fix(ui): render icon/image URLs by real load outcome instead of regex pre-validation (#31982)

* fix(ui): render icon/image URLs by real load outcome instead of regex pre-validation

* lint fix

* addressed gitar comment

* addressed gitar comment

* lint fix

* fix(ui): resolve cached-image race in Icon and move IconProps to interface file (#32067)

* fix(ui): resolve cached-image race in Icon and move IconProps to interface file

* lint fix

* fix(ui): apply icon-image classes to the <img> instead of its wrapper span (#32110)

* fix(ui): apply icon-image classes to the <img> instead of its wrapper span

* addressed gitar comment

* lint fix

* unit test fix

* fix(playwright): select Collate SaaS Runner before password fill in ServiceCreationPermissions (#32112)

* fix(playwright): select Collate SaaS Runner before filling password in ServiceCreationPermissions test

When the default runner is Remote Runner the form validation requires
passwords to start with the secret: prefix; switching to Collate SaaS
Runner before submitting removes that requirement so the test can use a
plain-text password value.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(playwright): move runner selection before password fill to prevent blur-time validation error

RJSF customValidate can fire on field blur; selecting Collate SaaS Runner
after the password is typed means the secret: prefix validation may
trigger while Remote Runner is still active. Select the runner first so
the error is never recorded.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>

* fix(ui): Renamed context center Dashboard to Overview

* lint fix

* playwright fix

* lint fix

* Rename i18n key from what-should-ask-collate-remember to what-should-ai-remember

Replace the old product-branded key with a generic AI key across the component and all 20 locale files, and move the key from the label namespace to the message namespace where the component expects it.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* lint fix

* class based approach

* lint fix

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>

This branch was previously deployed

1 inactive 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 UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants