Skip to content

feat(ui): extract EntitySort/Permission/Column/Breadcrumb/SummaryPanel etc pure utils#28740

Open
shah-harshit wants to merge 2 commits into
mainfrom
feat/extract-entity-misc-utils
Open

feat(ui): extract EntitySort/Permission/Column/Breadcrumb/SummaryPanel etc pure utils#28740
shah-harshit wants to merge 2 commits into
mainfrom
feat/extract-entity-misc-utils

Conversation

@shah-harshit
Copy link
Copy Markdown
Contributor

Summary

Splits EntityPureUtils.ts, EntityUtils.tsx, EntityBreadcrumbUtils.tsx, and EntitySummaryPanelUtils.tsx into domain-specific modules:

  • EntitySortUtils.ts: columnSorter, getColumnSorter
  • EntityPermissionUtils.ts: hasSchemaTab, hasLineageTab, hasCustomPropertiesTab, hasEditAccess
  • EntityVoteUtils.ts: getEntityVoteStatus
  • EntityTagUtils.ts: getEntityTags
  • EntitySearchUtils.tsx: searchInColumns, highlightEntityNameAndDescription, highlightSearchText, highlightSearchArrayElement
  • EntityColumnUtils.tsx: checkIfJoinsAvailable, getFrequentlyJoinedWithColumns, getFrequentlyJoinedColumns
  • EntityReferenceUtils.ts: getEntityReferenceFromEntity, getEntityReferenceListFromEntities
  • EntityDetailComponentUtils.tsx: getEntityDetailComponent
  • EntityBreadcrumbPureUtils.ts: pure breadcrumb builders extracted from EntityBreadcrumbUtils.tsx
  • EntitySummaryPanelPureUtils.ts / EntitySummaryPanelPureUtilsV1.ts: pure summary panel helpers

All source files re-export moved symbols for full backward compat — no consumer changes required.

Test plan

  • npx tsc --noEmit — 0 errors in changed files
  • yarn lint:fix — 0 new errors
  • All existing imports from original paths resolve via re-exports

🤖 Generated with Claude Code

shah-harshit and others added 2 commits June 5, 2026 13:18
…tils, EntityTagUtils, EntitySearchUtils, EntityColumnUtils, EntityBreadcrumbPureUtils, EntitySummaryPanelPureUtils from EntityPureUtils/EntityUtils/EntityBreadcrumbUtils/EntitySummaryPanelUtils

- Extract columnSorter/getColumnSorter → EntitySortUtils.ts
- Extract hasSchemaTab/hasLineageTab/hasCustomPropertiesTab/hasEditAccess → EntityPermissionUtils.ts
- Extract getEntityVoteStatus → EntityVoteUtils.ts
- Extract getEntityTags → EntityTagUtils.ts
- Extract searchInColumns/highlightEntityNameAndDescription/highlightSearchText/highlightSearchArrayElement → EntitySearchUtils.tsx
- Extract getEntityReferenceFromEntity/getEntityReferenceListFromEntities → EntityReferenceUtils.ts
- Extract getFrequentlyJoinedColumns → EntityColumnUtils.tsx (new file)
- Move all pure breadcrumb functions → EntityBreadcrumbPureUtils.ts; EntityBreadcrumbUtils.tsx becomes re-export facade
- Extract getSummaryListItemType/getSortedTagsWithHighlight/getMapOfListHighlights/getHighlightOfListItem/toEntityData → EntitySummaryPanelPureUtils.ts
- Extract filterItemsBySearchText/filterNestedFields → EntitySummaryPanelPureUtilsV1.ts (imported instead of redefined)
- Add backward-compat re-exports in all source files so existing imports continue to work

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tils, EntityTagUtils, EntitySearchUtils, EntityDetailComponentUtils, EntityBreadcrumbPureUtils, EntitySummaryPanelPureUtils from EntityPureUtils/EntityUtils/EntityBreadcrumbUtils

Split EntityPureUtils.ts into domain-specific modules:
- EntitySortUtils.ts: columnSorter, getColumnSorter
- EntityPermissionUtils.ts: hasSchemaTab, hasLineageTab, hasCustomPropertiesTab, hasEditAccess
- EntityVoteUtils.ts: getEntityVoteStatus
- EntityTagUtils.ts: getEntityTags
- EntitySearchUtils.tsx: searchInColumns, highlightEntityNameAndDescription, highlightSearchText, highlightSearchArrayElement
- EntityColumnUtils.tsx: checkIfJoinsAvailable, getFrequentlyJoinedWithColumns, getFrequentlyJoinedColumns
- EntityReferenceUtils.ts: getEntityReferenceFromEntity, getEntityReferenceListFromEntities
- EntityDetailComponentUtils.tsx: getEntityDetailComponent
- EntityBreadcrumbPureUtils.ts: pure breadcrumb builders from EntityBreadcrumbUtils.tsx
- EntitySummaryPanelPureUtils.ts: pure summary panel helpers from EntitySummaryPanelUtils.tsx
- EntitySummaryPanelPureUtilsV1.ts: pure v1 summary panel helpers

