You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "kgabryje (via GitHub)" <gi...@apache.org> on 2026/05/21 15:47:27 UTC

[PR] feat(versioning): Version History UI for Explore and Dashboard [superset]

kgabryje opened a new pull request, #40334:
URL: https://github.com/apache/superset/pull/40334

   ### SUMMARY
   
   Adds the production frontend for the Versioning epic ([sc-103156](https://app.shortcut.com/preset/story/103156)) on top of Mike's backend in #39603. Implements the "View version history" experience on **Explore** (chart edit page) and **Dashboard** view per the [Figma designs](https://www.figma.com/design/xZj5lRx0gC9HPt3e9RskxL/Version-History?node-id=2202-2688). Gated behind a new `VERSION_HISTORY` feature flag (default `False`).
   
   🚧 **Draft β€” stacks on #39603.** The diff currently shows both #39603's backend commits and this PR's 11 commits. Once #39603 merges, I'll rebase this branch onto master and the diff will reduce to only the frontend changes (+3006 / -20 lines, 45 files in `superset-frontend/` plus the feature-flag entry in `superset/config.py`).
   
   **What this PR adds:**
   
   - **Shared primitives** under `superset-frontend/src/features/versionHistory/`:
     - `VersionHistoryPanel` β€” right-side Drawer with version list, search, date-grouped sections
     - `PreviewBanner` β€” top banner shown while previewing a historical version, with Close / Open as new / Restore actions
     - `RestoreConfirmModal` β€” destructive-action confirmation
     - Hooks: `useVersionList`, `useVersionSnapshot`, `useRestoreVersion`
     - Two React contexts: `VersionHistoryContext` (panel/preview state, URL roundtrip via `?version_uuid=`) and `ChartPreviewContext` (chart shadow-render)
     - Utils: `summarizeChange`, `formatChangeTitle`, `groupVersionsByDate`, `snapshotToFormData`, `forkActions` β€” change-formatting logic ported from Mike's demo dropdown
   - **Explore wiring**:
     - "View version history" menu item in the chart actions menu, gated on the feature flag, disabled when `hasUnsavedChanges` with tooltip "Exit edit mode to view version history"
     - Chart shadow-renders snapshot `form_data` via `ChartPreviewContext` during preview β€” no Redux mutation
     - Save button disabled while previewing
     - "Open as new chart" hydrates the snapshot into `form_data` and POSTs a new chart with name pattern `{original} (copy from {date})`
   - **Dashboard wiring**:
     - "View version history" menu item at the bottom of the dashboard actions menu, gated on the flag, disabled in edit mode
     - Inline preview via the **captured-original** Redux pattern: `ENTER_VERSION_PREVIEW` / `EXIT_VERSION_PREVIEW` actions, three reducers extended (`dashboardState`, `sliceEntities`, `dashboardLayout`), `undoableDashboardLayout.TRACKED_ACTIONS` updated. Enter captures live `sliceEntities` + `dashboardLayout` into `dashboardState.versionPreview` and swaps in the snapshot's `slices` + parsed `position_json`; exit restores the captured originals. No refetch.
     - `DashboardPreviewBanner` mounts above `DashboardGrid` in `DashboardContainer.tsx`
     - "Open as new dashboard" POSTs to `/api/v1/dashboard/` with the snapshot's fields
   - **Feature flag** `VERSION_HISTORY` added to `superset/config.py` `DEFAULT_FEATURE_FLAGS` (default `False`), the frontend `FeatureFlag` enum, and `docs/static/feature-flags.json`.
   
   **What is NOT in this PR** (deferred to follow-up tickets):
   
   - **Datasets** β€” the backend exposes the same endpoints for datasets, but the UI is scoped to Explore + Dashboard for V1.
   - **AI attribution UI** β€” the backend `changed_by` is rendered as the user name; the "AI" tag for chatbot-authored versions is deferred until the chatbot's identity in `changed_by.username` is stable.
   - **Tags / owners / roles in restore** β€” backend leaves these at their live values per spec; no UI surface needed.
   - **Per-chart position inside a dashboard** β€” `position_json` is versioned as an opaque blob (restored wholesale on dashboard restore); finer-grained layout versioning is Phase 2.
   - **Diff-content search** β€” search box filters version *titles*, not the full structured diff payload.
   - **Open question (worth a comment thread)**: dashboard fork uses `POST /api/v1/dashboard/` and the resulting forked dashboard's `position_json` references the *live* charts at those IDs, not snapshot-state copies of those charts. This matches "Open as new" semantics elsewhere in Superset and is what the design intent suggests; flagging here in case a fully-isolated snapshot fork is preferred.
   
   ### BEFORE/AFTER SCREENSHOTS
   
   _To attach after stack-base settles. Figma source of truth: [Version History](https://www.figma.com/design/xZj5lRx0gC9HPt3e9RskxL/Version-History?node-id=2202-2688)._
   
   ### TESTING INSTRUCTIONS
   
   Enable the flag and seed history against #39603's endpoints. The plan below assumes Mike's backend branch is checked out.
   
   1. **Enable the feature flag** in `superset_config.py`:
   ```python
   FEATURE_FLAGS = {"VERSION_HISTORY": True}
   ```
   
   2. **Chart preview + restore**:
      - Open any chart in Explore. Make 3 edits and Save 3 times to seed version history.
      - Click the three-dot menu β†’ `View version history`. Right-side panel opens listing versions newest-first, with author + timestamp.
      - Click a version row β†’ preview banner appears at the top, chart re-renders the historical `form_data`, Save button is disabled.
      - Click `Restore this version` β†’ confirm modal β†’ success toast β†’ panel refreshes with the restore as the new latest version.
      - With preview open, copy the URL, paste in new tab β†’ preview reopens on the same version (URL roundtrip).
   
   3. **Chart fork (Open as new chart)**:
      - Open the panel, click the three-dot menu on any version row β†’ `Open as new chart`.
      - New chart created with name `{original} (copy from {YYYY-MM-DD})`. Success toast. Navigates to the new chart's explore URL.
   
   4. **Dashboard preview + restore**:
      - Open any dashboard. Make changes via edit mode, save, repeat to seed.
      - Three-dot menu β†’ `View version history`. Panel opens. (In edit mode the menu item is disabled with a tooltip.)
      - Click a version row β†’ grid re-renders the historical layout + slice data via the captured-original swap; banner appears above the grid.
      - `Close preview` β†’ grid restores to live state.
      - `Restore this version` β†’ confirm modal β†’ success β†’ page reflects the restored state.
   
   5. **Dashboard fork (Open as new dashboard)**:
      - Panel β†’ three-dot menu on a version β†’ `Open as new dashboard`. New dashboard created with snapshot's layout. Navigate.
   
   6. **Feature flag off**: disable `VERSION_HISTORY` β†’ menu items vanish, panels do not mount, no console errors.
   
   7. **Tests**:
   ```bash
   cd superset-frontend
   npm run type
   npm test -- src/features/versionHistory
   npm test -- src/dashboard/reducers
   ```
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: [sc-103156](https://app.shortcut.com/preset/story/103156)
   - [x] Required feature flags: `VERSION_HISTORY` (added in this PR)
   - [x] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API _(introduces new feature; consumes APIs from #39603)_
   - [ ] Removes existing feature or API
   
   **Depends on:** #39603 (backend versioning endpoints)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(versioning): Version History UI for Explore and Dashboard [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #40334:
URL: https://github.com/apache/superset/pull/40334#issuecomment-4509959387

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(versioning): Version History UI for Explore and Dashboard [superset]

Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #40334:
URL: https://github.com/apache/superset/pull/40334#issuecomment-4509989062

   ### <span aria-hidden="true">βœ…</span> Deploy Preview for *superset-docs-preview* ready!
   
   
   |  Name | Link |
   |:-:|------------------------|
   |<span aria-hidden="true">πŸ”¨</span> Latest commit | 8ea195aebc9845570e9ccf1262859ae47bc82fb7 |
   |<span aria-hidden="true">πŸ”</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6a0f29107478dd00084dbd29 |
   |<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-40334--superset-docs-preview.netlify.app](https://deploy-preview-40334--superset-docs-preview.netlify.app) |
   |<span aria-hidden="true">πŸ“±</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTQwMzM0LS1zdXBlcnNldC1kb2NzLXByZXZpZXcubmV0bGlmeS5hcHAifQ.VNAe3_lrVkEVw6aoVwEQ1e28pUE-FQVR0tZ2rkzlyBk)<br /><br />_Use your smartphone camera to open QR code link._</details> |
   |<span aria-hidden="true">πŸ€–</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#DcpBCoAgEADAv-w5aQvJ7Ac9w1rFoFxZJYjo73mbw7yQha9cYQHoYBOX9tgcvKv97aUcnFQ8SmV5VBBO1SdqkXw--Vmp1clhGO2ARpuZCBFnTRuNFr4f) |
   ---
   <!-- [superset-docs-preview Preview](https://deploy-preview-40334--superset-docs-preview.netlify.app) -->
   _To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(versioning): Version History UI for Explore and Dashboard [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #40334:
URL: https://github.com/apache/superset/pull/40334#issuecomment-4511269761

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/40334?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `42.82855%` with `857 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 41.71%. Comparing base ([`1230b90`](https://app.codecov.io/gh/apache/superset/commit/1230b9091b0ebba0e63a7853970330b549747bd8?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`98e2217`](https://app.codecov.io/gh/apache/superset/commit/98e2217f2649fb84c803212d96c2ceca840cd149?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 62 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/40334?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [superset/versioning/baseline.py](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&filepath=superset%2Fversioning%2Fbaseline.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdmVyc2lvbmluZy9iYXNlbGluZS5weQ==) | 42.39% | [98 Missing and 8 partials :warning: ](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [superset/versioning/diff.py](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&filepath=superset%2Fversioning%2Fdiff.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdmVyc2lvbmluZy9kaWZmLnB5) | 61.75% | [79 Missing and 17 partials :warning: ](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [superset/versioning/queries.py](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&filepath=superset%2Fversioning%2Fqueries.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdmVyc2lvbmluZy9xdWVyaWVzLnB5) | 21.55% | [91 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [superset/tasks/version\_history\_retention.py](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&filepath=superset%2Ftasks%2Fversion_history_retention.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdGFza3MvdmVyc2lvbl9oaXN0b3J5X3JldGVudGlvbi5weQ==) | 0.00% | [77 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [superset/charts/api.py](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&filepath=superset%2Fcharts%2Fapi.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvY2hhcnRzL2FwaS5weQ==) | 22.50% | [62 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [superset/datasets/api.py](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&filepath=superset%2Fdatasets%2Fapi.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvZGF0YXNldHMvYXBpLnB5) | 22.50% | [62 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [superset/dashboards/api.py](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&filepath=superset%2Fdashboards%2Fapi.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvZGFzaGJvYXJkcy9hcGkucHk=) | 22.78% | [61 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [superset/versioning/changes.py](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&filepath=superset%2Fversioning%2Fchanges.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdmVyc2lvbmluZy9jaGFuZ2VzLnB5) | 76.15% | [38 Missing and 19 partials :warning: ](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [superset/daos/dataset.py](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&filepath=superset%2Fdaos%2Fdataset.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvZGFvcy9kYXRhc2V0LnB5) | 12.00% | [44 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [superset/commands/version\_restore.py](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&filepath=superset%2Fcommands%2Fversion_restore.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvY29tbWFuZHMvdmVyc2lvbl9yZXN0b3JlLnB5) | 0.00% | [33 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | ... and [17 more](https://app.codecov.io/gh/apache/superset/pull/40334?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #40334       +/-   ##
   ===========================================
   - Coverage   64.16%   41.71%   -22.46%     
   ===========================================
     Files        2591      768     -1823     
     Lines      138293    64677    -73616     
     Branches    32084     7846    -24238     
   ===========================================
   - Hits        88737    26978    -61759     
   + Misses      48026    36983    -11043     
   + Partials     1530      716      -814     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/40334/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Ξ” | |
   |---|---|---|
   | [javascript](https://app.codecov.io/gh/apache/superset/pull/40334/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [mysql](https://app.codecov.io/gh/apache/superset/pull/40334/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [postgres](https://app.codecov.io/gh/apache/superset/pull/40334/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [sqlite](https://app.codecov.io/gh/apache/superset/pull/40334/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [superset-extensions-cli](https://app.codecov.io/gh/apache/superset/pull/40334/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `90.82% <ΓΈ> (?)` | |
   | [unit](https://app.codecov.io/gh/apache/superset/pull/40334/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/40334?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(versioning): Version History UI for Explore and Dashboard [superset]

Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje closed pull request #40334: feat(versioning): Version History UI for Explore and Dashboard
URL: https://github.com/apache/superset/pull/40334


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org