refactor: remove embedded mode methods from router classes#28063
refactor: remove embedded mode methods from router classes#28063ShaileshParmar11 wants to merge 6 commits into
Conversation
Code Review ✅ Approved 3 resolved / 3 findingsRemoves embedded mode methods from router classes while introducing AppContextProvider and inCurrentAppContext utilities for consistent URL handling. No issues found. ✅ 3 resolved✅ Bug: Double-prefixing of URLs for mention/hashtag links in EditorSlots
✅ Quality: Import ordering: RouterUtils import placed before BlockEditorExtensionsClassBase
✅ Quality: Missing afterEach cleanup in KnowledgeGraph test risks state leakage
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
Refactor removing unused setEmbeddedMode/isEmbeddedMode no-op methods from ConnectionsRouterClassBase and ObservabilityRouterClassBase, replacing the lone caller with the locally-derived isEmbedded flag, and introducing a small registerAppContextProvider/inCurrentAppContext extension hook in RouterUtils for rewriting escape-hatch URLs (window.open, target=_blank) used by hosts that mount OM under a sub-path. The new hook is wired into EditorSlots, useOntologyExplorer, and KnowledgeGraph.utils.
Changes:
- Remove embedded-mode no-op methods (and their tests) from the two router base classes.
- Add
registerAppContextProvider/inCurrentAppContextinRouterUtilsand apply it at escape-hatchwindow.opensites; verify mention/hashtag hrefs remain canonical inBlockEditorUtils. - Replace
connectionsRouterClassBase.isEmbeddedMode()inGlobalSettingCategoryPagewith the localisEmbeddedflag and add unit tests for the new hook.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| openmetadata-ui/.../utils/RouterUtils.ts | Adds AppContextProvider, registerAppContextProvider, inCurrentAppContext. |
| openmetadata-ui/.../utils/RouterUtils.test.ts | Unit tests for provider registration and identity fallback. |
| openmetadata-ui/.../utils/ObservabilityRouterClassBase.ts | Removes embedded-mode no-op methods. |
| openmetadata-ui/.../utils/ObservabilityRouterClassBase.test.ts | Removes corresponding tests. |
| openmetadata-ui/.../utils/ConnectionsRouterClassBase.ts | Removes embedded-mode no-op methods. |
| openmetadata-ui/.../utils/ConnectionsRouterClassBase.test.ts | Removes corresponding tests. |
| openmetadata-ui/.../utils/KnowledgeGraph.utils.ts | Routes window.open URL through inCurrentAppContext. |
| openmetadata-ui/.../utils/KnowledgeGraph.utils.test.ts | Verifies provider rewriting on node:dblclick. |
| openmetadata-ui/.../utils/BlockEditorUtils.ts | Adds comment noting hrefs are stored unprefixed. |
| openmetadata-ui/.../utils/BlockEditorUtils.test.ts | Asserts canonical hrefs regardless of provider. |
| openmetadata-ui/.../components/BlockEditor/EditorSlots.tsx | Applies inCurrentAppContext on link clicks. |
| openmetadata-ui/.../components/OntologyExplorer/hooks/useOntologyExplorer.ts | Applies inCurrentAppContext on node open. |
| openmetadata-ui/.../pages/GlobalSettingPage/.../GlobalSettingCategoryPage.tsx | Replaces router isEmbeddedMode() call with local isEmbedded. |
| if (isEmbedded && category === GlobalSettingsMenuCategory.SERVICES) { | ||
| navigate( | ||
| connectionsRouterClassBase.getSettingsServicesPath(option) | ||
| ); |
|
🟡 Playwright Results — all passed (15 flaky)✅ 4065 passed · ❌ 0 failed · 🟡 15 flaky · ⏭️ 92 skipped
🟡 15 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 #
I worked on ... because ...
Type of change:
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:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.Summary by Gitar
isEmbeddedModemethods fromConnectionsRouterClassBaseandObservabilityRouterClassBaseto simplify routing logic.inCurrentAppContextutility andregisterAppContextProviderhook inRouterUtilsto handle URL routing consistently in embedded environments.EditorSlots,useOntologyExplorer, andKnowledgeGraph.utilsto useinCurrentAppContextfor all escape-hatch navigation.GlobalSettingCategoryPageto rely on standardisEmbeddedchecks instead of deprecated router methods.RouterUtils.test.tsto verify provider registration and identity fallback behavior.BlockEditorUtils.test.tsandKnowledgeGraph.utils.test.tsto ensure canonical URL storage and correct context provider integration.This will update automatically on new commits.