All source files re-export moved symbols for backward compat.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@shah-harshit shah-harshit requested a review from a team as a code owner June 5, 2026 07:51
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

❌ PR checklist incomplete

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

  • No GitHub issue is linked. Add a closing reference such as Fixes #12345 to the PR description (accepted keywords: Fixes, Closes, Resolves).

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
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@shah-harshit shah-harshit self-assigned this Jun 5, 2026
@shah-harshit shah-harshit added UI UI specific issues safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check labels Jun 5, 2026
@shah-harshit shah-harshit changed the title feat(ui): extract EntitySort/Permission/Vote/Tag/Search/Column/Breadcrumb/SummaryPanel pure utils (PR #11) feat(ui): extract EntitySort/Permission/Column/Breadcrumb/SummaryPanel etc pure utils Jun 5, 2026
return `<#E${ENTITY_LINK_SEPARATOR}user${ENTITY_LINK_SEPARATOR}${userName}>`;
};

export const getEntityLinkFromType = (
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Quality: New EntityLinkUtils.ts is unused and duplicates existing logic

The new file EntityLinkUtils.ts (+277 lines) is not imported anywhere in the codebase (grep for importers returns nothing). It re-implements logic that already exists elsewhere as part of this same PR/refactor:

  • getEntityLinkFromType is defined identically in both EntityLinkUtils.ts:80 and EntityBreadcrumbPureUtils.ts:561 (the latter is the one actually wired up via EntityBreadcrumbUtils.tsxEntityUtils.tsx).
  • getEntityFeedLink, getEntityUserLink, getColumnNameFromEntityLink, getEntityImportPath, getEntityBulkEditPath, and updateNodeType duplicate definitions that still live in EntityPureUtils.ts.

Shipping a second, dead copy of routing/link logic creates a real maintenance hazard: future edits to one copy (e.g. adding a new EntityType case to getEntityLinkFromType) will silently diverge from the other, and the unused file adds to bundle/parse surface and reviewer confusion. For a refactor whose stated goal is to split files into single-source-of-truth modules, having two competing copies of getEntityLinkFromType undercuts that goal.

Suggested fix: either delete EntityLinkUtils.ts entirely if it is not intended to be the canonical home for these helpers, or — if it IS meant to be canonical — have EntityBreadcrumbPureUtils.ts and EntityPureUtils.ts re-export from it instead of redefining, and wire consumers accordingly. Pick one source of truth.

Was this helpful? React with 👍 / 👎

@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Jun 5, 2026

Code Review 👍 Approved with suggestions 0 resolved / 1 findings

Refactors monolithic entity utility files into domain-specific modules while maintaining backward compatibility via re-exports. Remove the unused, redundant EntityLinkUtils.ts file.

💡 Quality: New EntityLinkUtils.ts is unused and duplicates existing logic

📄 openmetadata-ui/src/main/resources/ui/src/utils/EntityLinkUtils.ts:80 📄 openmetadata-ui/src/main/resources/ui/src/utils/EntityLinkUtils.ts:58 📄 openmetadata-ui/src/main/resources/ui/src/utils/EntityLinkUtils.ts:76 📄 openmetadata-ui/src/main/resources/ui/src/utils/EntityLinkUtils.ts:203 📄 openmetadata-ui/src/main/resources/ui/src/utils/EntityLinkUtils.ts:207 📄 openmetadata-ui/src/main/resources/ui/src/utils/EntityLinkUtils.ts:214 📄 openmetadata-ui/src/main/resources/ui/src/utils/EntityLinkUtils.ts:228 📄 openmetadata-ui/src/main/resources/ui/src/utils/EntityBreadcrumbPureUtils.ts:561

The new file EntityLinkUtils.ts (+277 lines) is not imported anywhere in the codebase (grep for importers returns nothing). It re-implements logic that already exists elsewhere as part of this same PR/refactor:

  • getEntityLinkFromType is defined identically in both EntityLinkUtils.ts:80 and EntityBreadcrumbPureUtils.ts:561 (the latter is the one actually wired up via EntityBreadcrumbUtils.tsxEntityUtils.tsx).
  • getEntityFeedLink, getEntityUserLink, getColumnNameFromEntityLink, getEntityImportPath, getEntityBulkEditPath, and updateNodeType duplicate definitions that still live in EntityPureUtils.ts.

Shipping a second, dead copy of routing/link logic creates a real maintenance hazard: future edits to one copy (e.g. adding a new EntityType case to getEntityLinkFromType) will silently diverge from the other, and the unused file adds to bundle/parse surface and reviewer confusion. For a refactor whose stated goal is to split files into single-source-of-truth modules, having two competing copies of getEntityLinkFromType undercuts that goal.

Suggested fix: either delete EntityLinkUtils.ts entirely if it is not intended to be the canonical home for these helpers, or — if it IS meant to be canonical — have EntityBreadcrumbPureUtils.ts and EntityPureUtils.ts re-export from it instead of redefining, and wire consumers accordingly. Pick one source of truth.

🤖 Prompt for agents
Code Review: Refactors monolithic entity utility files into domain-specific modules while maintaining backward compatibility via re-exports. Remove the unused, redundant EntityLinkUtils.ts file.

1. 💡 Quality: New EntityLinkUtils.ts is unused and duplicates existing logic
   Files: openmetadata-ui/src/main/resources/ui/src/utils/EntityLinkUtils.ts:80, openmetadata-ui/src/main/resources/ui/src/utils/EntityLinkUtils.ts:58, openmetadata-ui/src/main/resources/ui/src/utils/EntityLinkUtils.ts:76, openmetadata-ui/src/main/resources/ui/src/utils/EntityLinkUtils.ts:203, openmetadata-ui/src/main/resources/ui/src/utils/EntityLinkUtils.ts:207, openmetadata-ui/src/main/resources/ui/src/utils/EntityLinkUtils.ts:214, openmetadata-ui/src/main/resources/ui/src/utils/EntityLinkUtils.ts:228, openmetadata-ui/src/main/resources/ui/src/utils/EntityBreadcrumbPureUtils.ts:561

   The new file `EntityLinkUtils.ts` (+277 lines) is not imported anywhere in the codebase (grep for importers returns nothing). It re-implements logic that already exists elsewhere as part of this same PR/refactor:
   
   - `getEntityLinkFromType` is defined identically in both `EntityLinkUtils.ts:80` and `EntityBreadcrumbPureUtils.ts:561` (the latter is the one actually wired up via `EntityBreadcrumbUtils.tsx` → `EntityUtils.tsx`).
   - `getEntityFeedLink`, `getEntityUserLink`, `getColumnNameFromEntityLink`, `getEntityImportPath`, `getEntityBulkEditPath`, and `updateNodeType` duplicate definitions that still live in `EntityPureUtils.ts`.
   
   Shipping a second, dead copy of routing/link logic creates a real maintenance hazard: future edits to one copy (e.g. adding a new `EntityType` case to `getEntityLinkFromType`) will silently diverge from the other, and the unused file adds to bundle/parse surface and reviewer confusion. For a refactor whose stated goal is to split files into single-source-of-truth modules, having two competing copies of `getEntityLinkFromType` undercuts that goal.
   
   Suggested fix: either delete `EntityLinkUtils.ts` entirely if it is not intended to be the canonical home for these helpers, or — if it IS meant to be canonical — have `EntityBreadcrumbPureUtils.ts` and `EntityPureUtils.ts` re-export from it instead of redefining, and wire consumers accordingly. Pick one source of truth.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 63%
63.36% (67334/106264) 44.26% (36985/83554) 46.73% (11164/23888)

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 5, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

🟡 Playwright Results — all passed (15 flaky)

✅ 4265 passed · ❌ 0 failed · 🟡 15 flaky · ⏭️ 88 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 300 0 1 4
🟡 Shard 2 802 0 2 9
🟡 Shard 3 802 0 3 8
🟡 Shard 4 853 0 2 12
🟡 Shard 5 719 0 2 47
🟡 Shard 6 789 0 5 8
🟡 15 flaky test(s) (passed on retry)
  • Pages/SearchSettings.spec.ts › Preview config reflects reverted n-gram weight after save (shard 1, 2 retries)
  • Features/DataQuality/TestCaseImportExportE2eFlow.spec.ts › Admin: Complete export-import-validate flow (shard 2, 1 retry)
  • Features/DataQuality/TestCaseResultPermissions.spec.ts › User with only VIEW cannot PATCH results (shard 2, 1 retry)
  • Features/IncidentManager.spec.ts › Resolving incident & re-run pipeline (shard 3, 1 retry)
  • Features/RTL.spec.ts › Verify Following widget functionality (shard 3, 1 retry)
  • Features/Table.spec.ts › Table pagination with sorting should works (shard 3, 1 retry)
  • Pages/CustomProperties.spec.ts › Table (shard 4, 1 retry)
  • Pages/DomainAdvanced.spec.ts › Filter assets by domain from explore page (shard 4, 1 retry)
  • Pages/Entity.spec.ts › User as Owner with unsorted list (shard 5, 1 retry)
  • Pages/ExplorePageRightPanel_KnowledgeCenter.spec.ts › Should remove user owner for knowledgeCenter (shard 5, 1 retry)
  • Pages/Glossary.spec.ts › Column dropdown drag-and-drop functionality for Glossary Terms table (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage service type filter selection (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage schema filter selection (shard 6, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: searchIndex (shard 6, 1 retry)
  • Pages/Lineage/PlatformLineage.spec.ts › Verify domain platform view (shard 6, 1 retry)

📦 Download artifacts

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

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