feat(extensions): context sharing namespaces (navigation, explore, dashboard, dataset)#40444
feat(extensions): context sharing namespaces (navigation, explore, dashboard, dataset)#40444EnxDev wants to merge 6 commits into
Conversation
|
Bito Automatic Review Skipped - Branch Excluded |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
d1aa512 to
2223cc3
Compare
…ions Adds ExtensionSettings and ExtensionEnabled models with migration. GET /api/v1/extensions/settings is public; PUT is restricted to Admin role via security_manager.is_admin(). Uses dialect-aware ON CONFLICT DO UPDATE upserts and @transaction() for safe concurrent writes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…shboard, dataset) Adds four stable namespaces to @apache-superset/core that give extensions host-managed access to page context without coupling to Redux internals: - navigation: getPageType(), onDidChangePage (routing signal only) - explore: getCurrentChart(), onDidChangeChart (ChartContext from Redux) - dashboard: getCurrentDashboard(), onDidChangeDashboard (DashboardContext with active native filter values from Redux) - dataset: getCurrentDataset(), onDidChangeDataset (push model) All four are wired into window.superset via ExtensionsStartup. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2223cc3 to
8f03c5a
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## enxdev/chat-prototype #40444 +/- ##
=========================================================
+ Coverage 64.18% 67.72% +3.53%
=========================================================
Files 2592 1850 -742
Lines 139036 76990 -62046
Branches 32282 24688 -7594
=========================================================
- Hits 89244 52141 -37103
+ Misses 48260 24849 -23411
+ Partials 1532 0 -1532
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…to prevent stale returns Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…y, and tests - Add CREATE_NEW_SLICE and SLICE_UPDATED to exploreChangePredicate so onDidChangeChart fires when a chart is saved for the first time - Remove dataset namespace: no producer exists yet; ships it once a caller is wired in DatasetCreation or equivalent - Remove ...supersetCore spread from window.superset assignment so un-contracted symbols from @apache-superset/core are not leaked onto the global object; list namespaces explicitly instead - Add defensive array copy for filter values in buildDashboardContext so extension mutations cannot affect Redux state - Lazy-initialize currentPageType in navigation to avoid module-load window.location access (throws in non-browser test environments) - Fix /sqllab exact-match missing from derivePageType - Add unit tests: navigation (7), explore (9), dashboard (11) — 27 tests covering page-type gating, dispose semantics, predicate coverage, and defensive copy invariant Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…fy no-use-before-define Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…phaned host impl The host removed dataset from window.superset but the SDK still exported the typed contract. An extension importing dataset from @apache-superset/core would get a fully typed namespace whose runtime calls throw at access time, which is worse than not shipping it. Removes: - packages/superset-core/src/dataset/index.ts (SDK type declarations) - export * as dataset from './dataset' in superset-core/src/index.ts - "./dataset" subpath from superset-core/package.json exports - src/core/dataset/index.ts (orphaned host implementation) The namespace will be re-introduced once a producer (DatasetCreation or equivalent) calls setCurrentDataset to back the contract at runtime. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
c9f2978 to
ae674f2
Compare
SUMMARY
Adds host namespaces that extensions can call to read Superset context: current page type, active dashboard filters, explore chart info, and dataset metadata.
What this introduces:
navigation—onDidChangePage: Event<PageType>fires on every route change; routing signal only (no entity context)dashboard—getContext()returns active filters from the Redux storeexplore—getContext()returns chart name, datasource, and current form datadataset—getContext()returns datasource UID and name from explore statewindow.supersetfor extension useExtensions compose context themselves from whichever namespaces they need. Surface namespaces (
explore,dashboard,dataset) own entity-level context;navigationis a routing signal only.Stack:
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — API surface only, no visible UI change.
TESTING INSTRUCTIONS
window.superset.dashboard.getContext()→ returns{ filters: [...] }window.superset.explore.getContext()→ returns{ chartName, datasourceUid, formData }navigation.onDidChangePagefires with the correctPageTypestringwindow.superset.explore.getContext()→ returnsnullADDITIONAL INFORMATION