Improvement: extensible user-profile dropdown items (getUserProfileExtraItems seam)#28705
Improvement: extensible user-profile dropdown items (getUserProfileExtraItems seam)#28705ShaileshParmar11 wants to merge 3 commits into
Conversation
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>
❌ 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 |
Code Review ✅ ApprovedExtends the user-profile dropdown by adding a OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
There was a problem hiding this comment.
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
UserProfileIconto 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. |
|
🟡 Playwright Results — all passed (12 flaky)✅ 4270 passed · ❌ 0 failed · 🟡 12 flaky · ⏭️ 88 skipped
🟡 12 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |



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 duplicatedividerentry.This mirrors the existing
getHelpItems()extension pattern on the same class, so editions that swap in a*ClassBaseoverride (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
NavbarUtilClassCollateoverride returns the toggle items and they render in the dropdown.Type of change:
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
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
Ingestion integration tests
Playwright (UI) tests
UI screen recording / screenshots:
Not applicable — no visual change in OSS (default returns an empty list).
Checklist: