Skip to content

Improvement: extensible user-profile dropdown items (getUserProfileExtraItems seam)#28705

Open
ShaileshParmar11 wants to merge 3 commits into
mainfrom
feat/user-profile-dropdown-extra-items
Open

Improvement: extensible user-profile dropdown items (getUserProfileExtraItems seam)#28705
ShaileshParmar11 wants to merge 3 commits into
mainfrom
feat/user-profile-dropdown-extra-items

Conversation

@ShaileshParmar11
Copy link
Copy Markdown
Contributor

@ShaileshParmar11 ShaileshParmar11 commented Jun 4, 2026

Describe your changes:

Fixes https://github.com/open-metadata/openmetadata-collate/issues/4435

I added a small, backward-compatible extensibility seam so downstream editions can contribute extra items to the user-profile dropdown without patching UserProfileIcon.

  • NavbarUtilClassBase.getUserProfileExtraItems(): ItemType[] — new hook that returns [] by default (no OSS behavior change).
  • UserProfileIcon.component.tsx — spreads ...navbarUtilClassBase.getUserProfileExtraItems() into the dropdown menu (just before the logout divider) and removes a pre-existing duplicate divider entry.

This mirrors the existing getHelpItems() extension pattern on the same class, so editions that swap in a *ClassBase override (e.g. via the Collate class-replacement plugin) can inject menu items through the established seam instead of forking the component.

Consumer / motivation: this seam is what lets Collate inject its Classic⇄AI interface-mode toggle into the profile dropdown — see downstream open-metadata/openmetadata-collate#4392 (Classic/AI mode separation). Validated end-to-end there: Collate's NavbarUtilClassCollate override returns the toggle items and they render in the dropdown.

Note: there is no OpenMetadata-side issue for this — it's a pure extensibility hook driven by downstream (Collate) work. Happy to open a tracking issue if maintainers prefer one before merge.

Type of change:

  • Improvement

High-level design:

N/A — small change (4 files, +31/-3). Default implementation returns an empty list, so OSS rendering is unchanged; the override surface is opt-in.

Tests:

Use cases covered

  • Default build: profile dropdown renders exactly as before (no extra items, single divider before logout).
  • An override of NavbarUtilClassBase.getUserProfileExtraItems() returning items causes those items to appear in the dropdown.

Unit tests

  • NavbarUtilClassBase.test.tsx — asserts the new method exists and returns [] by default.
  • UserProfileIcon.test.tsx — asserts the extra items are spread into the rendered menu.

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable here — end-to-end coverage for the consuming feature (the Classic⇄AI interface toggle) lives in the downstream Collate repo (open-metadata/openmetadata-collate#4392).

UI screen recording / screenshots:

Not applicable — no visual change in OSS (default returns an empty list).

Checklist:

  • I have read the CONTRIBUTING document.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests (unit) and listed them above.

Add NavbarUtilClassBase.getUserProfileExtraItems() (empty by default) and
have UserProfileIcon merge its result into the profile dropdown, so
downstream builds can inject extra menu items (e.g. a Classic/AI mode
toggle) without modifying the component. Also remove a duplicate divider
between the Inherited Roles and Teams groups.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Jun 4, 2026
@ShaileshParmar11 ShaileshParmar11 marked this pull request as ready for review June 5, 2026 13:31
Copilot AI review requested due to automatic review settings June 5, 2026 13:31
@ShaileshParmar11 ShaileshParmar11 requested a review from a team as a code owner June 5, 2026 13:31
@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.

@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Jun 5, 2026

Code Review ✅ Approved

Extends the user-profile dropdown by adding a getUserProfileExtraItems hook, allowing for cleaner downstream menu customization. The implementation includes updated unit tests and removes a duplicate divider, with no issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a small, backward-compatible extensibility hook to allow downstream editions to inject additional items into the user-profile dropdown menu without forking UserProfileIcon.

Changes:

  • Introduces NavbarUtilClassBase.getUserProfileExtraItems(): ItemType[], defaulting to [].
  • Updates UserProfileIcon to spread the extra items into the dropdown menu (and removes a duplicate divider).
  • Adds unit tests covering the default empty behavior and the rendering of injected items.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
openmetadata-ui/src/main/resources/ui/src/utils/NavbarUtilClassBase.ts Adds getUserProfileExtraItems() seam returning [] by default.
openmetadata-ui/src/main/resources/ui/src/utils/NavbarUtilClassBase.test.tsx Verifies the new seam exists and defaults to an empty list.
openmetadata-ui/src/main/resources/ui/src/components/Settings/Users/UserProfileIcon/UserProfileIcon.component.tsx Injects extra profile menu items into the dropdown and removes a duplicated divider.
openmetadata-ui/src/main/resources/ui/src/components/Settings/Users/UserProfileIcon/UserProfileIcon.test.tsx Ensures extra items provided via the util seam render in the dropdown.

@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.37% (67214/106059) 44.29% (36972/83474) 46.71% (11126/23819)

@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 (12 flaky)

✅ 4270 passed · ❌ 0 failed · 🟡 12 flaky · ⏭️ 88 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 300 0 1 4
🟡 Shard 2 801 0 3 9
🟡 Shard 3 804 0 3 8
✅ Shard 4 855 0 0 12
🟡 Shard 5 719 0 2 47
🟡 Shard 6 791 0 3 8
🟡 12 flaky test(s) (passed on retry)
  • Pages/AuditLogs.spec.ts › should apply both User and EntityType filters simultaneously (shard 1, 1 retry)
  • 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/Glossary/GlossaryWorkflow.spec.ts › should start term as Draft when glossary has reviewers (shard 2, 1 retry)
  • Features/RTL.spec.ts › Verify Following widget functionality (shard 3, 2 retries)
  • Features/Table.spec.ts › Table pagination with sorting should works (shard 3, 1 retry)
  • Flow/ExploreAggregationCountsMatching.spec.ts › should verify left panel counts and tab search results for normal search (shard 3, 1 retry)
  • Pages/Entity.spec.ts › Inactive Announcement create & delete (shard 5, 1 retry)
  • Pages/ExplorePageRightPanel_KnowledgeCenter.spec.ts › Should remove user owner for knowledgeCenter (shard 5, 1 retry)
  • Pages/Lineage/DataAssetLineage.spec.ts › Column lineage for searchIndex -> apiEndpoint (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)

📦 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 UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants