Compare commits

...

147 Commits

Author SHA1 Message Date
Evan Rusackas
0a9e3a751d feat(docs): tier 2 — dashboard view and save-modal tutorial screenshots (#39466)
Co-authored-by: Claude <claude@anthropic.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: Superset Dev <dev@superset.apache.org>
2026-04-21 17:29:05 -07:00
Claude
ab658ac4b5 fix(docs): address Copilot review feedback on screenshot generator
- Use stable data-test="run-query-action" selector for SQL Lab Run button
- Update docstring port 9000 -> 8088 to match Superset default
- Include 'community' in screenshot-manifest type values comment

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-20 08:59:44 -07:00
Claude
b34b799d2c fix(docs): add ASF license header to screenshot manifest
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-20 08:53:53 -07:00
Claude
406358ca3b fix(docs): screenshot quality improvements and chart type picker dataset selection
- Add settle() helper (1s wait) before every screenshot to let ECharts
  animations and lazy-loaded images finish before capture
- Datasets list: switch from table-element screenshot to viewport screenshot
  so the SubMenu (Datasets nav, Bulk Select, + Dataset buttons) is visible
- Chart type picker: select birth_names dataset and Pivot Table chart type
  before screenshotting, showing both wizard steps in a useful state
- Fix strict-mode violations in chart type picker test (step title vs
  placeholder both match "Choose a dataset"; dataset select uses hidden ARIA
  listbox with ID-based option names rather than display labels)
- Regenerate all screenshots with updated tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 10:26:23 -07:00
Claude
12403b98c0 fix(docs): update screenshot generator tests and regenerate screenshots
- Remove deprecated schema/table selector steps in SQL Lab test (UI changed to tree view)
- Fix datasets table row check to skip hidden ant-table-measure-row
- Fix strict-mode violation in Run button selector (scoped to button role)
- Add baseURL explicitly to generator playwright config project use block
- Regenerate all 6 doc screenshots with latest UI

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 09:37:52 -07:00
Claude
df61792f59 feat(docs): add screenshot manifest and expand docs:screenshots generator
Introduces screenshot-manifest.yaml as a living inventory of all images
in the Superset docs, tracking output path, selector, and app_path for
each entry. Entries are removed from the manifest as Playwright tests
are written for them.

Adds two new tutorial screenshot tests to docs-screenshots.spec.ts:
- Datasets list (tutorial_08_sources_tables.png)
- Chart type picker (create_pivot.png)

Also updates DOCS_STATIC/TUTORIAL_DIR path constants and run instructions
to reflect the PLAYWRIGHT_BASE_URL env var override for local Docker use.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 09:12:14 -07:00
JUST.in DO IT
4bdc8d4c68 fix(sqllab): Relocate schema display on table preview (#39420) 2026-04-17 09:09:52 -03:00
dependabot[bot]
db7a2bd682 chore(deps): bump protocol-buffers-schema from 3.6.0 to 3.6.1 in /superset-frontend (#39418)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-16 20:49:37 -07:00
Gabriel Torres Ruiz
2e0d482ccf fix(mcp): support explicit query_mode in TableChartConfig (#39412) 2026-04-16 18:53:25 -03:00
Gabriel Torres Ruiz
e5b3a9c25d fix(mcp): replace inputSchema with parameters_hint in search_tools results by default (#39411) 2026-04-16 18:53:10 -03:00
Gabriel Torres Ruiz
c289731212 fix(mcp): prevent LLM from creating new dashboard instead of adding chart to existing one (#39353) 2026-04-16 18:52:53 -03:00
Gabriel Torres Ruiz
f850c6b1b1 fix(parallel-coordinates): improve dark mode visibility for labels, axis text, and data lines (#39415) 2026-04-16 18:51:36 -03:00
Evan Rusackas
8ce234371b test(core): restore 100% TS coverage for core-packages-ts (copy utility) (#39384)
Co-authored-by: Claude Code <noreply@anthropic.com>
2026-04-16 12:02:52 -07:00
Michael S. Molina
e5820b6b2b chore: Bump core packages to 0.1.0 RC2 (#39406) 2026-04-16 15:28:37 -03:00
Mehmet Salih Yavuz
69f062b804 feat(mcp): add a preview flow to mcp chart updates (#39383)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 20:31:02 +03:00
dependabot[bot]
735dd5dbae chore(deps): bump @swc/core from 1.15.21 to 1.15.24 in /docs (#39133)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Evan Rusackas <evan@preset.io>
2026-04-16 10:24:39 -07:00
dependabot[bot]
cd7dddb5a1 chore(deps): bump baseline-browser-mapping from 2.10.16 to 2.10.19 in /docs (#39373)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-16 10:24:26 -07:00
Mehmet Salih Yavuz
7c76fd3d81 fix(SelectFilter): auto clear search input (#39157) 2026-04-16 18:54:34 +03:00
Luiz Otavio
0b419a07f5 fix: add comments to SQL clause validation (#39167) 2026-04-16 09:19:39 -03:00
JUST.in DO IT
0b51e9cd5e fix(sqllab): format_sql to apply db dialect by database_id (#39393) 2026-04-16 08:27:51 -03:00
Amin Ghadersohi
e7b9fb277e fix(mcp): always push fresh app context per tool call to prevent g.user race (#39385) 2026-04-15 20:48:21 -04:00
Amin Ghadersohi
838ee870d0 fix(mcp): update instructions to use correct request wrapper and identifier params (#39392) 2026-04-15 20:17:07 -04:00
dependabot[bot]
84af6c9f29 chore(deps-dev): bump @docusaurus/tsconfig from 3.9.2 to 3.10.0 in /docs (#39189)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-15 15:28:40 -07:00
dependabot[bot]
05227e8a80 chore(deps): bump caniuse-lite from 1.0.30001786 to 1.0.30001788 in /docs (#39376)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-15 15:12:46 -07:00
dependabot[bot]
76a209663d chore(deps-dev): bump baseline-browser-mapping from 2.10.13 to 2.10.16 in /superset-frontend (#39150)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-15 14:56:40 -07:00
dependabot[bot]
61c45e3dd8 chore(deps-dev): bump @docusaurus/module-type-aliases from 3.9.2 to 3.10.0 in /docs (#39194)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-15 14:53:37 -07:00
dependabot[bot]
e11a50bedf chore(deps): bump @docusaurus/faster from 3.9.2 to 3.10.0 in /docs (#39195)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-15 14:53:05 -07:00
dependabot[bot]
f4a6ea0fde chore(deps): bump actions/github-script from 8.0.0 to 9.0.0 (#39267)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-15 14:52:48 -07:00
dependabot[bot]
e542e9f840 chore(deps): bump actions/cache from 5.0.4 to 5.0.5 (#39368)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-15 14:52:32 -07:00
dependabot[bot]
e0dcb2908d chore(deps): bump swagger-ui-react from 5.32.1 to 5.32.4 in /docs (#39377)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-15 14:51:42 -07:00
innovark
eaccb2e471 fix(EmptyState): prevent SVG cropping in empty state images (#37287)
Co-authored-by: Joe Li <joe@preset.io>
2026-04-15 14:49:18 -07:00
Laurent Ouattara
c1a1f2e7e7 docs: add Hifadih Business & Technology to In the Wild (#38824) 2026-04-15 14:48:58 -07:00
Robert A
45d5501aa7 fix(documentation): FAQ grammar for SQL query wording (#38923) 2026-04-15 14:48:41 -07:00
dependabot[bot]
388596e4fe chore(deps): bump baseline-browser-mapping from 2.10.13 to 2.10.16 in /docs (#39148)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-15 14:48:25 -07:00
Grégoire Gailly
b11d4f3ef0 fix(i18n): typo in fr language (#36982)
Co-authored-by: Sam Firke <sfirke@users.noreply.github.com>
2026-04-15 16:20:01 -04:00
Michael S. Molina
998b9e387b fix(ListView): empty state not filling available width (#39387)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 16:32:12 -03:00
Maxime Beauchemin
b3e88db87e fix(table): use column label instead of SQL expression for orderby in downloads (#39332)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-15 11:20:54 -07:00
Abdul Rehman
8471e82342 fix(css-templates): add missing height to CSS editor in CssTemplateModal (#39221)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 15:01:27 -03:00
Richard Fogaca Nienkotter
c3a0f2749b fix(dashboard): apply dynamic groupby display controls to scoped charts (#39356) 2026-04-15 14:57:29 -03:00
Maxime Beauchemin
c2d96e0dce fix(table): fix cross-filter not clearing on second click in Interactive Table (#39253)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-15 10:30:36 -07:00
Abdul Rehman
44e77fdf2b fix(explore): dispatch onChange immediately on NumberControl stepper arrow clicks (#39220)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 10:15:37 -07:00
Gabriel Torres Ruiz
18d6feb499 feat(mcp): add create_virtual_dataset tool to save SQL queries as datasets (#39279) 2026-04-15 13:04:32 -03:00
dependabot[bot]
0d91f5e982 chore(deps): bump markdown-to-jsx from 9.7.13 to 9.7.15 in /superset-frontend (#39217)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-15 22:29:01 +07:00
dependabot[bot]
5661fc9128 chore(deps): bump anthropics/claude-code-action from 1.0.93 to 1.0.96 + temporarily stop Dependabot PR for claude-code-action due to high release frequency but low usage(#39360)
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: hainenber <dotronghai96@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: hainenber <dotronghai96@gmail.com>
2026-04-15 22:26:44 +07:00
dependabot[bot]
a6156676c8 chore(deps): bump fuse.js from 7.1.0 to 7.3.0 in /superset-frontend (#39146)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-15 22:25:17 +07:00
dependabot[bot]
b2bd2329bc chore(deps-dev): bump wait-on from 9.0.4 to 9.0.5 in /superset-frontend (#39322)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-15 22:24:09 +07:00
Amin Ghadersohi
724f1484b9 chore(mcp): update CLAUDE.md to reflect current codebase patterns (#39348)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 11:11:21 -04:00
Beto Dealmeida
84f7b4a973 fix: do_ping takes a connection, not engine (#39013) 2026-04-15 11:10:24 -04:00
Michael S. Molina
ddcb9be9a7 fix(sqllab): show schema refresh icon only on hover (#39367)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 11:37:33 -03:00
dependabot[bot]
8d9b5bd479 chore(deps): bump follow-redirects from 1.15.11 to 1.16.0 in /docs (#39352)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-15 21:32:26 +07:00
dependabot[bot]
4b88fc57b4 chore(deps-dev): bump prettier from 3.8.2 to 3.8.3 in /superset-websocket (#39358)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-15 21:31:56 +07:00
Hugh A. Miles II
b76080e291 feat(security): add granular export controls - Phase 2 + 3 (#38581)
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
Co-authored-by: codeant-ai-for-open-source[bot] <244253245+codeant-ai-for-open-source[bot]@users.noreply.github.com>
Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>
Co-authored-by: Daniel Vaz Gaspar <danielvazgaspar@gmail.com>
2026-04-15 10:24:59 -04:00
Alexandru Soare
411f769896 feat(filters): Adding empty state for filter modal (#38909) 2026-04-15 15:59:11 +03:00
Alexandru Soare
ffcc6e8b63 fix(MCP): fix MCP logs (#39159) 2026-04-15 15:57:04 +03:00
Luiz Otavio
86575e129b fix(native-filters): prevent infinite recursion in filter scope tree traversal (#39355) 2026-04-15 08:16:12 -03:00
Joe Li
3e25f02da9 test(sqllab): migrate Cypress E2E tests to Playwright (#39071) 2026-04-14 10:31:37 -07:00
dependabot[bot]
002d8ad1e4 chore(deps-dev): bump @types/node from 25.5.0 to 25.6.0 in /superset-frontend (#39265)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-14 23:18:15 +07:00
dependabot[bot]
6287a07912 chore(deps): bump anthropics/claude-code-action from 1.0.89 to 1.0.93 (#39318)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-14 23:14:11 +07:00
dependabot[bot]
fa97d0357f chore(deps-dev): bump globals from 17.4.0 to 17.5.0 in /superset-websocket (#39310)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-14 23:02:05 +07:00
dependabot[bot]
f836c3eccd chore(deps-dev): bump typescript-eslint from 8.58.0 to 8.58.2 in /superset-websocket (#39337)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-14 22:59:44 +07:00
JUST.in DO IT
499e27ea54 fix(native-filter): infinite filter loading by deps (#39175) 2026-04-14 09:06:36 -03:00
Alexandru Soare
c2a35e2eea fix(popup): Dropdown popup width doesn't match input width when tags collapse in oneLine mode (#39136) 2026-04-14 11:09:26 +03:00
Alexandru Soare
5138aa2c11 fix(select): select all button cutoff (#39005) 2026-04-14 11:07:10 +03:00
Alexandru Soare
66a9e2e16e fix(explore): Prevent error toast when navigating away from Explore page (#39065) 2026-04-14 11:05:03 +03:00
Richard Fogaca Nienkotter
0f417f0040 fix(dashboard): preserve dynamic group by column order (#39333) 2026-04-13 21:39:04 -03:00
Alexandru Soare
1462ac9282 fix(dashboard): Ensure screenshot downloads always generate fresh images/pdfs (#38880) 2026-04-13 14:17:46 -07:00
Richard Fogaca Nienkotter
da371217ef fix: revert and restore server-side sorting for value axis sorts (#39331) 2026-04-13 18:07:15 -03:00
Richard Fogaca Nienkotter
c971ea3ec6 fix(heatmap): skip orderby for value-based axis sorts (#39290)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 14:29:26 -03:00
Richard Fogaca Nienkotter
de98fdc37b test(heatmap): restore buildQuery coverage on master (#39329) 2026-04-13 13:50:11 -03:00
Maxime Beauchemin
fa1f12a0b5 fix(explore): replace TableView with virtualized GridTable, add row limit controls, restore sample filters (#39212)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 08:19:49 -07:00
Maxime Beauchemin
de40b58e10 fix(tests): fix async teardown leak in FiltersConfigModal.test.tsx (#39281)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 12:48:01 -07:00
Mike Bridge
eea3557f61 fix(dashboard): hide "Filters out of scope" section when empty (#39201)
Co-authored-by: Mike Bridge <michael.bridge@ext.preset.io>
2026-04-10 15:42:41 -04:00
Mike Bridge
7a243d329e fix(dashboard): allow filter list to scroll in filter config modal sidebar (#39203)
Co-authored-by: Mike Bridge <michael.bridge@ext.preset.io>
2026-04-10 15:42:16 -04:00
Maxime Beauchemin
98146251c4 fix(tests): improve ShareMenuItems test isolation to fix intermittent suite failure (#39280)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 12:30:38 -07:00
Maxime Beauchemin
0aa8cace1b fix(dataset-editor): fix SQL expression editor extra spaces and height expansion (#39248)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 12:12:26 -07:00
Maxime Beauchemin
450701ecec fix(SqlLab): improve SQL diff modal — responsive width, padding, tabs, and copy button (#39246)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 12:11:05 -07:00
Richard Fogaca Nienkotter
e9911fbac4 fix(echarts): prevent tooltip crash during dashboard auto-refresh (#39277)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 14:36:44 -03:00
Gabriel Torres Ruiz
69c8eef78e fix(ag-grid): jpeg export of ag-grid tables (#38781) 2026-04-10 12:54:59 -03:00
dependabot[bot]
2ff50667e7 chore(deps): bump axios from 1.13.5 to 1.15.0 in /superset-frontend (#39258)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-10 20:55:13 +07:00
dependabot[bot]
f1cf274751 chore(deps): bump axios from 1.13.5 to 1.15.0 in /docs (#39259)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-10 20:48:35 +07:00
dependabot[bot]
b65396ccd4 chore(deps-dev): bump @types/node from 25.5.2 to 25.6.0 in /superset-websocket (#39262)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-10 20:46:57 +07:00
dependabot[bot]
1ad76e847e chore(deps-dev): bump prettier from 3.8.1 to 3.8.2 in /superset-websocket (#39260)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-10 20:46:34 +07:00
dependabot[bot]
4583ef93a4 chore(deps-dev): bump prettier from 3.8.1 to 3.8.2 in /superset-frontend (#39263)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-10 20:40:46 +07:00
dependabot[bot]
f632d2474b chore(deps-dev): bump webpack from 5.105.4 to 5.106.0 in /superset-frontend (#39268)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-10 20:40:03 +07:00
Evan Rusackas
b1d69f5b39 docs(api): add Theme API endpoints to OpenAPI spec (#37943)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-10 00:17:06 -07:00
Enzo Martellucci
aba7e6dae4 fix(table): cross-filtering breaks after renaming column labels via Custom SQL (#38858) 2026-04-10 06:02:18 +02:00
Mike Bridge
8bcc90c766 fix(dashboard): Vertical filter bar gradient is extending past the filter bar area (#39204)
Co-authored-by: Mike Bridge <michael.bridge@ext.preset.io>
2026-04-09 18:30:47 -07:00
venkateshwaran shanmugham
e39dd1afce fix: implement native browser fullscreen for dashboard charts (#38819)
Signed-off-by: Venkateshwaran Shanmugham <venkateshwaracholan@gmail.com>
Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
Co-authored-by: Mehmet Salih Yavuz <salih.yavuz@proton.me>
Co-authored-by: Richard Fogaça <richardfogaca@gmail.com>
Co-authored-by: Richard Fogaca Nienkotter <63572350+richardfogaca@users.noreply.github.com>
2026-04-09 21:49:36 -03:00
Amin Ghadersohi
680cef0ee0 fix(mcp): strip json_metadata and position_json from get_dashboard_info response (#39101) 2026-04-09 17:30:57 -04:00
Amin Ghadersohi
e17cf3c808 fix(mcp): wire up compact schema serialization for search_tools results (#39229) 2026-04-09 17:25:46 -04:00
Shaitan
f49310b8ff fix(sql-lab): apply access check in SqlExecutionResultsCommand (#38952)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 16:47:15 -04:00
Vitor Avila
c7955a38ef fix: Drill to Detail for Embedded (#39214)
Co-authored-by: Maxime Beauchemin <maximebeauchemin@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 17:01:48 -03:00
Amin Ghadersohi
68067d7f44 fix(mcp): handle OAuth-authenticated databases in execute_sql (#39166) 2026-04-09 15:47:00 -04:00
Daniel Vaz Gaspar
5815665cc6 feat: role/user CRUD events and login/logout tracking in the action log (#39121)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 15:55:25 +01:00
Enzo Martellucci
6649f35a0d fix(reports): escape SQL LIKE wildcards in find_by_extra_metadata (#38738)
Co-authored-by: Mehmet Salih Yavuz <salih.yavuz@proton.me>
2026-04-09 12:58:06 +03:00
Mehmet Salih Yavuz
5263abdc60 fix(AlertsReports): untie filters from alerts reports tabs flag (#38722)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 11:11:43 +03:00
Birk Skyum
c49641538d feat: modernize deck.gl and map plugins with MapLibre/Mapbox dual renderer (#38035)
Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>
2026-04-08 20:14:59 -04:00
Maxime Beauchemin
d915e4f3ff fix(tags): fix Bulk tag modal dropdown clipping and stale tag cache (#39210)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 16:28:13 -07:00
Maxime Beauchemin
bad5a35fce fix(explore): constrain Edit Dataset modal height to prevent footer cutoff (#39211)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 16:19:10 -07:00
Amin Ghadersohi
1bde6f3bfd fix(mcp): resolve null fields in list_datasets, list_databases, and save_sql_query (#39206) 2026-04-08 18:39:56 -04:00
Deadman
4e0890ee1f feat(api): Add filter_dashboard_id parameter to apply dashboard filters to chart/data endpoint (#38638)
Co-authored-by: Matthew Deadman <matthewdeadman@Matthews-MacBook-Pro-2.local>
Co-authored-by: Matthew Deadman <matthewdeadman@matthews-mbp-2.lan>
Co-authored-by: codeant-ai-for-open-source[bot] <244253245+codeant-ai-for-open-source[bot]@users.noreply.github.com>
2026-04-08 15:32:46 -07:00
Maxime Beauchemin
d63308ca37 fix(frontend): fix loading spinner positioning in Save modal and filters panel (#39205)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: yousoph <sophieyou12@gmail.com>
2026-04-08 13:23:30 -07:00
Maxime Beauchemin
63cceb6a79 refactor(plugins): replace react-icons with antd icons, remove 83MB dependency (#39184)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 13:21:34 -07:00
Maxime Beauchemin
b8b2bdedf9 fix(ace-editor): style bracket matching to blend with theme (#39182)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 13:09:14 -07:00
Maxime Beauchemin
d5017e60c3 fix(sqllab): fix table navigator schema list, pin/unpin UX, copy actions, icons, and toolbar colors (#39173)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 13:06:29 -07:00
Luiz Otavio
2e80f2a473 fix: add template_processor so Jinja gets rendered before SQLGlot parse (#39207) 2026-04-08 16:58:15 -03:00
JUST.in DO IT
4c2dd63464 fix(sqllab): Update style for code viewer container (#39075) 2026-04-08 12:42:06 -07:00
Maxime Beauchemin
62302ad8c3 perf(webpack): reduce watch mode memory usage and fix docker-compose-light env (#39183)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 12:26:49 -07:00
Maxime Beauchemin
ed659958f3 fix(sqllab): use monospace font for SQL in database error messages (#39181)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:26:25 -07:00
Maxime Beauchemin
36de05fe36 fix(plugin-chart-handlebars): improve CSS sanitization tooltip and hide when not needed (#39180)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 12:25:54 -07:00
Maxime Beauchemin
a64609f4f3 fix(explore): add left-indentation to control panel hierarchy (#39177)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 12:25:36 -07:00
Maxime Beauchemin
140f0001f2 fix(sqllab): demote "Save as new" button from primary to secondary (#39179)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 12:03:44 -07:00
Elizabeth Thompson
587fe4af63 fix(reports): propagate PlaywrightTimeout so execution transitions to ERROR state (#39176)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 11:00:03 -07:00
Michael S. Molina
3a3a6536b7 fix(explore): Unnecessary scroll bars appearing on charts in Explore (#39160)
Co-authored-by: Đỗ Trọng Hải <41283691+hainenber@users.noreply.github.com>
2026-04-08 08:33:20 -03:00
Alexandru Soare
4f695e1b4d fix(filterReports): _generate_native_filter() crashes on null/empty filterValues (#38954) 2026-04-08 13:53:18 +03:00
Maxime Beauchemin
6ba9096870 fix(explore): handle boolean false values correctly in control rendering (#39172)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 18:23:03 -07:00
dependabot[bot]
5106afb07f chore(deps): bump d3-cloud from 1.2.8 to 1.2.9 in /superset-frontend (#39145)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-07 15:16:28 -07:00
dependabot[bot]
2bd4131636 chore(deps): bump react-syntax-highlighter from 16.1.0 to 16.1.1 in /superset-frontend (#39134)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-07 15:15:18 -07:00
dependabot[bot]
7e452df1cc chore(deps): bump anthropics/claude-code-action from 1.0.87 to 1.0.89 (#39132)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-07 15:14:30 -07:00
dependabot[bot]
a626d06415 chore(deps): bump caniuse-lite from 1.0.30001784 to 1.0.30001786 in /docs (#39128)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-07 15:11:13 -07:00
dependabot[bot]
d159edc9a6 chore(deps-dev): bump @swc/core from 1.15.21 to 1.15.24 in /superset-frontend (#39127)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-07 15:10:17 -07:00
dependabot[bot]
96fa2cbd2b chore(deps): update @deck.gl/aggregation-layers requirement from ~9.2.9 to ~9.2.11 in /superset-frontend/plugins/legacy-preset-chart-deckgl (#39126)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-07 15:09:49 -07:00
dependabot[bot]
9750881193 chore(deps-dev): bump @types/node from 25.5.0 to 25.5.2 in /superset-websocket (#39125)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-07 15:09:25 -07:00
dependabot[bot]
3db92021c7 chore(deps-dev): bump eslint from 10.1.0 to 10.2.0 in /superset-websocket (#39123)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-07 15:08:46 -07:00
dependabot[bot]
5ccfc530b2 chore(deps): bump geolib from 3.3.4 to 3.3.14 in /superset-frontend (#39092)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-07 14:48:08 -07:00
Amin Ghadersohi
5f9fc31ae2 feat(mcp): add get_chart_type_schema tool for on-demand schema discovery (#39142) 2026-04-07 12:07:45 -04:00
dependabot[bot]
8e811de564 chore(deps): bump hot-shots from 14.2.0 to 14.3.1 in /superset-websocket (#39147)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-07 22:43:50 +07:00
dependabot[bot]
027de6339b chore(deps-dev): bump jsdom from 29.0.1 to 29.0.2 in /superset-frontend (#39155)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-07 21:39:04 +07:00
Amin Ghadersohi
bf9aff19b5 fix(mcp): compress chart config schemas to reduce search_tools token usage (#39018) 2026-04-06 19:52:03 -04:00
SBIN2010
b05764d070 feat: Add currencies controls in country map (#39016) 2026-04-06 23:20:03 +03:00
Amin Ghadersohi
7be2acb2f3 fix(mcp): add description and certification fields to default list tool columns (#39017) 2026-04-06 13:37:52 -04:00
Amin Ghadersohi
83ad1eca26 fix(mcp): add dynamic response truncation for oversized info tool responses (#39107) 2026-04-06 12:36:03 -04:00
Amin Ghadersohi
92747246fc fix(mcp): remove JWT ValueError g.user fallback in auth layer (#39106) 2026-04-06 12:35:46 -04:00
Amin Ghadersohi
7380a59ab8 fix(mcp): fix form_data null, dataset URL, ASCII preview, and chart rename (#39109) 2026-04-06 12:34:26 -04:00
Ville Brofeldt
e56f8cc4fb fix(security_manager): custom auth_view issue (#39098) 2026-04-06 09:04:59 -07:00
Ville Brofeldt
7c79b9ab61 fix(migrations): check pre-existing foreign keys on create util (#39099) 2026-04-06 09:04:22 -07:00
Maxime Beauchemin
a62be684a0 feat(mcp): add database connection listing and info tools (#39111)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Amin Ghadersohi <amin.ghadersohi@gmail.com>
2026-04-06 11:34:10 -04:00
Michael S. Molina
a3dfbd7bff fix(deps): revert simple-zstd from 2.1.0 back to 1.4.2 (#39139)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 11:28:28 -03:00
Sam Firke
12eb40db01 fix(SQL Lab): handle columns without names (#38986) 2026-04-06 10:09:16 -04:00
dependabot[bot]
d796543f5a chore(deps): update @deck.gl/react requirement from ~9.2.9 to ~9.2.11 in /superset-frontend/plugins/legacy-preset-chart-deckgl (#39033)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-03 15:07:42 -07:00
dependabot[bot]
e5ae626433 chore(deps): bump dawidd6/action-download-artifact from 19 to 20 (#39081)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-03 15:06:06 -07:00
dependabot[bot]
8195574345 chore(deps): bump anthropics/claude-code-action from 1.0.85 to 1.0.87 (#39083)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-03 15:04:43 -07:00
dependabot[bot]
6b029997d9 chore(deps): bump react-syntax-highlighter from 16.1.0 to 16.1.1 in /superset-frontend (#39087)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-03 15:04:04 -07:00
dependabot[bot]
7a64483e6b chore(deps-dev): bump @swc/plugin-emotion from 14.7.0 to 14.8.0 in /superset-frontend (#39088)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-03 15:03:44 -07:00
dependabot[bot]
e424b55036 chore(deps-dev): bump babel-loader from 10.1.0 to 10.1.1 in /superset-frontend (#39090)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-03 15:02:57 -07:00
dependabot[bot]
613e6d6cde chore(deps): bump d3-cloud from 1.2.8 to 1.2.9 in /superset-frontend (#39093)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-03 15:02:11 -07:00
Amin Ghadersohi
b3a402d936 fix(mcp): handle stale SSL connections, heatmap duplicate labels, and session rollback (#39015) 2026-04-03 16:07:29 -04:00
583 changed files with 28474 additions and 7329 deletions

View File

@@ -4,6 +4,10 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
ignore:
# Ignore temporarily as release schedule is too mentally taxing for dep-handling maintainers
# Additionally, very few PRs are reviewed by this action.
- dependency-name: anthropics/claude-code-action
schedule:
interval: "daily"

View File

@@ -27,7 +27,7 @@ jobs:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Check and notify
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{ github.token }}
script: |

View File

@@ -44,7 +44,7 @@ jobs:
pull-requests: write
steps:
- name: Comment access denied
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const message = `👋 Hi @${{ github.event.comment.user.login || github.event.review.user.login || github.event.issue.user.login }}!
@@ -76,7 +76,7 @@ jobs:
fetch-depth: 1
- name: Run Claude PR Action
uses: anthropics/claude-code-action@58dbe8ed6879f0d3b02ac295b20d5fdfe7733e0c # beta
uses: anthropics/claude-code-action@5fb899572b81d2bb648d4d187173a2f423a9677c # beta
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
timeout_minutes: "60"

View File

@@ -71,7 +71,7 @@ jobs:
- name: Comment (success)
if: steps.describe-services.outputs.active == 'true'
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{github.token}}
script: |

View File

@@ -65,7 +65,7 @@ jobs:
- name: Get event SHA
id: get-sha
if: steps.eval-label.outputs.result == 'up'
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
@@ -96,7 +96,7 @@ jobs:
core.setOutput("sha", prSha);
- name: Looking for feature flags in PR description
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
id: eval-feature-flags
if: steps.eval-label.outputs.result == 'up'
with:
@@ -118,7 +118,7 @@ jobs:
return results;
- name: Reply with confirmation comment
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
if: steps.eval-label.outputs.result == 'up'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -250,7 +250,7 @@ jobs:
- name: Fail on missing container image
if: steps.check-image.outcome == 'failure'
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{ github.token }}
script: |
@@ -324,7 +324,7 @@ jobs:
echo "ip=$(aws ec2 describe-network-interfaces --network-interface-ids ${{ steps.get-eni.outputs.eni }} | jq -r '.NetworkInterfaces | first | .Association.PublicIp')" >> $GITHUB_OUTPUT
- name: Comment (success)
if: ${{ success() }}
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{github.token}}
script: |
@@ -337,7 +337,7 @@ jobs:
});
- name: Comment (failure)
if: ${{ failure() }}
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{github.token}}
script: |

View File

@@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Check for 'hold' label
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |

View File

@@ -57,7 +57,7 @@ jobs:
yarn install --immutable
- name: Cache pre-commit environments
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: ~/.cache/pre-commit
key: pre-commit-v2-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}

View File

@@ -50,7 +50,7 @@ jobs:
- name: Cache npm
if: env.HAS_TAGS
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -64,7 +64,7 @@ jobs:
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
- name: Cache npm
if: env.HAS_TAGS
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
id: npm-cache # use this to check for `cache-hit` (`steps.npm-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}

View File

@@ -37,7 +37,7 @@ jobs:
steps:
- name: Security Check - Authorize Maintainers Only
id: auth
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:

View File

@@ -70,7 +70,7 @@ jobs:
yarn install --check-cache
- name: Download database diagnostics (if triggered by integration tests)
if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success'
uses: dawidd6/action-download-artifact@8a338493df3d275e4a7a63bcff3b8fe97e51a927 # v19
uses: dawidd6/action-download-artifact@8305c0f1062bb0d184d09ef4493ecb9288447732 # v20
continue-on-error: true
with:
workflow: superset-python-integrationtest.yml
@@ -79,7 +79,7 @@ jobs:
path: docs/src/data/
- name: Try to download latest diagnostics (for push/dispatch triggers)
if: github.event_name != 'workflow_run'
uses: dawidd6/action-download-artifact@8a338493df3d275e4a7a63bcff3b8fe97e51a927 # v19
uses: dawidd6/action-download-artifact@8305c0f1062bb0d184d09ef4493ecb9288447732 # v20
continue-on-error: true
with:
workflow: superset-python-integrationtest.yml

View File

@@ -111,7 +111,7 @@ jobs:
run: |
yarn install --check-cache
- name: Download database diagnostics from integration tests
uses: dawidd6/action-download-artifact@8a338493df3d275e4a7a63bcff3b8fe97e51a927 # v19
uses: dawidd6/action-download-artifact@8305c0f1062bb0d184d09ef4493ecb9288447732 # v20
with:
workflow: superset-python-integrationtest.yml
run_id: ${{ github.event.workflow_run.id }}

View File

@@ -101,7 +101,7 @@ jobs:
CR_RELEASE_NAME_TEMPLATE: "superset-helm-chart-{{ .Version }}"
- name: Open Pull Request
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const branchName = '${{ env.branch_name }}';

View File

@@ -26,7 +26,7 @@ jobs:
steps:
- name: Quickly add thumbs up!
if: github.event_name == 'issue_comment' && contains(github.event.comment.body, '@supersetbot')
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/')

View File

@@ -287,6 +287,11 @@ categories:
url: https://www.gfk.com/home
contributors: ["@mherr"]
- name: Hifadih Business & Technology
url: https://hifadih.net/en
logo: hifadih.png
contributors: ["@saintLaurent00"]
# Logo approved by @anmol-hpe on behalf of HPE
- name: HPE
url: https://www.hpe.com/in/en/home.html

View File

@@ -24,6 +24,20 @@ assists people when migrating to a new version.
## Next
### Granular Export Controls
A new feature flag `GRANULAR_EXPORT_CONTROLS` introduces three fine-grained permissions that replace the legacy `can_csv` permission:
| Permission | Controls |
|---|---|
| `can_export_data` | CSV, Excel, JSON exports |
| `can_export_image` | Screenshot/PDF exports |
| `can_copy_clipboard` | Copy-to-clipboard operations |
When the feature flag is enabled, these permissions are enforced on both the frontend (disabled buttons with tooltips) and backend (403 responses from API endpoints). When disabled, legacy `can_csv` behavior is preserved.
**Migration behavior:** All three new permissions are granted to every role that currently has `can_csv`, preserving existing access. Admins can then selectively revoke individual export permissions from specific roles as needed.
### Deck.gl MapBox viewport and opacity controls are functional
The Deck.gl MapBox chart's **Opacity**, **Default longitude**, **Default latitude**, and **Zoom** controls were previously non-functional — changing them had no effect on the rendered map. These controls are now wired up correctly.

View File

@@ -115,6 +115,10 @@ services:
DATABASE_HOST: db-light
DATABASE_DB: superset_light
POSTGRES_DB: superset_light
EXAMPLES_HOST: db-light
EXAMPLES_DB: superset_light
EXAMPLES_USER: superset
EXAMPLES_PASSWORD: superset
SUPERSET_CONFIG_PATH: /app/docker/pythonpath_dev/superset_config_docker_light.py
GITHUB_HEAD_REF: ${GITHUB_HEAD_REF:-}
GITHUB_SHA: ${GITHUB_SHA:-}
@@ -137,6 +141,10 @@ services:
DATABASE_HOST: db-light
DATABASE_DB: superset_light
POSTGRES_DB: superset_light
EXAMPLES_HOST: db-light
EXAMPLES_DB: superset_light
EXAMPLES_USER: superset
EXAMPLES_PASSWORD: superset
SUPERSET_CONFIG_PATH: /app/docker/pythonpath_dev/superset_config_docker_light.py
healthcheck:
disable: true
@@ -157,6 +165,7 @@ services:
BUILD_SUPERSET_FRONTEND_IN_DOCKER: true
NPM_RUN_PRUNE: false
SCARF_ANALYTICS: "${SCARF_ANALYTICS:-}"
DISABLE_TS_CHECKER: "${DISABLE_TS_CHECKER:-true}"
# configuring the dev-server to use the host.docker.internal to connect to the backend
superset: "http://superset-light:8088"
# Webpack dev server must bind to 0.0.0.0 to be accessible from outside the container

View File

@@ -80,7 +80,7 @@ case "${1}" in
;;
app)
echo "Starting web app (using development server)..."
flask run -p $PORT --reload --debugger --without-threads --host=0.0.0.0 --exclude-patterns "*/node_modules/*:*/.venv/*:*/build/*:*/__pycache__/*"
flask run -p $PORT --reload --debugger --host=0.0.0.0 --exclude-patterns "*/node_modules/*:*/.venv/*:*/build/*:*/__pycache__/*:*/superset-frontend/*"
;;
app-gunicorn)
echo "Starting web app..."

View File

@@ -412,7 +412,7 @@ curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
|--------|----------|-------------|
| `GET` | [Get security roles](/developer-docs/api/get-security-roles) | `/api/v1/security/roles/` |
| `POST` | [Create security roles](/developer-docs/api/create-security-roles) | `/api/v1/security/roles/` |
| `GET` | [Get security roles info](/developer-docs/api/get-security-roles-info) | `/api/v1/security/roles/_info` |
| `GET` | [Get security roles info](/developer-docs/api/get-security-roles-info) | `/api/v1/security/roles/_info` |
| `DELETE` | [Delete security roles by pk](/developer-docs/api/delete-security-roles-by-pk) | `/api/v1/security/roles/{pk}` |
| `GET` | [Get security roles by pk](/developer-docs/api/get-security-roles-by-pk) | `/api/v1/security/roles/{pk}` |
| `PUT` | [Update security roles by pk](/developer-docs/api/update-security-roles-by-pk) | `/api/v1/security/roles/{pk}` |
@@ -430,7 +430,7 @@ curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
|--------|----------|-------------|
| `GET` | [Get security users](/developer-docs/api/get-security-users) | `/api/v1/security/users/` |
| `POST` | [Create security users](/developer-docs/api/create-security-users) | `/api/v1/security/users/` |
| `GET` | [Get security users info](/developer-docs/api/get-security-users-info) | `/api/v1/security/users/_info` |
| `GET` | [Get security users info](/developer-docs/api/get-security-users-info) | `/api/v1/security/users/_info` |
| `DELETE` | [Delete security users by pk](/developer-docs/api/delete-security-users-by-pk) | `/api/v1/security/users/{pk}` |
| `GET` | [Get security users by pk](/developer-docs/api/get-security-users-by-pk) | `/api/v1/security/users/{pk}` |
| `PUT` | [Update security users by pk](/developer-docs/api/update-security-users-by-pk) | `/api/v1/security/users/{pk}` |
@@ -443,7 +443,7 @@ curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
| Method | Endpoint | Description |
|--------|----------|-------------|
| `GET` | [Get security permissions](/developer-docs/api/get-security-permissions) | `/api/v1/security/permissions/` |
| `GET` | [Get security permissions info](/developer-docs/api/get-security-permissions-info) | `/api/v1/security/permissions/_info` |
| `GET` | [Get security permissions info](/developer-docs/api/get-security-permissions-info) | `/api/v1/security/permissions/_info` |
| `GET` | [Get security permissions by pk](/developer-docs/api/get-security-permissions-by-pk) | `/api/v1/security/permissions/{pk}` |
</details>
@@ -455,7 +455,7 @@ curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
|--------|----------|-------------|
| `GET` | [Get security resources](/developer-docs/api/get-security-resources) | `/api/v1/security/resources/` |
| `POST` | [Create security resources](/developer-docs/api/create-security-resources) | `/api/v1/security/resources/` |
| `GET` | [Get security resources info](/developer-docs/api/get-security-resources-info) | `/api/v1/security/resources/_info` |
| `GET` | [Get security resources info](/developer-docs/api/get-security-resources-info) | `/api/v1/security/resources/_info` |
| `DELETE` | [Delete security resources by pk](/developer-docs/api/delete-security-resources-by-pk) | `/api/v1/security/resources/{pk}` |
| `GET` | [Get security resources by pk](/developer-docs/api/get-security-resources-by-pk) | `/api/v1/security/resources/{pk}` |
| `PUT` | [Update security resources by pk](/developer-docs/api/update-security-resources-by-pk) | `/api/v1/security/resources/{pk}` |
@@ -469,7 +469,7 @@ curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
|--------|----------|-------------|
| `GET` | [Get security permissions resources](/developer-docs/api/get-security-permissions-resources) | `/api/v1/security/permissions-resources/` |
| `POST` | [Create security permissions resources](/developer-docs/api/create-security-permissions-resources) | `/api/v1/security/permissions-resources/` |
| `GET` | [Get security permissions resources info](/developer-docs/api/get-security-permissions-resources-info) | `/api/v1/security/permissions-resources/_info` |
| `GET` | [Get security permissions resources info](/developer-docs/api/get-security-permissions-resources-info) | `/api/v1/security/permissions-resources/_info` |
| `DELETE` | [Delete security permissions resources by pk](/developer-docs/api/delete-security-permissions-resources-by-pk) | `/api/v1/security/permissions-resources/{pk}` |
| `GET` | [Get security permissions resources by pk](/developer-docs/api/get-security-permissions-resources-by-pk) | `/api/v1/security/permissions-resources/{pk}` |
| `PUT` | [Update security permissions resources by pk](/developer-docs/api/update-security-permissions-resources-by-pk) | `/api/v1/security/permissions-resources/{pk}` |
@@ -578,7 +578,29 @@ curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
| Method | Endpoint | Description |
|--------|----------|-------------|
| `GET` | [Get api by version openapi](/developer-docs/api/get-api-by-version-openapi) | `/api/{version}/_openapi` |
| `GET` | [Get api by version openapi](/developer-docs/api/get-api-by-version-openapi) | `/api/{version}/_openapi` |
</details>
<details>
<summary><strong>Themes</strong> (14 endpoints) — Manage UI themes for customizing Superset's appearance.</summary>
| Method | Endpoint | Description |
|--------|----------|-------------|
| `DELETE` | [Bulk delete themes](/developer-docs/api/bulk-delete-themes) | `/api/v1/theme/` |
| `GET` | [Get a list of themes](/developer-docs/api/get-a-list-of-themes) | `/api/v1/theme/` |
| `POST` | [Create a theme](/developer-docs/api/create-a-theme) | `/api/v1/theme/` |
| `GET` | [Get metadata information about this API resource (theme-info)](/developer-docs/api/get-metadata-information-about-this-api-resource-theme-info) | `/api/v1/theme/_info` |
| `DELETE` | [Delete a theme](/developer-docs/api/delete-a-theme) | `/api/v1/theme/{pk}` |
| `GET` | [Get a theme](/developer-docs/api/get-a-theme) | `/api/v1/theme/{pk}` |
| `PUT` | [Update a theme](/developer-docs/api/update-a-theme) | `/api/v1/theme/{pk}` |
| `PUT` | [Set a theme as the system dark theme](/developer-docs/api/set-a-theme-as-the-system-dark-theme) | `/api/v1/theme/{pk}/set_system_dark` |
| `PUT` | [Set a theme as the system default theme](/developer-docs/api/set-a-theme-as-the-system-default-theme) | `/api/v1/theme/{pk}/set_system_default` |
| `GET` | [Download multiple themes as YAML files](/developer-docs/api/download-multiple-themes-as-yaml-files) | `/api/v1/theme/export/` |
| `POST` | [Import themes from a ZIP file](/developer-docs/api/import-themes-from-a-zip-file) | `/api/v1/theme/import/` |
| `GET` | [Get related fields data (theme-related-column-name)](/developer-docs/api/get-related-fields-data-theme-related-column-name) | `/api/v1/theme/related/{column_name}` |
| `DELETE` | [Clear the system dark theme](/developer-docs/api/clear-the-system-dark-theme) | `/api/v1/theme/unset_system_dark` |
| `DELETE` | [Clear the system default theme](/developer-docs/api/clear-the-system-default-theme) | `/api/v1/theme/unset_system_default` |
</details>

View File

@@ -91,7 +91,7 @@ or a view.
When working with tables, the solution would be to create a table that contains all the fields
needed for your analysis, most likely through some scheduled batch process.
A view is a simple logical layer that abstracts an arbitrary SQL queries as a virtual table. This can
A view is a simple logical layer that abstracts an arbitrary SQL query as a virtual table. This can
allow you to join and union multiple tables and to apply some transformation using arbitrary SQL
expressions. The limitation there is your database performance, as Superset effectively will run a
query on top of your query (view). A good practice may be to limit yourself to joining your main

View File

@@ -0,0 +1,78 @@
---
title: Granular Export Controls
sidebar_position: 4
---
# Granular Export Controls
Superset provides granular, permission-based controls for data export, image export, and clipboard operations. These replace the legacy `can_csv` permission with three fine-grained permissions that can be assigned independently to roles.
## Feature Flag
Granular export controls are gated behind the `GRANULAR_EXPORT_CONTROLS` feature flag. When the flag is disabled, the legacy `can_csv` permission behavior is preserved.
```python
FEATURE_FLAGS = {
"GRANULAR_EXPORT_CONTROLS": True,
}
```
## Permissions
| Permission | Resource | Controls |
| -------------------- | ---------- | ---------------------------------------------------------------------- |
| `can_export_data` | `Superset` | CSV, Excel, and JSON data exports from charts, dashboards, and SQL Lab |
| `can_export_image` | `Superset` | Screenshot (JPEG/PNG) and PDF exports from charts and dashboards |
| `can_copy_clipboard` | `Superset` | Copy-to-clipboard operations in SQL Lab and the Explore data pane |
## Default Role Assignments
The migration grants all three new permissions (`can_export_data`, `can_export_image`, `can_copy_clipboard`) to every role that currently has `can_csv`. This preserves existing behavior — no role loses access during the upgrade.
After the migration, admins can selectively revoke individual export permissions from any role to restrict access. For example, to prevent Gamma users from exporting data or images while still allowing clipboard operations, revoke `can_export_data` and `can_export_image` from the Gamma role.
## Configuration Steps
1. **Enable the feature flag** in `superset_config.py`:
```python
FEATURE_FLAGS = {
"GRANULAR_EXPORT_CONTROLS": True,
}
```
2. **Run the database migration** to register the new permissions:
```bash
superset db upgrade
```
3. **Initialize permissions** so roles are populated:
```bash
superset init
```
4. **Verify role assignments** in **Settings > List Roles**. Confirm that each role has the expected permissions from the table above.
5. **Customize as needed**: Grant or revoke individual export permissions on any role through the role editor.
## User Experience
When a user lacks a required export permission:
- **Menu items** (CSV, Excel, JSON, screenshot) appear **disabled** with an info tooltip icon explaining the restriction
- **Buttons** (SQL Lab download, clipboard copy) appear **disabled** with a tooltip on hover
- **API endpoints** return **403 Forbidden** when the corresponding permission is missing
## API Enforcement
The following API endpoints enforce granular export permissions when the feature flag is enabled:
| Endpoint | Required Permission |
| --------------------------------------------------------- | ------------------- |
| `GET /api/v1/chart/{id}/data/` (CSV/Excel format) | `can_export_data` |
| `GET /api/v1/chart/{id}/cache_screenshot/` | `can_export_image` |
| `POST /api/v1/dashboard/{id}/cache_dashboard_screenshot/` | `can_export_image` |
| `GET /api/v1/sqllab/export/{client_id}/` | `can_export_data` |
| `POST /api/v1/sqllab/export_streaming/` | `can_export_data` |

View File

@@ -42,7 +42,7 @@
"dependencies": {
"@ant-design/icons": "^6.1.1",
"@docusaurus/core": "3.9.2",
"@docusaurus/faster": "^3.9.2",
"@docusaurus/faster": "^3.10.0",
"@docusaurus/plugin-client-redirects": "3.9.2",
"@docusaurus/preset-classic": "3.9.2",
"@docusaurus/theme-live-codeblock": "^3.9.2",
@@ -67,10 +67,10 @@
"@storybook/preview-api": "^8.6.18",
"@storybook/theming": "^8.6.15",
"@superset-ui/core": "^0.20.4",
"@swc/core": "^1.15.21",
"@swc/core": "^1.15.24",
"antd": "^6.3.5",
"baseline-browser-mapping": "^2.10.13",
"caniuse-lite": "^1.0.30001784",
"baseline-browser-mapping": "^2.10.19",
"caniuse-lite": "^1.0.30001788",
"docusaurus-plugin-openapi-docs": "^4.6.0",
"docusaurus-theme-openapi-docs": "^4.6.0",
"js-yaml": "^4.1.1",
@@ -86,14 +86,14 @@
"remark-import-partial": "^0.0.2",
"reselect": "^5.1.1",
"storybook": "^8.6.18",
"swagger-ui-react": "^5.32.1",
"swagger-ui-react": "^5.32.4",
"swc-loader": "^0.2.7",
"tinycolor2": "^1.4.2",
"unist-util-visit": "^5.1.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^3.9.1",
"@docusaurus/tsconfig": "^3.9.2",
"@docusaurus/module-type-aliases": "^3.10.0",
"@docusaurus/tsconfig": "^3.10.0",
"@eslint/js": "^9.39.2",
"@types/js-yaml": "^4.0.9",
"@types/react": "^19.1.8",

View File

@@ -129,6 +129,30 @@ def add_missing_schemas(spec: dict[str, Any]) -> tuple[dict[str, Any], list[str]
}
fixed.append("DashboardColorsConfigUpdateSchema")
# DashboardChartCustomizationsConfigUpdateSchema (dashboards/schemas.py)
if "DashboardChartCustomizationsConfigUpdateSchema" not in schemas:
schemas["DashboardChartCustomizationsConfigUpdateSchema"] = {
"type": "object",
"properties": {
"deleted": {
"type": "array",
"items": {"type": "string"},
"description": "List of deleted chart customization IDs.",
},
"modified": {
"type": "array",
"items": {"type": "object"},
"description": "List of modified chart customizations.",
},
"reordered": {
"type": "array",
"items": {"type": "string"},
"description": "List of chart customization IDs in new order.",
},
},
}
fixed.append("DashboardChartCustomizationsConfigUpdateSchema")
# FormatQueryPayloadSchema - based on superset/sqllab/schemas.py
if "FormatQueryPayloadSchema" not in schemas:
schemas["FormatQueryPayloadSchema"] = {
@@ -295,6 +319,7 @@ TAG_DESCRIPTIONS = {
"Security Roles": "Manage security roles and their permissions.",
"Security Users": "Manage user accounts.",
"Tags": "Organize assets with tags.",
"Themes": "Manage UI themes for customizing Superset's appearance.",
"User": "User profile and preferences.",
}

BIN
docs/static/img/logos/hifadih.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 240 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 21 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -35,7 +35,7 @@ or a view.
When working with tables, the solution would be to create a table that contains all the fields
needed for your analysis, most likely through some scheduled batch process.
A view is a simple logical layer that abstracts an arbitrary SQL queries as a virtual table. This can
A view is a simple logical layer that abstracts an arbitrary SQL query as a virtual table. This can
allow you to join and union multiple tables and to apply some transformation using arbitrary SQL
expressions. The limitation there is your database performance, as Superset effectively will run a
query on top of your query (view). A good practice may be to limit yourself to joining your main

File diff suppressed because it is too large Load Diff

View File

@@ -48,7 +48,7 @@ dependencies = [
"cryptography>=42.0.4, <47.0.0",
"deprecation>=2.1.0, <2.2.0",
"flask>=2.2.5, <4.0.0",
"flask-appbuilder>=5.0.2,<6",
"flask-appbuilder>=5.2.1, <6.0.0",
"flask-caching>=2.1.0, <3",
"flask-compress>=1.13, <2.0",
"flask-talisman>=1.0.0, <2.0",
@@ -372,6 +372,7 @@ unfixable = []
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.lint.per-file-ignores]
"superset/mcp_service/app.py" = ["S608", "E501"] # LLM instruction text: SQL examples (S608) and long lines in multiline string (E501)
"scripts/*" = ["TID251"]
"setup.py" = ["TID251"]
"superset/config.py" = ["TID251"]

View File

@@ -120,7 +120,7 @@ flask==2.3.3
# flask-session
# flask-sqlalchemy
# flask-wtf
flask-appbuilder==5.2.0
flask-appbuilder==5.2.1
# via
# apache-superset (pyproject.toml)
# apache-superset-core

View File

@@ -259,7 +259,7 @@ flask==2.3.3
# flask-sqlalchemy
# flask-testing
# flask-wtf
flask-appbuilder==5.2.0
flask-appbuilder==5.2.1
# via
# -c requirements/base-constraint.txt
# apache-superset

View File

@@ -18,20 +18,20 @@
[project]
name = "apache-superset-core"
version = "0.1.0rc1"
version = "0.1.0rc2"
description = "Core Python package for building Apache Superset backend extensions and integrations"
readme = "README.md"
authors = [
{ name = "Apache Software Foundation", email = "dev@superset.apache.org" },
]
license = { file="LICENSE.txt" }
license = "Apache-2.0"
license-files = ["LICENSE.txt"]
requires-python = ">=3.10"
keywords = ["superset", "apache", "analytics", "business-intelligence", "extensions", "visualization"]
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",

View File

@@ -23,14 +23,14 @@ readme = "README.md"
authors = [
{ name = "Apache Software Foundation", email = "dev@superset.apache.org" },
]
license = { file="LICENSE.txt" }
license = "Apache-2.0"
license-files = ["LICENSE.txt"]
requires-python = ">=3.10"
keywords = ["superset", "apache", "cli", "extensions", "analytics", "business-intelligence", "development-tools"]
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",

View File

@@ -1,73 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { selectResultsTab } from './sqllab.helper';
describe.skip('SqlLab datasource panel', () => {
beforeEach(() => {
cy.visit('/sqllab');
});
// TODO the test below is flaky, and has been disabled for the time being
// (notice the `it.skip`)
it('creates a table preview when a database, schema, and table are selected', () => {
cy.intercept('**/superset/table/**').as('tableMetadata');
// it should have dropdowns to select database, schema, and table
cy.get('.sql-toolbar .Select').should('have.length', 3);
cy.get('.sql-toolbar .table-schema').should('not.exist');
cy.get('[data-test="filterable-table-container"]').should('not.exist');
cy.get('.sql-toolbar .Select')
.eq(0) // database select
.within(() => {
// note: we have to set force: true because the input is invisible / cypress throws
cy.get('input').type('main{enter}', { force: true });
});
cy.get('.sql-toolbar .Select')
.eq(1) // schema select
.within(() => {
cy.get('input').type('main{enter}', { force: true });
});
cy.get('.sql-toolbar .Select')
.eq(2) // table select
.within(() => {
cy.get('input').type('birth_names{enter}', { force: true });
});
cy.wait('@tableMetadata');
cy.get('.sql-toolbar .table-schema').should('have.length', 1);
selectResultsTab().should('have.length', 1);
// add another table and check for added schema + preview
cy.get('.sql-toolbar .Select')
.eq(2)
.within(() => {
cy.get('input').type('logs{enter}', { force: true });
});
cy.wait('@tableMetadata');
cy.get('.sql-toolbar .table-schema').should('have.length', 2);
selectResultsTab().should('have.length', 2);
});
});

View File

@@ -1,192 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { nanoid } from 'nanoid';
import { selectResultsTab, assertSQLLabResultsAreEqual } from './sqllab.helper';
function parseClockStr(node: JQuery) {
return Number.parseFloat(node.text().replace(/:/g, ''));
}
describe('SqlLab query panel', () => {
beforeEach(() => {
cy.visit('/sqllab');
});
it.skip('supports entering and running a query', () => {
// row limit has to be < ~10 for us to be able to determine how many rows
// are fetched below (because React _Virtualized_ does not render all rows)
let clockTime = 0;
cy.intercept({
method: 'POST',
url: '**/api/v1/sqllab/execute/',
}).as('mockSQLResponse');
cy.get('.TableSelector .Select:eq(0)').click();
cy.get('.TableSelector .Select:eq(0) input[type=text]').focus();
cy.focused().type('{enter}');
cy.get('#brace-editor textarea').focus();
cy.focused().clear();
cy.focused().type(`{selectall}{backspace}SELECT 1`);
cy.get('#js-sql-toolbar button:eq(0)').eq(0).click();
// wait for 300 milliseconds
cy.wait(300);
// started timer
cy.get('.sql-toolbar .label-success').then(node => {
clockTime = parseClockStr(node);
// should be longer than 0.2s
expect(clockTime).greaterThan(0.2);
});
cy.wait('@mockSQLResponse');
// timer is increasing
cy.get('.sql-toolbar .label-success').then(node => {
const newClockTime = parseClockStr(node);
expect(newClockTime).greaterThan(0.9);
clockTime = newClockTime;
});
// rerun the query
cy.get('#js-sql-toolbar button:eq(0)').eq(0).click();
// should restart the timer
cy.get('.sql-toolbar .label-success').contains('00:00:00');
cy.wait('@mockSQLResponse');
cy.get('.sql-toolbar .label-success').then(node => {
expect(parseClockStr(node)).greaterThan(0.9);
});
});
it.skip('successfully saves a query', () => {
cy.intercept('**/api/v1/database/**/tables/**').as('getTables');
const query =
'SELECT ds, gender, name, num FROM main.birth_names ORDER BY name LIMIT 3';
const savedQueryTitle = `CYPRESS TEST QUERY ${nanoid()}`;
// we will assert that the results of the query we save, and the saved query are the same
let initialResultsTable: HTMLElement | null = null;
let savedQueryResultsTable = null;
cy.get('#brace-editor textarea').clear({ force: true });
cy.get('#brace-editor textarea').type(`{selectall}{backspace}${query}`, {
force: true,
});
cy.get('#brace-editor textarea').focus(); // focus => blur is required for updating the query that is to be saved
cy.focused().blur();
// ctrl + r also runs query
cy.get('#brace-editor textarea').type('{ctrl}r', { force: true });
cy.wait('@sqlLabQuery');
// Save results to check against below
selectResultsTab().then(resultsA => {
initialResultsTable = resultsA[0];
});
cy.get('#js-sql-toolbar button')
.eq(1) // save query
.click();
// Enter name + save into modal
cy.get('.modal-sm input').clear({ force: true });
cy.get('.modal-sm input').type(`{selectall}{backspace}${savedQueryTitle}`, {
force: true,
});
cy.get('.modal-sm .modal-body button')
.eq(0) // save
.click();
// first row contains most recent link, follow back to SqlLab
cy.get('table tr:first-child a[href*="savedQueryId"').click();
// will timeout without explicitly waiting here
cy.wait(['@getSavedQuery', '@getTables']);
// run the saved query
cy.get('#js-sql-toolbar button')
.eq(0) // run query
.click();
cy.wait('@sqlLabQuery');
// assert the results of the saved query match the initial results
selectResultsTab().then(resultsB => {
savedQueryResultsTable = resultsB[0];
assertSQLLabResultsAreEqual(initialResultsTable, savedQueryResultsTable);
});
});
it.skip('Create a chart from a query', () => {
cy.intercept('**/api/v1/sqllab/execute/').as('queryFinished');
cy.intercept('**/api/v1/explore/**').as('explore');
cy.intercept('**/api/v1/chart/**').as('chart');
cy.intercept('**/tabstateview/**').as('tabstateview');
// cypress doesn't handle opening a new tab, override window.open to open in the same tab
cy.window().then(win => {
cy.stub(win, 'open', url => {
// eslint-disable-next-line no-param-reassign
win.location.href = url;
});
});
cy.wait('@tabstateview');
const query = 'SELECT gender, name FROM birth_names';
cy.get('.ace_text-input').focus();
cy.focused().clear({ force: true });
cy.focused().type(`{selectall}{backspace}${query}`, { force: true });
cy.get('.sql-toolbar button').contains('Run').click();
cy.wait('@queryFinished');
cy.get(
'.SouthPane .ant-tabs-content > .ant-tabs-tabpane-active > div button:first',
{ timeout: 10000 },
).click();
cy.wait('@explore');
cy.get('[data-test="datasource-control"] .title-select').contains(query);
cy.get('.column-option-label').first().contains('gender');
cy.get('.column-option-label').last().contains('name');
cy.get(
'[data-test="all_columns"] [data-test="dnd-labels-container"] > div:first-child',
).contains('gender');
cy.get(
'[data-test="all_columns"] [data-test="dnd-labels-container"] > div:nth-child(2)',
).contains('name');
cy.wait('@chart');
cy.get('[data-test="slice-container"] table > thead th')
.first()
.contains('gender');
cy.get('[data-test="slice-container"] table > thead th')
.last()
.contains('name');
});
});

View File

@@ -1,41 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export const selectResultsTab = () =>
cy.get('.SouthPane .ReactVirtualized__Table', { timeout: 10000 });
// this function asserts that the result set for two SQL lab table results are equal
export const assertSQLLabResultsAreEqual = (resultsA, resultsB) => {
const [headerA, bodyWrapperA] = resultsA.childNodes;
const bodyA = bodyWrapperA.childNodes[0];
const [headerB, bodyWrapperB] = resultsB.childNodes;
const bodyB = bodyWrapperB.childNodes[0];
expect(headerA.childNodes.length).to.equal(headerB.childNodes.length);
expect(bodyA.childNodes.length).to.equal(bodyB.childNodes.length);
bodyA.childNodes.forEach((rowA, rowIndex) => {
const rowB = bodyB.childNodes[rowIndex];
rowA.childNodes.forEach((cellA, columnIndex) => {
const cellB = rowB.childNodes[columnIndex];
expect(cellA.innerText).to.equal(cellB.innerText);
});
});
};

View File

@@ -1,113 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
describe('SqlLab query tabs', () => {
beforeEach(() => {
cy.visit('/sqllab');
});
const tablistSelector = '[data-test="sql-editor-tabs"] > [role="tablist"]';
const tabSelector = `${tablistSelector} [role="tab"]:not([type="button"])`;
it('allows you to create and close a tab', () => {
cy.get(tabSelector).then(tabs => {
const initialTabCount = tabs.length;
const initialUntitledCount = Math.max(
0,
...tabs
.map(
(i, tabItem) =>
Number(tabItem.textContent?.match(/Untitled Query (\d+)/)?.[1]) ||
0,
)
.toArray(),
);
// add two new tabs
cy.get('[data-test="add-tab-icon"]:visible:last').click({ force: true });
cy.contains('[role="tab"]', `Untitled Query ${initialUntitledCount + 1}`);
cy.get(tabSelector).should('have.length', initialTabCount + 1);
cy.get('[data-test="add-tab-icon"]:visible:last').click({ force: true });
cy.contains('[role="tab"]', `Untitled Query ${initialUntitledCount + 2}`);
cy.get(tabSelector).should('have.length', initialTabCount + 2);
// close the tabs
cy.get(`${tabSelector}:last [data-test="dropdown-trigger"]`).click({
force: true,
});
cy.get('[data-test="close-tab-menu-option"]').click();
cy.get(tabSelector).should('have.length', initialTabCount + 1);
cy.contains('[role="tab"]', `Untitled Query ${initialUntitledCount + 1}`);
cy.get(`${tablistSelector} [aria-label="remove"]:last`).click();
cy.get(tabSelector).should('have.length', initialTabCount);
});
});
it('opens a new tab by a button and a shortcut', () => {
const editorContent = '.ace_editor .ace_content';
const editorInput = '.ace_editor textarea';
const queryLimitSelector = '#js-sql-toolbar .limitDropdown';
cy.get(tabSelector).then(tabs => {
const initialTabCount = tabs.length;
const initialUntitledCount = Math.max(
0,
...tabs
.map(
(i, tabItem) =>
Number(tabItem.textContent?.match(/Untitled Query (\d+)/)?.[1]) ||
0,
)
.toArray(),
);
// configure some editor settings
cy.get(editorInput).type('some random query string', { force: true });
cy.get(queryLimitSelector).parent().click({ force: true });
cy.get('.ant-dropdown-menu')
.last()
.find('.ant-dropdown-menu-item')
.first()
.click({ force: true });
// open a new tab by a button
cy.get('[data-test="add-tab-icon"]:visible:last').click({ force: true });
cy.contains('[role="tab"]', `Untitled Query ${initialUntitledCount + 1}`);
cy.get(tabSelector).should('have.length', initialTabCount + 1);
cy.get(editorContent).contains('SELECT ...');
cy.get(queryLimitSelector).contains('10');
// close the tab
cy.get(`${tabSelector}:last [data-test="dropdown-trigger"]`).click({
force: true,
});
cy.get(`${tablistSelector} [aria-label="remove"]:last`).click({
force: true,
});
cy.get(tabSelector).should('have.length', initialTabCount);
// open a new tab by a shortcut
cy.get('body').type('{ctrl}t');
cy.get(tabSelector).should('have.length', initialTabCount + 1);
cy.contains('[role="tab"]', `Untitled Query ${initialUntitledCount + 1}`);
cy.get(editorContent).contains('SELECT ...');
cy.get(queryLimitSelector).contains('10');
});
});
});

File diff suppressed because it is too large Load Diff

View File

@@ -128,17 +128,17 @@
"@superset-ui/legacy-plugin-chart-chord": "file:./plugins/legacy-plugin-chart-chord",
"@superset-ui/legacy-plugin-chart-country-map": "file:./plugins/legacy-plugin-chart-country-map",
"@superset-ui/legacy-plugin-chart-horizon": "file:./plugins/legacy-plugin-chart-horizon",
"@superset-ui/legacy-plugin-chart-map-box": "file:./plugins/legacy-plugin-chart-map-box",
"@superset-ui/legacy-plugin-chart-paired-t-test": "file:./plugins/legacy-plugin-chart-paired-t-test",
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "file:./plugins/legacy-plugin-chart-parallel-coordinates",
"@superset-ui/legacy-plugin-chart-partition": "file:./plugins/legacy-plugin-chart-partition",
"@superset-ui/legacy-plugin-chart-rose": "file:./plugins/legacy-plugin-chart-rose",
"@superset-ui/legacy-plugin-chart-world-map": "file:./plugins/legacy-plugin-chart-world-map",
"@superset-ui/legacy-preset-chart-deckgl": "file:./plugins/legacy-preset-chart-deckgl",
"@superset-ui/preset-chart-deckgl": "file:./plugins/preset-chart-deckgl",
"@superset-ui/legacy-preset-chart-nvd3": "file:./plugins/legacy-preset-chart-nvd3",
"@superset-ui/plugin-chart-ag-grid-table": "file:./plugins/plugin-chart-ag-grid-table",
"@superset-ui/plugin-chart-cartodiagram": "file:./plugins/plugin-chart-cartodiagram",
"@superset-ui/plugin-chart-echarts": "file:./plugins/plugin-chart-echarts",
"@superset-ui/plugin-chart-point-cluster-map": "file:./plugins/plugin-chart-point-cluster-map",
"@superset-ui/plugin-chart-handlebars": "file:./plugins/plugin-chart-handlebars",
"@superset-ui/plugin-chart-pivot-table": "file:./plugins/plugin-chart-pivot-table",
"@superset-ui/plugin-chart-table": "file:./plugins/plugin-chart-table",
@@ -168,8 +168,8 @@
"echarts": "^5.6.0",
"fast-glob": "^3.3.2",
"fs-extra": "^11.3.4",
"fuse.js": "^7.1.0",
"geolib": "^3.3.4",
"fuse.js": "^7.3.0",
"geolib": "^3.3.14",
"geostyler": "^18.3.1",
"geostyler-data": "^1.1.0",
"geostyler-openlayers-parser": "^5.4.1",
@@ -184,7 +184,7 @@
"json-stringify-pretty-compact": "^2.0.0",
"lodash": "^4.18.1",
"mapbox-gl": "^3.20.0",
"markdown-to-jsx": "^9.7.13",
"markdown-to-jsx": "^9.7.15",
"match-sorter": "^8.2.0",
"memoize-one": "^5.2.1",
"mousetrap": "^1.6.5",
@@ -223,7 +223,7 @@
"redux-undo": "^1.0.0-beta9-9-7",
"rison": "^0.1.1",
"scroll-into-view-if-needed": "^3.1.0",
"simple-zstd": "^2.1.0",
"simple-zstd": "^1.4.2",
"stream-browserify": "^3.0.0",
"tinycolor2": "^1.4.2",
"urijs": "^1.19.8",
@@ -270,8 +270,8 @@
"@storybook/test": "^8.6.15",
"@storybook/test-runner": "^0.17.0",
"@svgr/webpack": "^8.1.0",
"@swc/core": "^1.15.21",
"@swc/plugin-emotion": "^14.7.0",
"@swc/core": "^1.15.24",
"@swc/plugin-emotion": "^14.8.0",
"@swc/plugin-transform-imports": "^12.5.0",
"@testing-library/dom": "^8.20.1",
"@testing-library/jest-dom": "^6.9.1",
@@ -284,7 +284,7 @@
"@types/js-levenshtein": "^1.1.3",
"@types/json-bigint": "^1.0.4",
"@types/mousetrap": "^1.6.15",
"@types/node": "^25.5.0",
"@types/node": "^25.6.0",
"@types/react": "^17.0.83",
"@types/react-dom": "^17.0.26",
"@types/react-loadable": "^5.5.11",
@@ -301,11 +301,11 @@
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"babel-jest": "^30.0.2",
"babel-loader": "^10.1.0",
"babel-loader": "^10.1.1",
"babel-plugin-dynamic-import-node": "^2.3.3",
"babel-plugin-jsx-remove-data-test-id": "^3.0.0",
"babel-plugin-lodash": "^3.3.4",
"baseline-browser-mapping": "^2.10.13",
"baseline-browser-mapping": "^2.10.16",
"cheerio": "1.2.0",
"concurrently": "^9.2.1",
"copy-webpack-plugin": "^14.0.0",
@@ -340,14 +340,14 @@
"jest-html-reporter": "^4.4.0",
"jest-websocket-mock": "^2.5.0",
"js-yaml-loader": "^1.2.2",
"jsdom": "^29.0.1",
"jsdom": "^29.0.2",
"lerna": "^9.0.4",
"lightningcss": "^1.32.0",
"mini-css-extract-plugin": "^2.10.2",
"open-cli": "^9.0.0",
"oxlint": "^1.56.0",
"po2json": "^0.4.5",
"prettier": "3.8.1",
"prettier": "3.8.2",
"prettier-plugin-packagejson": "^3.0.2",
"process": "^0.11.10",
"react-refresh": "^0.18.0",
@@ -367,8 +367,8 @@
"typescript": "5.4.5",
"unzipper": "^0.12.3",
"vm-browserify": "^1.1.2",
"wait-on": "^9.0.4",
"webpack": "^5.105.4",
"wait-on": "^9.0.5",
"webpack": "^5.106.0",
"webpack-bundle-analyzer": "^5.3.0",
"webpack-cli": "^6.0.1",
"webpack-dev-server": "^5.2.3",

View File

@@ -1,6 +1,6 @@
{
"name": "@apache-superset/core",
"version": "0.1.0-rc1",
"version": "0.1.0-rc2",
"description": "This package contains UI elements, APIs, and utility functions used by Superset.",
"sideEffects": false,
"main": "lib/index.js",
@@ -70,8 +70,8 @@
"files": [
"lib"
],
"author": "",
"license": "ISC",
"author": "Apache Software Foundation",
"license": "Apache-2.0",
"devDependencies": {
"@babel/cli": "^7.28.6",
"@babel/core": "^7.29.0",

View File

@@ -21,7 +21,11 @@ import { styled, css } from '@apache-superset/core/theme';
export const ControlSubSectionHeader = styled.div`
${({ theme }) => css`
font-weight: ${theme.fontWeightStrong};
margin-top: ${theme.sizeUnit * 3}px;
margin-bottom: ${theme.sizeUnit}px;
font-size: ${theme.fontSizeSM}px;
text-transform: uppercase;
letter-spacing: 0.05em;
color: ${theme.colorTextSecondary};
`}
`;

View File

@@ -76,7 +76,7 @@
"@types/d3-time-format": "^4.0.3",
"@types/jquery": "^3.5.33",
"@types/lodash": "^4.17.24",
"@types/node": "^25.5.0",
"@types/node": "^25.6.0",
"@types/prop-types": "^15.7.15",
"@types/react-syntax-highlighter": "^15.5.13",
"@types/react-table": "^7.7.20",

View File

@@ -41,6 +41,7 @@ export enum VizType {
LegacyBubble = 'bubble',
Line = 'echarts_timeseries_line',
MapBox = 'mapbox',
PointClusterMap = 'point_cluster_map',
MixedTimeseries = 'mixed_timeseries',
PairedTTest = 'paired_ttest',
ParallelCoordinates = 'para',

View File

@@ -319,6 +319,11 @@ export function AsyncAceEditor(
opacity: 0.5;
}
/* Style bracket matching to blend with theme */
.ace_editor .ace_bracket {
border-color: ${token.colorPrimaryBorderHover} !important;
}
/* Adjust cursor color */
.ace_editor .ace_cursor {
color: ${token.colorPrimaryText} !important;

View File

@@ -33,20 +33,22 @@ import type { PlaceholderProps } from './types';
function DefaultPlaceholder({
width,
height,
showLoadingForImport = false,
showLoadingForImport = true,
placeholderStyle: style,
}: PlaceholderProps) {
return (
// since `width` defaults to 100%, we can display the placeholder once
// height is specified.
(height && (
if (showLoadingForImport) {
return (
<div key="async-asm-placeholder" style={{ width, height, ...style }}>
{showLoadingForImport && <Loading position="floating" />}
<Loading position="floating" size="s" />
</div>
)) ||
// `|| null` is for in case of height=0.
null
);
);
}
if (height) {
return (
<div key="async-asm-placeholder" style={{ width, height, ...style }} />
);
}
return null;
}
/**

View File

@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { render, screen } from '../../spec';
import { render, screen, fireEvent } from '../../spec';
import CodeSyntaxHighlighter from './index';
// Simple mock that just returns the content
@@ -153,4 +153,44 @@ describe('CodeSyntaxHighlighter', () => {
expect(screen.getByText('SELECT * FROM users;')).toBeInTheDocument();
});
test('shows copy button by default', () => {
render(
<CodeSyntaxHighlighter language="sql">SELECT 1;</CodeSyntaxHighlighter>,
);
expect(screen.getByTitle('Copy to clipboard')).toBeInTheDocument();
});
test('hides copy button when showCopyButton is false', () => {
render(
<CodeSyntaxHighlighter language="sql" showCopyButton={false}>
SELECT 1;
</CodeSyntaxHighlighter>,
);
expect(screen.queryByTitle('Copy to clipboard')).not.toBeInTheDocument();
});
test('copy button does not throw when clipboard API is unavailable', () => {
const originalClipboard = navigator.clipboard;
Object.defineProperty(navigator, 'clipboard', {
value: undefined,
configurable: true,
});
document.execCommand = jest.fn().mockReturnValue(true);
render(
<CodeSyntaxHighlighter language="sql">SELECT 1;</CodeSyntaxHighlighter>,
);
expect(() =>
fireEvent.click(screen.getByTitle('Copy to clipboard')),
).not.toThrow();
Object.defineProperty(navigator, 'clipboard', {
value: originalClipboard,
configurable: true,
});
});
});

View File

@@ -16,11 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
import { useEffect, useState } from 'react';
import { useCallback, useEffect, useRef, useState } from 'react';
import SyntaxHighlighterBase from 'react-syntax-highlighter/dist/cjs/light';
import github from 'react-syntax-highlighter/dist/cjs/styles/hljs/github';
import tomorrow from 'react-syntax-highlighter/dist/cjs/styles/hljs/tomorrow-night';
import { isThemeDark, useTheme } from '@apache-superset/core/theme';
import { css, isThemeDark, useTheme } from '@apache-superset/core/theme';
import { t } from '@apache-superset/core/translation';
import copyTextToClipboard from '../../utils/copy';
import { Icons } from '../Icons';
export type SupportedLanguage = 'sql' | 'htmlbars' | 'markdown' | 'json';
@@ -31,6 +34,7 @@ export interface CodeSyntaxHighlighterProps {
showLineNumbers?: boolean;
wrapLines?: boolean;
style?: any; // Override theme style if needed
showCopyButton?: boolean;
}
// Track which languages have been registered to avoid duplicate registrations
@@ -76,11 +80,14 @@ export const CodeSyntaxHighlighter: React.FC<CodeSyntaxHighlighterProps> = ({
showLineNumbers = false,
wrapLines = true,
style: overrideStyle,
showCopyButton = true,
}) => {
const theme = useTheme();
const [isLanguageReady, setIsLanguageReady] = useState(
registeredLanguages.has(language),
);
const [copied, setCopied] = useState(false);
const copyTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
useEffect(() => {
const loadLanguage = async () => {
@@ -93,6 +100,21 @@ export const CodeSyntaxHighlighter: React.FC<CodeSyntaxHighlighterProps> = ({
loadLanguage();
}, [language]);
useEffect(
() => () => {
if (copyTimeoutRef.current) clearTimeout(copyTimeoutRef.current);
},
[],
);
const handleCopy = useCallback(() => {
copyTextToClipboard(() => Promise.resolve(children)).then(() => {
if (copyTimeoutRef.current) clearTimeout(copyTimeoutRef.current);
setCopied(true);
copyTimeoutRef.current = setTimeout(() => setCopied(false), 1500);
});
}, [children]);
const isDark = isThemeDark(theme);
const themeStyle = overrideStyle || (isDark ? tomorrow : github);
@@ -104,32 +126,79 @@ export const CodeSyntaxHighlighter: React.FC<CodeSyntaxHighlighterProps> = ({
...customStyle,
};
const copyButton = showCopyButton && (
<button
type="button"
onClick={(e: React.MouseEvent) => {
e.stopPropagation();
handleCopy();
}}
title={copied ? t('Copied!') : t('Copy to clipboard')}
css={css`
position: absolute;
top: ${theme.sizeUnit}px;
right: ${theme.sizeUnit}px;
background: none;
border: none;
cursor: pointer;
padding: ${theme.sizeUnit}px;
color: ${copied ? theme.colorSuccess : theme.colorTextSecondary};
line-height: 1;
border-radius: ${theme.borderRadius}px;
&:hover {
color: ${copied ? theme.colorSuccess : theme.colorText};
background: ${theme.colorBgTextHover};
}
`}
>
{copied ? (
<Icons.CheckOutlined style={{ fontSize: theme.fontSizeSM }} />
) : (
<Icons.CopyOutlined style={{ fontSize: theme.fontSizeSM }} />
)}
</button>
);
// Show a simple pre-formatted text while language is loading
if (!isLanguageReady) {
return (
<pre
style={{
...defaultCustomStyle,
fontFamily: 'monospace',
whiteSpace: 'pre-wrap',
margin: 0,
}}
<div
css={css`
position: relative;
`}
>
{children}
</pre>
{copyButton}
<pre
style={{
...defaultCustomStyle,
fontFamily: 'monospace',
whiteSpace: 'pre-wrap',
margin: 0,
}}
>
{children}
</pre>
</div>
);
}
return (
<SyntaxHighlighterBase
language={language}
style={themeStyle}
customStyle={defaultCustomStyle}
showLineNumbers={showLineNumbers}
wrapLines={wrapLines}
<div
css={css`
position: relative;
`}
>
{children}
</SyntaxHighlighterBase>
{copyButton}
<SyntaxHighlighterBase
language={language}
style={themeStyle}
customStyle={defaultCustomStyle}
showLineNumbers={showLineNumbers}
wrapLines={wrapLines}
>
{children}
</SyntaxHighlighterBase>
</div>
);
};

View File

@@ -17,10 +17,10 @@ specific language governing permissions and limitations
under the License.
-->
<svg viewBox="0 0 119 78" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="17" y="1" width="86" height="62" rx="3" stroke="currentColor" stroke-width="2"/>
<rect x="21" y="5" width="78" height="14" rx="3" stroke="currentColor" stroke-width="2"/>
<rect x="21" y="23" width="38" height="36" rx="3" stroke="currentColor" stroke-width="2"/>
<rect x="63" y="37" width="36" height="22" rx="3" stroke="currentColor" stroke-width="2"/>
<rect x="63" y="23" width="36" height="10" rx="3" stroke="currentColor" stroke-width="2"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M16 55.2892C6.07439 57.7013 0 60.9397 0 64.5C0 71.9559 26.6391 78 59.5 78C92.3609 78 119 71.9559 119 64.5C119 61.0609 113.332 57.9221 104 55.5383V60C104 62.2092 102.209 64 100 64H20C17.7909 64 16 62.2092 16 60V55.2892Z" fill="currentColor" fill-opacity="0.25" stroke="currentColor"/>
<path d="M99.3193 1H20.6639C19.0349 1 17.7143 2.32057 17.7143 3.94958V59.0084C17.7143 60.6374 19.0349 61.958 20.6639 61.958H99.3193C100.948 61.958 102.269 60.6374 102.269 59.0084V3.94958C102.269 2.32057 100.948 1 99.3193 1Z" stroke="currentColor" stroke-width="2"/>
<path d="M95.3866 4.93277H24.5966C22.9676 4.93277 21.647 6.25335 21.647 7.88235V15.7479C21.647 17.3769 22.9676 18.6975 24.5966 18.6975H95.3866C97.0156 18.6975 98.3361 17.3769 98.3361 15.7479V7.88235C98.3361 6.25335 97.0156 4.93277 95.3866 4.93277Z" stroke="currentColor" stroke-width="2"/>
<path d="M56.0588 22.6303H24.5966C22.9676 22.6303 21.647 23.9508 21.647 25.5798V55.0756C21.647 56.7046 22.9676 58.0252 24.5966 58.0252H56.0588C57.6878 58.0252 59.0084 56.7046 59.0084 55.0756V25.5798C59.0084 23.9508 57.6878 22.6303 56.0588 22.6303Z" stroke="currentColor" stroke-width="2"/>
<path d="M95.3865 36.395H65.8907C64.2617 36.395 62.9412 37.7155 62.9412 39.3445V55.0756C62.9412 56.7046 64.2617 58.0252 65.8907 58.0252H95.3865C97.0155 58.0252 98.3361 56.7046 98.3361 55.0756V39.3445C98.3361 37.7155 97.0155 36.395 95.3865 36.395Z" stroke="currentColor" stroke-width="2"/>
<path d="M95.3865 22.6303H65.8907C64.2617 22.6303 62.9412 23.9508 62.9412 25.5798V29.5126C62.9412 31.1416 64.2617 32.4622 65.8907 32.4622H95.3865C97.0155 32.4622 98.3361 31.1416 98.3361 29.5126V25.5798C98.3361 23.9508 97.0155 22.6303 95.3865 22.6303Z" stroke="currentColor" stroke-width="2"/>
<path d="M17.2227 59.0086C17.2228 60.9091 18.7637 62.45 20.6641 62.45H99.3193C101.22 62.45 102.761 60.9091 102.761 59.0086V53.9891L103.374 54.1453C107.981 55.3221 111.718 56.6931 114.315 58.2137C116.877 59.7134 118.491 61.4572 118.491 63.4324C118.491 64.5056 118.01 65.513 117.177 66.4373C116.346 67.3587 115.143 68.2232 113.635 69.032C110.618 70.6501 106.286 72.0925 100.975 73.2977C90.343 75.7099 75.6797 77.1971 59.5 77.1971C43.3203 77.1971 28.657 75.7099 18.0254 73.2977C12.7137 72.0925 8.38162 70.6501 5.36523 69.032C3.85742 68.2232 2.65424 67.3587 1.82324 66.4373C0.989641 65.513 0.508789 64.5056 0.508789 63.4324C0.508977 61.389 2.23587 59.5926 4.96484 58.0535C7.73449 56.4916 11.717 55.0896 16.6152 53.8992L17.2227 53.7518V59.0086Z" fill="currentColor" fill-opacity="0.25" stroke="currentColor"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -17,6 +17,6 @@ specific language governing permissions and limitations
under the License.
-->
<svg viewBox="0 0 119 76" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M83.1952 1.36598L103 24V62C103 64.2091 101.209 66 99 66H20C17.7909 66 16 64.2091 16 62V24L35.8048 1.36598C36.5643 0.497921 37.6616 0 38.8151 0H80.1849C81.3384 0 82.4357 0.497922 83.1952 1.36598ZM101 26V62C101 63.1046 100.105 64 99 64H20C18.8954 64 18 63.1046 18 62V26H35.25C37.8734 26 40 28.1266 40 30.75C40 34.4779 43.0221 37.5 46.75 37.5H72.25C75.9779 37.5 79 34.4779 79 30.75C79 28.1266 81.1266 26 83.75 26H101ZM100.342 24L81.6901 2.68299C81.3103 2.24896 80.7617 2 80.1849 2H38.8151C38.2383 2 37.6897 2.24896 37.3099 2.68299L18.6575 24H35.25C38.9779 24 42 27.0221 42 30.75C42 33.3734 44.1266 35.5 46.75 35.5H72.25C74.8734 35.5 77 33.3734 77 30.75C77 27.0221 80.0221 24 83.75 24H100.342Z" fill="currentColor"/>
<path d="M16 53.2891C6.07439 55.7012 0 58.9396 0 62.4999C0 69.9557 26.6391 75.9999 59.5 75.9999C92.3609 75.9999 119 69.9557 119 62.4999C119 58.9396 112.926 55.7012 103 53.2891V61.9999C103 64.209 101.209 65.9999 99 65.9999H20C17.7909 65.9999 16 64.209 16 61.9999V53.2891Z" fill="currentColor" stroke="currentColor" fill-opacity="0.25" />
<path fill-rule="evenodd" clip-rule="evenodd" d="M82.7969 1.34302L102.269 23.5966V60.958C102.269 63.13 100.508 64.8908 98.3361 64.8908H20.6639C18.4919 64.8908 16.7311 63.13 16.7311 60.958V23.5966L36.203 1.34302C36.9498 0.489553 38.0286 0 39.1627 0H79.8372C80.9713 0 82.0502 0.489554 82.7969 1.34302ZM100.303 25.563V60.958C100.303 62.044 99.4225 62.9244 98.3361 62.9244H20.6639C19.5778 62.9244 18.6975 62.044 18.6975 60.958V25.563H35.6575C38.2369 25.563 40.3277 27.6539 40.3277 30.2332C40.3277 33.8984 43.299 36.8698 46.9643 36.8698H72.0357C75.7009 36.8698 78.6723 33.8984 78.6723 30.2332C78.6723 27.6539 80.7631 25.563 83.3424 25.563H100.303ZM99.6556 23.5966L81.3171 2.6379C80.9437 2.21116 80.4043 1.96639 79.8372 1.96639H39.1627C38.5956 1.96639 38.0562 2.21116 37.6828 2.6379L19.3439 23.5966H35.6575C39.3228 23.5966 42.2941 26.568 42.2941 30.2332C42.2941 32.8125 44.385 34.9034 46.9643 34.9034H72.0357C74.615 34.9034 76.7059 32.8125 76.7059 30.2332C76.7059 26.568 79.6772 23.5966 83.3424 23.5966H99.6556Z" fill="currentColor"/>
<path d="M102.385 51.9159C107.283 53.1063 111.266 54.5083 114.035 56.0702C116.764 57.6093 118.491 59.4058 118.491 61.4492C118.491 62.5223 118.01 63.5298 117.177 64.454C116.346 65.3754 115.143 66.2399 113.635 67.0488C110.618 68.6668 106.286 70.1092 100.975 71.3144C90.343 73.7266 75.6797 75.2138 59.5 75.2138C43.3203 75.2138 28.657 73.7266 18.0254 71.3144C12.7137 70.1092 8.38162 68.6668 5.36523 67.0488C3.85743 66.2399 2.65424 65.3754 1.82324 64.454C0.989642 63.5298 0.508789 62.5223 0.508789 61.4492C0.508976 59.4057 2.23587 57.6093 4.96484 56.0702C7.73449 54.5083 11.717 53.1063 16.6152 51.9159L17.2227 51.7685V60.9579C17.2227 62.8584 18.7636 64.3993 20.6641 64.3993H98.3359C100.236 64.3993 101.777 62.8584 101.777 60.9579V51.7685L102.385 51.9159Z" fill="currentColor" stroke="currentColor" fill-opacity="0.25" />
</svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -17,6 +17,6 @@ specific language governing permissions and limitations
under the License.
-->
<svg viewBox="0 0 119 78" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M59.2123 1.55857C59.4575 0.81382 60.5425 0.813801 60.7878 1.55857L67.5616 22.1322C67.9434 23.292 69.0328 24.0653 70.249 24.0653L92.1695 24.0653C92.9982 24.0653 93.2777 25.0719 92.6607 25.5143L74.9266 38.2295C73.9348 38.9406 73.5131 40.2085 73.8958 41.3707L80.6696 61.9444C80.8987 62.6402 80.076 63.3262 79.3906 62.8348L61.6566 50.1196C60.6679 49.4107 59.3321 49.4107 58.3434 50.1196L40.6094 62.8348C39.924 63.3262 39.1013 62.6402 39.3304 61.9444L46.1042 41.3707C46.4869 40.2085 46.0652 38.9406 45.0734 38.2295L27.3393 25.5143C26.7223 25.0719 27.0018 24.0653 27.8305 24.0653L49.751 24.0653C50.9672 24.0653 52.0566 23.292 52.4384 22.1322L59.2123 1.55857Z" stroke="currentColor" stroke-width="2"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M41.6782 51.616C17.5239 53.3343 0 58.4528 0 64.5C0 71.9558 26.6391 78 59.5 78C92.3609 78 119 71.9558 119 64.5C119 58.5387 101.97 53.4798 78.3466 51.6913L81.6194 61.6317C82.1664 63.2928 80.2398 64.6741 78.808 63.6475L61.1757 51.0053C60.619 51.0018 60.0604 51 59.5 51C59.2765 51 59.0534 51.0003 58.8305 51.0008L41.192 63.6475C39.7602 64.6741 37.8337 63.2928 38.3806 61.6317L41.6782 51.616Z" fill="currentColor" fill-opacity="0.25" stroke="currentColor"/>
<path d="M59.2172 1.54918C59.4582 0.816949 60.525 0.81693 60.7662 1.54918L67.4261 21.777C67.8015 22.9173 68.8726 23.6776 70.0684 23.6776H91.6205C92.4352 23.6776 92.71 24.6673 92.1034 25.1023L74.6673 37.6038C73.6922 38.3029 73.2776 39.5495 73.6539 40.6922L80.3138 60.9201C80.5391 61.6042 79.7302 62.2787 79.0563 61.7956L61.6204 49.2941C60.6483 48.5971 59.3349 48.5971 58.3629 49.2941L40.9269 61.7956C40.253 62.2787 39.4441 61.6042 39.6694 60.9201L46.3294 40.6922C46.7056 39.5495 46.291 38.3029 45.3159 37.6038L27.8798 25.1023C27.2732 24.6673 27.548 23.6776 28.3628 23.6776H49.9149C51.1106 23.6776 52.1817 22.9173 52.5571 21.777L59.2172 1.54918Z" stroke="currentColor" stroke-width="2"/>
<path d="M59.5 49.6685C60.052 49.6685 60.6021 49.6699 61.1504 49.6733L61.3066 49.6743L61.4336 49.7651L78.7695 62.1948C79.8103 62.9411 81.1618 61.9247 80.7803 60.7661L77.5625 50.9927L77.333 50.2935L78.0674 50.3491C89.7005 51.2299 99.7327 52.9176 106.87 55.1284C110.435 56.2328 113.307 57.4759 115.298 58.8335C117.27 60.1787 118.491 61.7173 118.491 63.4331C118.491 64.5061 118.01 65.5129 117.177 66.437C116.346 67.3584 115.143 68.2239 113.635 69.0327C110.618 70.6507 106.286 72.0922 100.975 73.2974C90.343 75.7096 75.6797 77.1978 59.5 77.1978C43.3203 77.1978 28.657 75.7096 18.0254 73.2974C12.7139 72.0922 8.3816 70.6507 5.36523 69.0327C3.85739 68.2239 2.65424 67.3584 1.82324 66.437C0.989783 65.5129 0.508887 64.5061 0.508789 63.4331C0.508789 61.6928 1.7644 60.135 3.78906 58.7749C5.83338 57.4017 8.78191 56.1452 12.4404 55.0327C19.7642 52.8057 30.0482 51.1211 41.9424 50.2749L42.6738 50.2231L42.4443 50.9194L39.2021 60.7661C38.8207 61.9247 40.1722 62.9409 41.2129 62.1948L58.5557 49.7612L58.6836 49.6694L58.8408 49.6685C59.0602 49.668 59.2799 49.6685 59.5 49.6685Z" fill="currentColor" fill-opacity="0.25" stroke="currentColor"/>
</svg>

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -115,6 +115,7 @@ import {
PlusSquareOutlined,
PlusOutlined,
ProfileOutlined,
PushpinFilled,
PushpinOutlined,
QuestionCircleOutlined,
ReloadOutlined,
@@ -270,6 +271,7 @@ const AntdIcons = {
PlusSquareOutlined,
PlusOutlined,
ProfileOutlined,
PushpinFilled,
PushpinOutlined,
ReloadOutlined,
QuestionCircleOutlined,

View File

@@ -25,6 +25,7 @@ import {
waitFor,
within,
} from '@superset-ui/core/spec';
import { formatNumber } from '@superset-ui/core';
import { Select } from '.';
type Option = {
@@ -85,8 +86,10 @@ const getElementsByClassName = (className: string) =>
const getSelect = () =>
screen.getByRole('combobox', { name: new RegExp(ARIA_LABEL, 'i') });
const selectAllButtonText = (length: number) => `Select all (${length})`;
const deselectAllButtonText = (length: number) => `Clear (${length})`;
const selectAllButtonText = (length: number) =>
`Select all (${formatNumber('SMART_NUMBER', length)})`;
const deselectAllButtonText = (length: number) =>
`Clear (${formatNumber('SMART_NUMBER', length)})`;
const findSelectOption = (text: string) =>
waitFor(() =>
@@ -811,6 +814,62 @@ test('Maintains stable maxTagCount to prevent click target disappearing in oneLi
expect(withinSelector.getByText('+ 2 ...')).toBeVisible();
});
test('dropdown width matches input width after tags collapse in oneLine mode', async () => {
render(
<div style={{ width: '300px' }}>
<Select
{...defaultProps}
value={[OPTIONS[0], OPTIONS[1], OPTIONS[2]]}
mode="multiple"
oneLine
/>
</div>,
);
await open();
// Wait for RAF to complete and tags to collapse
await waitFor(() => {
const withinSelector = within(
getElementByClassName('.ant-select-selector'),
);
expect(
withinSelector.queryByText(OPTIONS[0].label),
).not.toBeInTheDocument();
expect(withinSelector.getByText('+ 3 ...')).toBeVisible();
});
const selectElement = document.querySelector('.ant-select') as HTMLElement;
expect(selectElement).toBeInTheDocument();
// Mock the select element's width since JSDOM doesn't perform real layout
jest.spyOn(selectElement, 'getBoundingClientRect').mockReturnValue({
width: 300,
height: 32,
top: 0,
left: 0,
right: 300,
bottom: 32,
x: 0,
y: 0,
toJSON: () => ({}),
} as DOMRect);
// Close and reopen to trigger width measurement with mocked value
await type('{esc}');
await open();
const dropdown = document.querySelector(
'.ant-select-dropdown',
) as HTMLElement;
expect(dropdown).toBeInTheDocument();
// Verify the dropdown has inline width matching the mocked select width
await waitFor(() => {
expect(parseInt(dropdown.style.width, 10)).toBe(300);
});
});
test('does not render "Select all" when there are 0 or 1 options', async () => {
const { rerender } = render(
<Select {...defaultProps} options={[]} mode="multiple" allowNewOptions />,
@@ -915,6 +974,17 @@ test('"Select all" does not affect disabled options', async () => {
expect(await findSelectValue()).not.toHaveTextContent(options[1].label);
});
test('abbreviates large numbers in bulk action buttons', async () => {
const manyOptions = Array.from({ length: 1500 }, (_, i) => ({
label: `Option ${i}`,
value: i,
}));
render(<Select {...defaultProps} mode="multiple" options={manyOptions} />);
await open();
// SMART_NUMBER format uses lowercase 'k' for thousands (d3-format)
expect(await screen.findByText('Select all (1.5k)')).toBeInTheDocument();
});
test('dropdown takes full width of the select input for multi select', async () => {
render(
<div style={{ width: '400px' }}>

View File

@@ -31,7 +31,7 @@ import {
} from 'react';
import { t } from '@apache-superset/core/translation';
import { ensureIsArray, usePrevious } from '@superset-ui/core';
import { ensureIsArray, formatNumber, usePrevious } from '@superset-ui/core';
import { Constants } from '@superset-ui/core/components';
import {
LabeledValue as AntdLabeledValue,
@@ -149,6 +149,8 @@ const Select = forwardRef(
// Prevent maxTagCount change during click events to avoid click target disappearing
const [stableMaxTagCount, setStableMaxTagCount] = useState(maxTagCount);
const isOpeningRef = useRef(false);
const selectContainerRef = useRef<HTMLDivElement>(null);
const [dropdownWidth, setDropdownWidth] = useState<number | true>(true);
useEffect(() => {
if (oneLine) {
@@ -159,12 +161,23 @@ const Select = forwardRef(
requestAnimationFrame(() => {
setStableMaxTagCount(0);
isOpeningRef.current = false;
// Measure collapsed width and update dropdown width
const selectElement =
selectContainerRef.current?.querySelector('.ant-select');
if (selectElement) {
const { width } = selectElement.getBoundingClientRect();
if (width > 0) {
setDropdownWidth(width);
}
}
});
return;
}
if (!isDropdownVisible) {
// When closing, immediately show the first tag
setStableMaxTagCount(1);
setDropdownWidth(true); // Reset to default when closing
isOpeningRef.current = false;
}
return;
@@ -494,7 +507,7 @@ const Select = forwardRef(
const bulkSelectComponent = useMemo(
() => (
<StyledBulkActionsContainer justify="center">
<StyledBulkActionsContainer justify="space-between">
<Button
type="link"
buttonStyle="link"
@@ -506,7 +519,7 @@ const Select = forwardRef(
handleSelectAll();
}}
>
{`${t('Select all')} (${bulkSelectCounts.selectable})`}
{`${t('Select all')} (${formatNumber('SMART_NUMBER', bulkSelectCounts.selectable)})`}
</Button>
<Button
type="link"
@@ -523,7 +536,7 @@ const Select = forwardRef(
handleDeselectAll();
}}
>
{`${t('Clear')} (${bulkSelectCounts.deselectable})`}
{`${t('Clear')} (${formatNumber('SMART_NUMBER', bulkSelectCounts.deselectable)})`}
</Button>
</StyledBulkActionsContainer>
),
@@ -717,7 +730,11 @@ const Select = forwardRef(
};
return (
<StyledContainer className={className} headerPosition={headerPosition}>
<StyledContainer
ref={selectContainerRef}
className={className}
headerPosition={headerPosition}
>
{header && (
<StyledHeader headerPosition={headerPosition}>{header}</StyledHeader>
)}
@@ -777,7 +794,7 @@ const Select = forwardRef(
options={visibleOptions}
optionRender={option => <Space>{option.label || option.value}</Space>}
oneLine={oneLine}
popupMatchSelectWidth
popupMatchSelectWidth={oneLine ? dropdownWidth : true}
css={props.css}
dropdownAlign={DROPDOWN_ALIGN_BOTTOM}
{...props}

View File

@@ -140,11 +140,17 @@ export const StyledErrorMessage = styled.div`
export const StyledBulkActionsContainer = styled(Flex)`
${({ theme }) => `
padding: ${theme.sizeUnit}px;
padding: ${theme.sizeUnit}px 0;
border-top: 1px solid ${theme.colorSplit};
gap: ${theme.sizeUnit * 2}px;
& .superset-button {
font-family: inherit;
margin-left: 0 !important;
}
& .superset-button:first-of-type {
padding-right: 0 !important;
}
& .superset-button:last-of-type {
padding-left: 0 !important;
}
`}
`;

View File

@@ -158,11 +158,13 @@ test('passes all props through to AgGridReact', () => {
/>,
);
// onGridReady and onFirstDataRendered are intercepted by the component to expose
// the grid API on the container element; the wrapped function is passed instead.
expect(AgGridReact).toHaveBeenCalledWith(
expect.objectContaining({
rowData: mockRowData,
columnDefs: mockColumnDefs,
onGridReady,
onGridReady: expect.any(Function),
onCellClicked,
pagination: true,
paginationPageSize: 10,
@@ -171,6 +173,47 @@ test('passes all props through to AgGridReact', () => {
);
});
test('onGridReady wrapper calls user callback and exposes api on container', () => {
const onGridReady = jest.fn();
render(
<ThemedAgGridReact
rowData={mockRowData}
columnDefs={mockColumnDefs}
onGridReady={onGridReady}
/>,
);
// Retrieve the wrapped handler that was passed to AgGridReact
const lastCall = (AgGridReact as jest.Mock).mock.calls.at(-1)[0];
const wrappedOnGridReady = lastCall.onGridReady as Function;
const mockApi = { setGridOption: jest.fn() };
wrappedOnGridReady({ api: mockApi });
// The user-provided callback must be forwarded
expect(onGridReady).toHaveBeenCalledWith({ api: mockApi });
});
test('onFirstDataRendered wrapper calls user callback', () => {
const onFirstDataRendered = jest.fn();
render(
<ThemedAgGridReact
rowData={mockRowData}
columnDefs={mockColumnDefs}
onFirstDataRendered={onFirstDataRendered}
/>,
);
const lastCall = (AgGridReact as jest.Mock).mock.calls.at(-1)[0];
const wrappedOnFirstDataRendered = lastCall.onFirstDataRendered as Function;
wrappedOnFirstDataRendered({ firstRow: 0 });
expect(onFirstDataRendered).toHaveBeenCalledWith({ firstRow: 0 });
});
test('applies custom theme colors from Superset theme', () => {
const customTheme = {
...supersetTheme,

View File

@@ -16,19 +16,28 @@
* specific language governing permissions and limitations
* under the License.
*/
import { useMemo, forwardRef } from 'react';
import { useMemo, useRef, useCallback, forwardRef } from 'react';
import { css } from '@emotion/react';
import { AgGridReact, type AgGridReactProps } from 'ag-grid-react';
import {
themeQuartz,
colorSchemeDark,
colorSchemeLight,
type GridApi,
type GridReadyEvent,
type FirstDataRenderedEvent,
} from 'ag-grid-community';
import { useTheme, useThemeMode } from '@apache-superset/core/theme';
// Note: With ag-grid v34's new theming API, CSS files are injected automatically
// Do NOT import 'ag-grid-community/styles/ag-grid.css' or theme CSS files
// Extends HTMLDivElement with ag-grid state attached to the container for downloadAsImage.
export interface AgGridContainerElement extends HTMLDivElement {
_agGridApi?: GridApi;
_agGridFirstDataRendered?: boolean;
}
export interface ThemedAgGridReactProps extends AgGridReactProps {
/**
* Optional theme parameter overrides to customize specific ag-grid theme values.
@@ -71,9 +80,13 @@ export interface ThemedAgGridReactProps extends AgGridReactProps {
export const ThemedAgGridReact = forwardRef<
AgGridReact,
ThemedAgGridReactProps
>(function ThemedAgGridReact({ themeOverrides, ...props }, ref) {
>(function ThemedAgGridReact(
{ themeOverrides, onGridReady, onFirstDataRendered, ...props },
ref,
) {
const theme = useTheme();
const isDarkMode = useThemeMode();
const containerRef = useRef<AgGridContainerElement>(null);
// Get the appropriate ag-grid theme based on dark/light mode
const agGridTheme = useMemo(() => {
@@ -140,8 +153,32 @@ export const ThemedAgGridReact = forwardRef<
return baseTheme.withParams(finalParams);
}, [theme, isDarkMode, themeOverrides]);
// Expose gridApi and first-data-rendered flag on the container for downloadAsImage.
const handleGridReady = useCallback(
(event: GridReadyEvent) => {
if (containerRef.current) {
containerRef.current._agGridFirstDataRendered = false;
containerRef.current._agGridApi = event.api;
}
onGridReady?.(event);
},
[onGridReady],
);
// Mark the container once rows are painted so downloadAsImage can gate on readiness.
const handleFirstDataRendered = useCallback(
(event: FirstDataRenderedEvent) => {
if (containerRef.current) {
containerRef.current._agGridFirstDataRendered = true;
}
onFirstDataRendered?.(event);
},
[onFirstDataRendered],
);
return (
<div
ref={containerRef}
css={css`
width: 100%;
height: 100%;
@@ -151,7 +188,13 @@ export const ThemedAgGridReact = forwardRef<
`}
data-themed-ag-grid="true"
>
<AgGridReact ref={ref} theme={agGridTheme} {...props} />
<AgGridReact
ref={ref}
theme={agGridTheme}
onGridReady={handleGridReady}
onFirstDataRendered={handleFirstDataRendered}
{...props}
/>
</div>
);
});
@@ -171,6 +214,7 @@ export type {
CellClassParams,
IMenuActionParams,
IHeaderParams,
SelectionChangedEvent,
SortModelItem,
ValueFormatterParams,
ValueGetterParams,

View File

@@ -201,6 +201,7 @@ export * from './Result';
export {
ThemedAgGridReact,
type ThemedAgGridReactProps,
type AgGridContainerElement,
setupAGGridModules,
defaultModules,
} from './ThemedAgGridReact';

View File

@@ -0,0 +1,98 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
const isSafari = (): boolean => {
const { userAgent } = navigator;
return Boolean(userAgent && /^((?!chrome|android).)*safari/i.test(userAgent));
};
// Use the new Clipboard API if the browser supports it
const copyTextWithClipboardApi = async (getText: () => Promise<string>) => {
// Safari (WebKit) does not support delayed generation of clipboard.
// This means that writing to the clipboard, from the moment the user
// interacts with the app, must be instantaneous.
// However, neither writeText nor write accepts a Promise, so
// we need to create a ClipboardItem that accepts said Promise to
// delay the text generation, as needed.
// Source: https://bugs.webkit.org/show_bug.cgi?id=222262P
if (isSafari()) {
try {
const clipboardItem = new ClipboardItem({
'text/plain': getText(),
});
await navigator.clipboard.write([clipboardItem]);
} catch {
// Fallback to default clipboard API implementation
const text = await getText();
await navigator.clipboard.writeText(text);
}
} else {
// For Blink, the above method won't work, but we can use the
// default (intended) API, since the delayed generation of the
// clipboard is now supported.
// Source: https://bugs.chromium.org/p/chromium/issues/detail?id=1014310
const text = await getText();
await navigator.clipboard.writeText(text);
}
};
const copyTextToClipboard = (getText: () => Promise<string>) =>
copyTextWithClipboardApi(getText)
// If the Clipboard API is not supported, fallback to the older method.
.catch(() =>
getText().then(
text =>
new Promise<void>((resolve, reject) => {
const selection: Selection | null = document.getSelection();
if (selection) {
selection.removeAllRanges();
const range = document.createRange();
const span = document.createElement('span');
span.textContent = text;
span.style.position = 'fixed';
span.style.top = '0';
span.style.clip = 'rect(0, 0, 0, 0)';
span.style.whiteSpace = 'pre';
document.body.appendChild(span);
range.selectNode(span);
selection.addRange(range);
try {
if (!document.execCommand('copy')) {
reject();
}
} catch (err) {
reject();
}
document.body.removeChild(span);
if (selection.removeRange) {
selection.removeRange(range);
} else {
selection.removeAllRanges();
}
}
resolve();
}),
),
);
export default copyTextToClipboard;

View File

@@ -17,6 +17,7 @@
* under the License.
*/
export { default as convertKeysToCamelCase } from './convertKeysToCamelCase';
export { default as copyTextToClipboard } from './copy';
export { default as ensureIsArray } from './ensureIsArray';
export { default as ensureIsInt } from './ensureIsInt';
export { default as isDefined } from './isDefined';

View File

@@ -0,0 +1,210 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { copyTextToClipboard } from '@superset-ui/core';
const SAFARI_UA =
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15';
const CHROME_UA =
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36';
const makeGetText = (text: string) => () => Promise.resolve(text);
const globalWithClipboardItem = global as unknown as { ClipboardItem?: unknown };
afterEach(() => {
jest.restoreAllMocks();
delete globalWithClipboardItem.ClipboardItem;
});
test('uses Clipboard API writeText on non-Safari browsers', async () => {
Object.defineProperty(navigator, 'userAgent', {
value: CHROME_UA,
configurable: true,
});
const writeText = jest.fn().mockResolvedValue(undefined);
Object.defineProperty(navigator, 'clipboard', {
value: { writeText },
configurable: true,
});
await copyTextToClipboard(makeGetText('hello'));
expect(writeText).toHaveBeenCalledWith('hello');
});
test('uses ClipboardItem API on Safari browsers', async () => {
Object.defineProperty(navigator, 'userAgent', {
value: SAFARI_UA,
configurable: true,
});
const write = jest.fn().mockResolvedValue(undefined);
Object.defineProperty(navigator, 'clipboard', {
value: { write },
configurable: true,
});
const MockClipboardItem = jest.fn().mockImplementation(data => ({ data }));
globalWithClipboardItem.ClipboardItem = MockClipboardItem;
await copyTextToClipboard(makeGetText('safari text'));
expect(MockClipboardItem).toHaveBeenCalled();
expect(write).toHaveBeenCalledWith([expect.anything()]);
});
test('falls back to writeText on Safari when ClipboardItem write fails', async () => {
Object.defineProperty(navigator, 'userAgent', {
value: SAFARI_UA,
configurable: true,
});
const writeText = jest.fn().mockResolvedValue(undefined);
const write = jest.fn().mockRejectedValue(new Error('not supported'));
Object.defineProperty(navigator, 'clipboard', {
value: { write, writeText },
configurable: true,
});
const MockClipboardItem = jest.fn().mockImplementation(data => ({ data }));
globalWithClipboardItem.ClipboardItem = MockClipboardItem;
await copyTextToClipboard(makeGetText('fallback text'));
expect(writeText).toHaveBeenCalledWith('fallback text');
});
function mockExecCommand(impl: (cmd: string) => boolean) {
Object.defineProperty(document, 'execCommand', {
value: jest.fn().mockImplementation(impl),
configurable: true,
writable: true,
});
}
function setupFallbackMocks(options: {
selection: Partial<Selection> | null;
}) {
Object.defineProperty(navigator, 'userAgent', {
value: CHROME_UA,
configurable: true,
});
Object.defineProperty(navigator, 'clipboard', {
value: {
writeText: jest.fn().mockRejectedValue(new Error('not allowed')),
},
configurable: true,
});
const mockRange = { selectNode: jest.fn() };
const mockSpan = {
style: {} as CSSStyleDeclaration,
textContent: '',
} as unknown as HTMLSpanElement;
jest
.spyOn(document, 'getSelection')
.mockReturnValue(options.selection as Selection | null);
jest.spyOn(document, 'createRange').mockReturnValue(mockRange as unknown as Range);
jest.spyOn(document, 'createElement').mockReturnValue(mockSpan);
jest.spyOn(document.body, 'appendChild').mockImplementation(() => mockSpan);
jest.spyOn(document.body, 'removeChild').mockImplementation(() => mockSpan);
return { mockRange, mockSpan };
}
test('falls back to execCommand copy when Clipboard API is unavailable', async () => {
const removeRange = jest.fn();
const { mockRange } = setupFallbackMocks({
selection: {
removeAllRanges: jest.fn(),
addRange: jest.fn(),
removeRange,
},
});
mockExecCommand(cmd => cmd === 'copy');
await copyTextToClipboard(makeGetText('exec text'));
expect(document.execCommand).toHaveBeenCalledWith('copy');
expect(removeRange).toHaveBeenCalledWith(mockRange);
});
test('falls back to removeAllRanges when removeRange is not available', async () => {
const removeAllRanges = jest.fn();
setupFallbackMocks({
selection: {
removeAllRanges,
addRange: jest.fn(),
removeRange: undefined,
},
});
mockExecCommand(cmd => cmd === 'copy');
await copyTextToClipboard(makeGetText('no removeRange'));
expect(removeAllRanges).toHaveBeenCalled();
});
test('rejects when execCommand returns false', async () => {
setupFallbackMocks({
selection: {
removeAllRanges: jest.fn(),
addRange: jest.fn(),
removeRange: jest.fn(),
},
});
mockExecCommand(() => false);
await expect(copyTextToClipboard(makeGetText('fail'))).rejects.toBeUndefined();
});
test('rejects when execCommand throws', async () => {
setupFallbackMocks({
selection: {
removeAllRanges: jest.fn(),
addRange: jest.fn(),
removeRange: jest.fn(),
},
});
Object.defineProperty(document, 'execCommand', {
value: jest.fn().mockImplementation(() => {
throw new Error('execCommand error');
}),
configurable: true,
writable: true,
});
await expect(copyTextToClipboard(makeGetText('throw'))).rejects.toBeUndefined();
});
test('resolves without copying when getSelection returns null', async () => {
Object.defineProperty(navigator, 'userAgent', {
value: CHROME_UA,
configurable: true,
});
Object.defineProperty(navigator, 'clipboard', {
value: {
writeText: jest.fn().mockRejectedValue(new Error('not allowed')),
},
configurable: true,
});
jest.spyOn(document, 'getSelection').mockReturnValue(null);
await expect(
copyTextToClipboard(makeGetText('no selection')),
).resolves.toBeUndefined();
});

View File

@@ -94,6 +94,7 @@ export default defineConfig({
name: 'chromium',
testIgnore: [
'**/tests/auth/**/*.spec.ts',
'**/tests/sqllab/**/*.spec.ts',
...(process.env.INCLUDE_EXPERIMENTAL ? [] : ['**/experimental/**']),
],
use: {
@@ -103,6 +104,22 @@ export default defineConfig({
storageState: 'playwright/.auth/user.json',
},
},
{
// SQL Lab needs its own project because tab state is stored server-side
// per user (/tabstateview/*). All workers share the same auth user, so
// parallel workers mutating tabs would cause nondeterministic tab counts
// and cross-worker tab deletions. Other test suites (dataset, dashboard,
// chart) don't need this because they create/delete isolated resources
// via API with unique names — no shared mutable state between tests.
name: 'chromium-sqllab',
testMatch: '**/tests/sqllab/**/*.spec.ts',
fullyParallel: false,
use: {
browserName: 'chromium',
testIdAttribute: 'data-test',
storageState: 'playwright/.auth/user.json',
},
},
{
// Separate project for unauthenticated tests (login, signup, etc.)
// These tests use beforeEach for per-test navigation - no global auth

View File

@@ -0,0 +1,85 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { Locator, Page } from '@playwright/test';
const AG_GRID_SELECTORS = {
ROOT: '[role="grid"]',
HEADER_ROW: '.ag-header-row',
HEADER_CELL: '.ag-header-cell',
BODY_ROW: '.ag-row',
CELL: '.ag-cell',
} as const;
/**
* AG Grid component wrapper for Playwright.
* Used by FilterableTable/GridTable in SQL Lab results and elsewhere.
*/
export class AgGrid {
readonly page: Page;
private readonly locator: Locator;
constructor(page: Page, locator: Locator) {
this.page = page;
this.locator = locator;
}
get element(): Locator {
return this.locator;
}
/**
* Wait for the grid to render with data rows
*/
async waitForRows(options?: { timeout?: number }): Promise<void> {
await this.locator
.locator(AG_GRID_SELECTORS.BODY_ROW)
.first()
.waitFor({ state: 'visible', ...options });
}
/**
* Get header cell texts
*/
async getHeaderTexts(): Promise<string[]> {
return this.locator
.locator(AG_GRID_SELECTORS.HEADER_CELL)
.allTextContents();
}
/**
* Get the number of visible data rows
*/
async getRowCount(): Promise<number> {
return this.locator.locator(AG_GRID_SELECTORS.BODY_ROW).count();
}
/**
* Get cell text at a specific row and column index (0-based)
*/
async getCellText(row: number, col: number): Promise<string> {
const text = await this.locator
.locator(AG_GRID_SELECTORS.BODY_ROW)
.nth(row)
.locator(AG_GRID_SELECTORS.CELL)
.nth(col)
.textContent();
return text?.trim() ?? '';
}
}

View File

@@ -0,0 +1,46 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { Tabs } from './Tabs';
/**
* EditableTabs component for Ant Design editable-card tabs.
*
* Mirrors the Superset EditableTabs component (type="editable-card")
* which adds add/remove tab functionality to the base Tabs component.
*
* The add button (.ant-tabs-nav-add) is only rendered when
* type="editable-card". If the host component switches to type="card"
* (e.g., SQL Lab empty state), use the host page object for that case.
*/
export class EditableTabs extends Tabs {
/**
* Clicks the add-tab button rendered by antd in editable-card mode.
*/
async addTab(): Promise<void> {
await this.element.getByRole('button', { name: 'Add tab' }).click();
}
/**
* Clicks the remove button on the last tab.
*/
async removeLastTab(): Promise<void> {
await this.nav.locator('.ant-tabs-tab-remove').last().click();
}
}

View File

@@ -68,7 +68,7 @@ export class Modal {
}
/**
* Gets a footer button by text content (private helper)
* Gets a footer button by text content
* @param buttonText - The text content of the button
*/
private getFooterButton(buttonText: string): Locator {
@@ -80,7 +80,7 @@ export class Modal {
* @param buttonText - The text content of the button to click
* @param options - Optional click options
*/
protected async clickFooterButton(
async clickFooterButton(
buttonText: string,
options?: { timeout?: number; force?: boolean; delay?: number },
): Promise<void> {

View File

@@ -0,0 +1,53 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { Locator, Page } from '@playwright/test';
import { Button } from './Button';
/**
* Ant Design Popover component.
*/
export class Popover {
readonly page: Page;
private readonly locator: Locator;
constructor(page: Page, locator?: Locator) {
this.page = page;
this.locator = locator ?? page.locator('.ant-popover-content');
}
get element(): Locator {
return this.locator;
}
async waitForVisible(options?: { timeout?: number }): Promise<void> {
await this.locator.waitFor({ state: 'visible', ...options });
}
async waitForHidden(options?: { timeout?: number }): Promise<void> {
await this.locator.waitFor({ state: 'hidden', ...options });
}
getButton(name: string): Button {
return new Button(
this.page,
this.locator.getByRole('button', { name, exact: true }),
);
}
}

View File

@@ -18,6 +18,7 @@
*/
import { Locator, Page } from '@playwright/test';
import { TIMEOUT } from '../../utils/constants';
/**
* Ant Design Select component selectors
@@ -87,7 +88,7 @@ export class Select {
await this.page
.locator(`${SELECT_SELECTORS.DROPDOWN}:not(.ant-select-dropdown-hidden)`)
.last()
.waitFor({ state: 'hidden', timeout: 5000 })
.waitFor({ state: 'hidden', timeout: TIMEOUT.UI_TRANSITION })
.catch(error => {
// Only ignore TimeoutError (dropdown may already be closed); re-throw others
if (!(error instanceof Error) || error.name !== 'TimeoutError') {

View File

@@ -21,6 +21,10 @@ import { Locator, Page } from '@playwright/test';
/**
* Tabs component for Ant Design tab navigation.
*
* Expects the locator to point to the `.ant-tabs` wrapper element
* (not the inner tablist) so that `nav` can scope to the outer tab bar
* and exclude nested/inner tabs (e.g. Results / Query history in SQL Lab).
*/
export class Tabs {
readonly page: Page;
@@ -28,23 +32,54 @@ export class Tabs {
constructor(page: Page, locator?: Locator) {
this.page = page;
// Default to the tablist role if no specific locator provided
this.locator = locator ?? page.getByRole('tablist');
this.locator = locator ?? page.locator('.ant-tabs').first();
}
/**
* Gets the tablist element locator
* The root element locator for this tabs component.
*/
get element(): Locator {
return this.locator;
}
/**
* Gets a tab by name, scoped to this tablist's container
* The tab navigation bar for this component.
* Scoped to the first `.ant-tabs-nav` descendant so that queries
* only hit this component's tabs, never nested/inner tab bars.
*/
protected get nav(): Locator {
return this.locator.locator('.ant-tabs-nav').first();
}
/**
* Returns the number of tabs.
* Counts `.ant-tabs-tab` wrappers in the nav bar — one per physical tab,
* regardless of inner role="tab" elements (btn, remove button, etc.).
*/
async getTabCount(): Promise<number> {
return this.nav.locator('.ant-tabs-tab').count();
}
/**
* Returns the text content of all tabs.
*/
async getTabNames(): Promise<string[]> {
return this.nav.locator('.ant-tabs-tab-btn').allTextContents();
}
/**
* Gets a tab button by name, scoped to this component's nav bar.
* Anchored at start (^) with negative lookahead (?!\d) to prevent
* partial matches: "Query" won't match "Query 1", and "Query 1"
* won't match "Query 10". Trailing icon text (e.g. " circle-solid")
* is allowed since (?!\d) permits non-digit suffixes.
* @param tabName - The name/label of the tab
*/
getTab(tabName: string): Locator {
return this.locator.getByRole('tab', { name: tabName });
const escaped = tabName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
return this.nav
.locator('.ant-tabs-tab-btn')
.filter({ hasText: new RegExp(`^${escaped}(?!\\d)`) });
}
/**
@@ -63,6 +98,16 @@ export class Tabs {
return this.page.getByRole('tabpanel', { name: tabName });
}
/**
* Returns the name of the currently active tab.
*/
async getActiveTabName(): Promise<string> {
const text = await this.nav
.locator('.ant-tabs-tab-active .ant-tabs-tab-btn')
.textContent();
return text?.trim() ?? '';
}
/**
* Checks if a tab is selected
* @param tabName - The name/label of the tab

View File

@@ -19,12 +19,15 @@
// Core Playwright Components for Superset
export { AceEditor } from './AceEditor';
export { AgGrid } from './AgGrid';
export { Button } from './Button';
export { Checkbox } from './Checkbox';
export { EditableTabs } from './EditableTabs';
export { Form } from './Form';
export { Input } from './Input';
export { Menu } from './Menu';
export { Modal } from './Modal';
export { Popover } from './Popover';
export { Select } from './Select';
export { Table } from './Table';
export { Tabs } from './Tabs';

View File

@@ -40,8 +40,11 @@ export class EditDatasetModal extends Modal {
// Use getByRole with specific name to target Edit Dataset dialog
// The dialog has aria-labelledby that resolves to "edit Edit Dataset"
this.specificLocator = page.getByRole('dialog', { name: /edit.*dataset/i });
// Scope tabs to modal's tablist to avoid matching tablists elsewhere on page
this.tabs = new Tabs(page, this.specificLocator.getByRole('tablist'));
// Scope tabs to modal dialog so nav getter finds .ant-tabs-nav as descendant
this.tabs = new Tabs(
page,
this.specificLocator.locator('.ant-tabs').first(),
);
}
/**

View File

@@ -16,41 +16,28 @@
* specific language governing permissions and limitations
* under the License.
*/
import getPointsFromPolygon from '../../src/utils/getPointsFromPolygon';
describe('getPointsFromPolygon', () => {
test('handle original input', () => {
expect(
getPointsFromPolygon({
polygon: [
[1, 2],
[3, 4],
],
}),
).toEqual([
[1, 2],
[3, 4],
]);
});
test('handle geojson features', () => {
expect(
getPointsFromPolygon({
polygon: {
type: 'Feature',
geometry: {
type: 'Polygon',
coordinates: [
[
[1, 2],
[3, 4],
],
],
},
},
}),
).toEqual([
[1, 2],
[3, 4],
]);
});
});
import { Page } from '@playwright/test';
import { Input, Modal } from '../core';
/**
* Save Dataset modal in SQL Lab.
* Appears when clicking "Save dataset" after running a query.
*/
export class SaveDatasetModal extends Modal {
constructor(page: Page) {
super(page, '[data-test="Save or Overwrite Dataset-modal"] .ant-modal');
}
private get nameInput(): Input {
return new Input(
this.page,
this.body.locator('input[placeholder="Dataset name"]'),
);
}
async fillName(name: string): Promise<void> {
await this.nameInput.clear();
await this.nameInput.fill(name);
}
}

View File

@@ -0,0 +1,43 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { Page } from '@playwright/test';
import { Input, Modal } from '../core';
/**
* Save Query modal in SQL Lab.
* Appears when clicking the Save button in the SQL editor toolbar.
*/
export class SaveQueryModal extends Modal {
constructor(page: Page) {
super(page, '.save-query-modal');
}
private get nameInput(): Input {
return new Input(
this.page,
this.body.locator('input[type="text"]').first(),
);
}
async fillName(name: string): Promise<void> {
await this.nameInput.clear();
await this.nameInput.fill(name);
}
}

View File

@@ -24,3 +24,5 @@ export { DeleteConfirmationModal } from './DeleteConfirmationModal';
export { DuplicateDatasetModal } from './DuplicateDatasetModal';
export { EditDatasetModal } from './EditDatasetModal';
export { ImportDatasetModal } from './ImportDatasetModal';
export { SaveDatasetModal } from './SaveDatasetModal';
export { SaveQueryModal } from './SaveQueryModal';

View File

@@ -25,22 +25,108 @@
*
* Run locally:
* cd superset-frontend
* npm run docs:screenshots
* PLAYWRIGHT_BASE_URL=http://localhost:8088 PLAYWRIGHT_ADMIN_PASSWORD=admin npm run docs:screenshots
*
* Or directly:
* npx playwright test --config=playwright/generators/playwright.config.ts docs/
*
* Screenshots are saved to docs/static/img/screenshots/.
* Screenshots are saved under docs/static/img/.
* As new screenshots are scripted, entries are removed from screenshot-manifest.yaml
* and the output path moves from that manifest into the test below.
*/
import path from 'path';
import { Page } from '@playwright/test';
import { test, expect } from '@playwright/test';
import { URL } from '../../utils/urls';
import { apiDelete, apiGet } from '../../helpers/api/requests';
const SCREENSHOTS_DIR = path.resolve(
__dirname,
'../../../../docs/static/img/screenshots',
);
const DOCS_STATIC = path.resolve(__dirname, '../../../../docs/static/img');
const SCREENSHOTS_DIR = path.join(DOCS_STATIC, 'screenshots');
const TUTORIAL_DIR = path.join(DOCS_STATIC, 'tutorial');
/**
* Waits for animations and async renders to settle before taking a screenshot.
* ECharts entry animations, image lazy-loading, and other async UI updates
* require a short pause that can't be expressed as a deterministic wait condition.
*/
async function settle(page: Page, ms = 1000): Promise<void> {
await page.waitForTimeout(ms);
}
/**
* Navigates to the Sales Dashboard (from example data) and waits for charts
* to finish rendering. Used by several tutorial screenshots that show the
* dashboard in view or edit mode.
*/
async function openSalesDashboard(page: Page): Promise<void> {
await page.goto(URL.DASHBOARD_LIST);
const searchInput = page.getByPlaceholder('Type a value');
await expect(searchInput).toBeVisible({ timeout: 15000 });
await searchInput.fill('Sales Dashboard');
await searchInput.press('Enter');
const dashboardLink = page.getByRole('link', { name: /sales dashboard/i });
await expect(dashboardLink).toBeVisible({ timeout: 10000 });
await dashboardLink.click();
const dashboardWrapper = page.locator(
'[data-test="dashboard-content-wrapper"]',
);
await expect(dashboardWrapper).toBeVisible({ timeout: 30000 });
await expect(
page.locator('.dashboard-component-chart-holder').first(),
).toBeVisible({ timeout: 15000 });
await expect(
dashboardWrapper.locator('[data-test="loading-indicator"]'),
).toHaveCount(0, { timeout: 30000 });
await expect(
page.locator('.dashboard-component-chart-holder canvas').first(),
).toBeVisible({ timeout: 15000 });
}
/**
* Delete all dashboards matching the given exact title, along with the
* charts attached to them. Used by the save-flow test to clean up after
* itself and to recover from prior failed runs (idempotent pre-cleanup).
*
* Only safe because the title is unique to the test ("Superset Duper
* Sales Dashboard"); don't reuse this against titles that could match
* example-data dashboards.
*/
async function deleteDashboardByTitle(
page: Page,
title: string,
): Promise<void> {
const filter = `(filters:!((col:dashboard_title,opr:eq,value:'${title}')))`;
const resp = await apiGet(page, 'api/v1/dashboard/', {
params: { q: filter },
failOnStatusCode: false,
});
if (!resp.ok()) return;
const body = await resp.json();
const dashboards: { id: number }[] = body.result || [];
for (const dash of dashboards) {
const chartsResp = await apiGet(
page,
`api/v1/dashboard/${dash.id}/charts`,
{ failOnStatusCode: false },
);
const chartIds: number[] = chartsResp.ok()
? ((await chartsResp.json()).result || [])
.map((c: { id?: number }) => c.id)
.filter((id: unknown): id is number => typeof id === 'number')
: [];
await apiDelete(page, `api/v1/dashboard/${dash.id}`, {
failOnStatusCode: false,
});
for (const id of chartIds) {
await apiDelete(page, `api/v1/chart/${id}`, { failOnStatusCode: false });
}
}
}
test('chart gallery screenshot', async ({ page }) => {
await page.goto(URL.CHART_ADD);
@@ -58,6 +144,7 @@ test('chart gallery screenshot', async ({ page }) => {
vizGallery.locator('[data-test="viztype-selector-container"]').first(),
).toBeVisible();
await settle(page);
await vizGallery.screenshot({
path: path.join(SCREENSHOTS_DIR, 'gallery.jpg'),
type: 'jpeg',
@@ -65,36 +152,7 @@ test('chart gallery screenshot', async ({ page }) => {
});
test('dashboard screenshot', async ({ page }) => {
// Navigate to Sales Dashboard via the dashboard list (slug is null)
await page.goto(URL.DASHBOARD_LIST);
const searchInput = page.getByPlaceholder('Type a value');
await expect(searchInput).toBeVisible({ timeout: 15000 });
await searchInput.fill('Sales Dashboard');
await searchInput.press('Enter');
// Click the Sales Dashboard link
const dashboardLink = page.getByRole('link', { name: /sales dashboard/i });
await expect(dashboardLink).toBeVisible({ timeout: 10000 });
await dashboardLink.click();
// Wait for dashboard to fully render
const dashboardWrapper = page.locator(
'[data-test="dashboard-content-wrapper"]',
);
await expect(dashboardWrapper).toBeVisible({ timeout: 30000 });
// Wait for chart holders to appear, then wait for all loading spinners to clear
await expect(
page.locator('.dashboard-component-chart-holder').first(),
).toBeVisible({ timeout: 15000 });
await expect(
dashboardWrapper.locator('[data-test="loading-indicator"]'),
).toHaveCount(0, { timeout: 30000 });
// Wait for at least one chart to finish rendering (ECharts renders to canvas)
await expect(
page.locator('.dashboard-component-chart-holder canvas').first(),
).toBeVisible({ timeout: 15000 });
await openSalesDashboard(page);
// Open the filter bar (collapsed by default)
const expandButton = page.locator('[data-test="filter-bar__expand-button"]');
@@ -109,6 +167,8 @@ test('dashboard screenshot', async ({ page }) => {
).toBeVisible({ timeout: 5000 });
}
// Allow ECharts entry animations to finish before capturing
await settle(page);
await page.screenshot({
path: path.join(SCREENSHOTS_DIR, 'dashboard.jpg'),
type: 'jpeg',
@@ -143,6 +203,7 @@ test('chart editor screenshot', async ({ page }) => {
timeout: 15000,
});
await settle(page);
await page.screenshot({
path: path.join(SCREENSHOTS_DIR, 'explore.jpg'),
type: 'jpeg',
@@ -151,7 +212,7 @@ test('chart editor screenshot', async ({ page }) => {
});
test('SQL Lab screenshot', async ({ page }) => {
// SQL Lab has many interactive steps (schema, table, query, results) — allow extra time
// SQL Lab has many interactive steps — allow extra time
test.setTimeout(90000);
await page.goto(URL.SQLLAB);
@@ -168,34 +229,7 @@ test('SQL Lab screenshot', async ({ page }) => {
}
await expect(aceEditor).toBeVisible({ timeout: 15000 });
// Select the "public" schema so we can pick a table from the left panel
const schemaSelect = page.locator('#select-schema');
await expect(schemaSelect).toBeEnabled({ timeout: 10000 });
await schemaSelect.click({ force: true });
await schemaSelect.fill('public');
await page.getByRole('option', { name: 'public' }).click();
// Wait for table list to load after schema change, then select birth_names
const tableSelectWrapper = page
.locator('.ant-select')
.filter({ has: page.locator('#select-table') });
await expect(tableSelectWrapper).toBeVisible({ timeout: 10000 });
await tableSelectWrapper.click();
await page.keyboard.type('birth_names');
// Wait for the filtered option to appear in the DOM, then select it
const tableOption = page
.locator('.ant-select-dropdown [role="option"]')
.filter({ hasText: 'birth_names' });
await expect(tableOption).toBeAttached({ timeout: 10000 });
await page.keyboard.press('Enter');
// Wait for table schema to load and show columns in the left panel
await expect(page.locator('[data-test="col-name"]').first()).toBeVisible({
timeout: 15000,
});
// Close the table dropdown by clicking elsewhere, then switch to the query tab
await page.locator('[data-test="sql-editor-tabs"]').first().click();
// Click the active query tab to ensure focus is on the editor pane
await page.getByText('Untitled Query').first().click();
// Write a multi-line SELECT with explicit columns to fill the editor
@@ -205,8 +239,8 @@ test('SQL Lab screenshot', async ({ page }) => {
'SELECT\n ds,\n name,\n gender,\n state,\n num\nFROM birth_names\nLIMIT 100',
);
// Run the query
const runButton = page.getByText('Run', { exact: true });
// Run the query — use the stable data-test attribute on the action button
const runButton = page.locator('[data-test="run-query-action"]');
await expect(runButton).toBeVisible();
await runButton.click();
@@ -222,9 +256,352 @@ test('SQL Lab screenshot', async ({ page }) => {
await page.mouse.move(0, 0);
await expect(page.getByRole('tooltip')).toHaveCount(0, { timeout: 2000 });
await settle(page);
await page.screenshot({
path: path.join(SCREENSHOTS_DIR, 'sql_lab.jpg'),
type: 'jpeg',
fullPage: true,
});
});
// ---------------------------------------------------------------------------
// Tutorial screenshots
// ---------------------------------------------------------------------------
test('datasets list screenshot', async ({ page }) => {
await page.goto(URL.DATASET_LIST);
const table = page.locator('[data-test="listview-table"]');
await expect(table).toBeVisible({ timeout: 15000 });
// Wait for at least one visible data row (skip ant-table-measure-row which is always hidden)
await expect(
table.locator('tbody tr:not(.ant-table-measure-row)').first(),
).toBeVisible({ timeout: 10000 });
// Viewport screenshot (not fullPage) captures the SubMenu — showing the
// "Datasets" nav item, Bulk Select button, and + Dataset button — plus the
// top of the table. This is more informative than screenshotting the table alone.
await settle(page);
await page.screenshot({
path: path.join(TUTORIAL_DIR, 'tutorial_08_sources_tables.png'),
type: 'png',
});
});
test('chart type picker screenshot', async ({ page }) => {
await page.goto(URL.CHART_ADD);
// Wait for the dataset step to appear (step title is first match; placeholder is second)
await expect(page.getByText('Choose a dataset').first()).toBeVisible({
timeout: 15000,
});
// Open the dataset selector and choose birth_names
await page.getByTestId('Dataset').click();
await page.keyboard.type('birth_names');
// The dataset select uses a hidden ARIA listbox — the visible popup is a portal.
// Wait for the first option to appear in the DOM, then select it via keyboard.
await expect(
page.locator('[role="listbox"] [role="option"]').first(),
).toBeAttached({ timeout: 10000 });
await page.keyboard.press('ArrowDown');
await page.keyboard.press('Enter');
// Open the chart gallery and wait for thumbnails to render
await expect(page.getByText('Choose chart type')).toBeVisible({
timeout: 10000,
});
await page.getByRole('tab', { name: 'All charts' }).click();
const vizGallery = page.locator('.viz-gallery');
await expect(vizGallery).toBeVisible();
await expect(
vizGallery.locator('[data-test="viztype-selector-container"]').first(),
).toBeVisible();
// Select the Pivot Table chart type
await vizGallery
.locator('[data-test="viztype-selector-container"]')
.filter({ hasText: 'Pivot Table' })
.first()
.click();
// Allow thumbnails to finish loading and selection state to render
await settle(page);
// Viewport screenshot shows the dataset step (birth_names selected) and
// the chart type gallery (Pivot Table highlighted)
await page.screenshot({
path: path.join(TUTORIAL_DIR, 'create_pivot.png'),
type: 'png',
});
});
test('publish button dashboard screenshot', async ({ page }) => {
// Toggle Sales Dashboard to Draft, hover the label so the tooltip renders,
// then capture the header area plus enough room below for the tooltip.
// Always restores the dashboard to Published at the end.
await openSalesDashboard(page);
const publishedLabel = page.getByText('Published', { exact: true }).first();
await expect(publishedLabel).toBeVisible({ timeout: 10000 });
await publishedLabel.click();
const draftLabel = page.getByText('Draft', { exact: true }).first();
await expect(draftLabel).toBeVisible({ timeout: 10000 });
try {
await draftLabel.hover();
await expect(page.getByRole('tooltip')).toBeVisible({ timeout: 5000 });
await settle(page, 500);
const headerBox = await page
.locator('[data-test="dashboard-header-container"]')
.boundingBox();
if (!headerBox) {
throw new Error('Could not locate dashboard header container');
}
await page.screenshot({
path: path.join(TUTORIAL_DIR, 'publish_button_dashboard.png'),
type: 'png',
clip: {
x: headerBox.x,
y: headerBox.y,
width: headerBox.width,
height: headerBox.height + 140,
},
});
} finally {
// Restore: click Draft to re-publish so other runs start from a clean state
await page.mouse.move(0, 0);
await draftLabel.click();
await expect(
page.getByText('Published', { exact: true }).first(),
).toBeVisible({ timeout: 10000 });
}
});
test('edit button screenshot', async ({ page }) => {
// Capture the right-side action buttons (Edit dashboard + "..." menu)
// rather than the edit button in isolation.
await openSalesDashboard(page);
await settle(page);
const rightPanel = page.locator('.right-button-panel');
await expect(rightPanel).toBeVisible({ timeout: 5000 });
await rightPanel.screenshot({
path: path.join(TUTORIAL_DIR, 'tutorial_edit_button.png'),
type: 'png',
});
});
test('chart resize screenshot', async ({ page }) => {
// Enter edit mode, start a resize drag on the right-edge handle, then
// screenshot the chart mid-drag. While `DashboardGrid` is in the resizing
// state it renders vertical `grid-column-guide` overlays across the grid
// and the chart gets a blue `--resizing` outline — that's the state the
// original tutorial screenshot was capturing.
await openSalesDashboard(page);
const editButton = page.locator('[data-test="edit-dashboard-button"]');
await expect(editButton).toBeVisible();
await editButton.click();
await expect(
page.locator('[data-test="dashboard-builder-sidepane"]'),
).toBeVisible({ timeout: 10000 });
const chart = page.locator('.dashboard-component-chart-holder').first();
await expect(chart).toBeVisible();
const chartBox = await chart.boundingBox();
if (!chartBox) {
throw new Error('Could not locate chart bounding box');
}
// Hover over the chart so the on-hover action buttons (drag/trash/settings)
// and resize handles become visible.
await page.mouse.move(
chartBox.x + chartBox.width / 2,
chartBox.y + chartBox.height / 2,
);
await settle(page, 200);
// The right-edge handle is a `<span>` added by re-resizable with our
// custom class. Locating it by class is more reliable than computing
// coordinates from the chart-holder (which isn't the full resizable box).
const rightHandle = page
.locator('.resizable-container-handle--right')
.first();
await expect(rightHandle).toBeVisible();
const handleBox = await rightHandle.boundingBox();
if (!handleBox) {
throw new Error('Could not locate right-edge resize handle');
}
const handleX = handleBox.x + handleBox.width / 2;
const handleY = handleBox.y + handleBox.height / 2;
await page.mouse.move(handleX, handleY);
await page.mouse.down();
// Move far enough to snap at least one grid column, which puts
// DashboardGrid into isResizing=true so the column guides render.
await page.mouse.move(handleX + 80, handleY, { steps: 10 });
await settle(page, 500);
// Clip to the chart area plus a left gutter for the hover action rail
// and right padding that reaches past the dragged handle position.
const leftGutter = 32;
const rightPadding = 100;
const topPadding = 16;
const bottomPadding = 24;
await page.screenshot({
path: path.join(TUTORIAL_DIR, 'tutorial_chart_resize.png'),
type: 'png',
clip: {
x: Math.max(0, chartBox.x - leftGutter),
y: Math.max(0, chartBox.y - topPadding),
width: chartBox.width + leftGutter + rightPadding,
height: chartBox.height + topPadding + bottomPadding,
},
});
// Release back at the start to avoid persisting a size change. Edit-mode
// changes aren't saved (we never click the dashboard Save button).
await page.mouse.move(handleX, handleY, { steps: 6 });
await page.mouse.up();
});
test('save flow and first dashboard screenshots', async ({ page }) => {
// Captures two linked tutorial screenshots in a single flow so the second
// faithfully shows the dashboard the user just created:
// 1. tutorial_save_slice.png — Save modal with the "Add to dashboard"
// dropdown surfacing a creatable option for a new dashboard.
// 2. tutorial_first_dashboard.png — the freshly-created dashboard with
// the single saved chart (matches the tutorial narrative).
//
// Creates and then deletes a "Superset Duper Sales Dashboard" dashboard
// plus the duplicate chart it owns. Pre-cleans in case a prior run failed.
const NEW_DASHBOARD_NAME = 'Superset Duper Sales Dashboard';
await deleteDashboardByTitle(page, NEW_DASHBOARD_NAME);
// 1100px is wide enough to show the full "Superset Duper Sales Dashboard"
// title alongside the header actions without truncation.
await page.setViewportSize({ width: 1100, height: 800 });
await page.goto(URL.CHART_LIST);
const searchInput = page.getByPlaceholder('Type a value');
await expect(searchInput).toBeVisible({ timeout: 15000 });
await searchInput.fill('Scatter Plot');
await searchInput.press('Enter');
const chartLink = page.getByRole('link', { name: /scatter plot/i });
await expect(chartLink).toBeVisible({ timeout: 10000 });
await chartLink.click();
await page.waitForURL('**/explore/**', { timeout: 15000 });
const sliceContainer = page.locator('[data-test="slice-container"]');
await expect(sliceContainer).toBeVisible({ timeout: 15000 });
await expect(
sliceContainer.locator('[data-test="loading-indicator"]'),
).toHaveCount(0, { timeout: 15000 });
const saveButton = page.locator('[data-test="query-save-button"]');
await expect(saveButton).toBeVisible({ timeout: 10000 });
await saveButton.click();
const modal = page.locator('.ant-modal-content').filter({
has: page.locator('[data-test="save-modal-body"]'),
});
await expect(modal).toBeVisible({ timeout: 10000 });
// Open the "Add to dashboard" select and type a new dashboard name so
// the dropdown surfaces the creatable option.
const dashboardSelect = page.getByRole('combobox', {
name: /select a dashboard/i,
});
await dashboardSelect.click();
await page.keyboard.type(NEW_DASHBOARD_NAME);
// Ant Design portals the visible dropdown with the class
// `.ant-select-item-option` on each option (distinct from the hidden
// ARIA listbox options rendered inside the combobox itself).
const createOption = page
.locator('.ant-select-item-option')
.filter({ hasText: NEW_DASHBOARD_NAME });
await expect(createOption).toBeVisible({ timeout: 10000 });
await settle(page);
try {
// Screenshot 1: save modal + portaled dropdown.
const modalBox = await modal.boundingBox();
const optionBox = await createOption.boundingBox();
if (!modalBox || !optionBox) {
throw new Error('Could not locate save modal or create-option');
}
const padding = 16;
const top = Math.max(0, modalBox.y - padding);
const bottom = optionBox.y + optionBox.height + padding;
await page.screenshot({
path: path.join(TUTORIAL_DIR, 'tutorial_save_slice.png'),
type: 'png',
clip: {
x: Math.max(0, modalBox.x - padding),
y: top,
width: modalBox.width + padding * 2,
height: bottom - top,
},
});
// Pick the creatable option, then click "Save & go to dashboard" so the
// backend creates the dashboard + slice and redirects us to the new one.
await createOption.click();
const saveAndGotoBtn = page.locator('#btn_modal_save_goto_dash');
await expect(saveAndGotoBtn).toBeEnabled({ timeout: 5000 });
await saveAndGotoBtn.click();
await page.waitForURL(/\/dashboard\/[^/]+\/?/, { timeout: 30000 });
await expect(
page.locator('[data-test="dashboard-content-wrapper"]'),
).toBeVisible({ timeout: 30000 });
await expect(
page.locator('.dashboard-component-chart-holder').first(),
).toBeVisible({ timeout: 30000 });
await expect(
page.locator('.dashboard-component-chart-holder canvas').first(),
).toBeVisible({ timeout: 15000 });
// Dismiss the "Chart [X] has been saved" toast so it doesn't appear in
// the screenshot. The close button is inside the toast container.
const toast = page.locator('[data-test="toast-container"]').first();
if (await toast.isVisible().catch(() => false)) {
await toast.locator('.toast__close').click();
await expect(toast).toBeHidden({ timeout: 5000 });
}
await settle(page);
// Screenshot 2: the newly-created single-chart dashboard (title + chart).
const headerBox = await page
.locator('[data-test="dashboard-header-wrapper"]')
.boundingBox();
const chartBox = await page
.locator('.dashboard-component-chart-holder')
.first()
.boundingBox();
if (!headerBox || !chartBox) {
throw new Error('Could not locate dashboard header or chart');
}
// Trim right edge to just past the chart so the screenshot isn't padded
// with empty grid space.
const rightPadding = 16;
await page.screenshot({
path: path.join(TUTORIAL_DIR, 'tutorial_first_dashboard.png'),
type: 'png',
clip: {
x: 0,
y: headerBox.y,
width: Math.min(1100, chartBox.x + chartBox.width + rightPadding),
height: chartBox.y + chartBox.height - headerBox.y + 16,
},
});
} finally {
await deleteDashboardByTitle(page, NEW_DASHBOARD_NAME);
}
});

File diff suppressed because it is too large Load Diff

View File

@@ -64,6 +64,7 @@ export default defineConfig({
name: 'docs-generators',
use: {
browserName: 'chromium',
baseURL, // explicit here so globalSetup can read it from config.projects[0].use.baseURL
testIdAttribute: 'data-test',
storageState: path.resolve(__dirname, '../.auth/user.json'),
},

View File

@@ -61,6 +61,22 @@ export function expectStatusOneOf<T extends ResponseLike>(
return response;
}
/**
* Extract the resource ID from a JSON response body.
* Handles both `{ result: { id } }` and `{ id }` shapes.
* @param response - Playwright Response or APIResponse object
* @returns The extracted numeric ID
*/
export async function extractIdFromResponse(
response: ResponseLike,
): Promise<number> {
const body = await response.json();
const id: number = body.result?.id ?? body.id;
expect(typeof id, 'Response body must contain a numeric id').toBe('number');
expect(Number.isNaN(id), 'Response id must not be NaN').toBe(false);
return id;
}
interface ExportZipOptions {
/** Directory name containing resource yaml files (e.g. 'charts', 'datasets') */
resourceDir: string;

View File

@@ -0,0 +1,47 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { Page, APIResponse } from '@playwright/test';
import { apiGet, apiDelete, ApiRequestOptions } from './requests';
const ENDPOINTS = {
SAVED_QUERY: 'api/v1/saved_query/',
} as const;
/**
* GET request to fetch a saved query's details
*/
export async function apiGetSavedQuery(
page: Page,
savedQueryId: number,
options?: ApiRequestOptions,
): Promise<APIResponse> {
return apiGet(page, `${ENDPOINTS.SAVED_QUERY}${savedQueryId}`, options);
}
/**
* DELETE request to remove a saved query
*/
export async function apiDeleteSavedQuery(
page: Page,
savedQueryId: number,
options?: ApiRequestOptions,
): Promise<APIResponse> {
return apiDelete(page, `${ENDPOINTS.SAVED_QUERY}${savedQueryId}`, options);
}

View File

@@ -23,6 +23,7 @@ import { apiDeleteDashboard } from '../api/dashboard';
import { apiDeleteDataset } from '../api/dataset';
import { apiDeleteTheme } from '../api/theme';
import { apiDeleteDatabase } from '../api/database';
import { apiDeleteSavedQuery } from '../api/savedQuery';
/**
* Test asset tracker for automatic cleanup after each test.
@@ -34,6 +35,7 @@ export interface TestAssets {
trackDataset(id: number): void;
trackTheme(id: number): void;
trackDatabase(id: number): void;
trackSavedQuery(id: number): void;
}
const EXPECTED_CLEANUP_STATUSES = new Set([200, 202, 204, 404]);
@@ -46,6 +48,7 @@ export const test = base.extend<{ testAssets: TestAssets }>({
const datasetIds = new Set<number>();
const themeIds = new Set<number>();
const databaseIds = new Set<number>();
const savedQueryIds = new Set<number>();
await use({
trackDashboard: id => dashboardIds.add(id),
@@ -53,9 +56,29 @@ export const test = base.extend<{ testAssets: TestAssets }>({
trackDataset: id => datasetIds.add(id),
trackTheme: id => themeIds.add(id),
trackDatabase: id => databaseIds.add(id),
trackSavedQuery: id => savedQueryIds.add(id),
});
// Cleanup order: dashboards → charts → datasets → themes → databases (respects FK dependencies)
// Cleanup order: saved queries → dashboards → charts → datasets → themes → databases (respects FK dependencies)
// Saved queries have no FK dependents, so they can be cleaned up first
await Promise.all(
[...savedQueryIds].map(id =>
apiDeleteSavedQuery(page, id, { failOnStatusCode: false })
.then(response => {
if (!EXPECTED_CLEANUP_STATUSES.has(response.status())) {
console.warn(
`[testAssets] Unexpected status ${response.status()} cleaning up saved query ${id}`,
);
}
})
.catch(error => {
console.warn(
`[testAssets] Failed to cleanup saved query ${id}:`,
error,
);
}),
),
);
// Use failOnStatusCode: false to avoid throwing on 404 (resource already deleted by test)
// Warn on unexpected status codes (401/403/500) that may indicate leaked state
await Promise.all(

View File

@@ -50,7 +50,9 @@ export class AuthPage {
* Navigate to the login page
*/
async goto(): Promise<void> {
await this.page.goto(URL.LOGIN);
// Use domcontentloaded — the login form is server-rendered and ready before
// all assets load. The default 'load' event may never fire with HMR WebSocket.
await this.page.goto(URL.LOGIN, { waitUntil: 'domcontentloaded' });
}
/**

View File

@@ -0,0 +1,371 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { Page, Locator, Response } from '@playwright/test';
import { AceEditor } from '../components/core/AceEditor';
import { AgGrid } from '../components/core/AgGrid';
import { Button } from '../components/core/Button';
import { EditableTabs } from '../components/core/EditableTabs';
import { Popover } from '../components/core/Popover';
import { Select } from '../components/core/Select';
import { waitForPost } from '../helpers/api/intercepts';
import { URL } from '../utils/urls';
import { TIMEOUT } from '../utils/constants';
/**
* Page object for SQL Lab.
*
* Selectors verified against source code — see plan for line references.
*/
export class SqlLabPage {
private readonly page: Page;
private readonly editorTabs: EditableTabs;
private static readonly SELECTORS = {
SQL_EDITOR_TABS: '[data-test="sql-editor-tabs"]',
ADD_TAB_ICON: '[data-test="add-tab-icon"]',
RUN_QUERY_BUTTON: '[data-test="run-query-action"]',
SOUTH_PANE: '[data-test="south-pane"]',
EXPLORE_RESULTS_BUTTON: '[data-test="explore-results-button"]',
SAVE_BUTTON: 'button[aria-label="Save"]',
ACE_EDITOR: '.ace_editor',
LEFT_BAR: '[data-test="sql-editor-left-bar"]',
DATABASE_SELECTOR: '[data-test="DatabaseSelector"]',
LIMIT_DROPDOWN: '.limitDropdown',
SAVE_DATASET_BUTTON: 'button[aria-label="Save dataset"]',
} as const;
constructor(page: Page) {
this.page = page;
this.editorTabs = new EditableTabs(
page,
page.locator(SqlLabPage.SELECTORS.SQL_EDITOR_TABS),
);
}
// ── Navigation ──
async goto(): Promise<void> {
await this.page.goto(URL.SQLLAB, { waitUntil: 'domcontentloaded' });
}
async waitForPageLoad(options?: { timeout?: number }): Promise<void> {
// SQL Lab with dev server can be slow on first load (webpack HMR + React hydration)
const timeout = options?.timeout ?? TIMEOUT.QUERY_EXECUTION;
await this.editorTabs.element.waitFor({ state: 'visible', timeout });
}
/**
* Navigate to SQL Lab and wait until the editor is ready.
* Convenience method combining goto + waitForPageLoad + ensureEditorReady.
*/
async gotoAndReady(): Promise<void> {
await this.goto();
await this.waitForPageLoad();
await this.ensureEditorReady();
}
/**
* Ensures at least one query editor tab exists. Creates one if SQL Lab
* is in the empty state ("Add a new tab to create SQL Query").
* Waits for the ace editor to be ready before returning.
*
* Uses a two-stage check to handle three states correctly:
* 1. Empty state (CI): type="card" with 0 queryEditors, no editor → create tab
* 2. Loading after reload: real tabs exist, editor hasn't mounted yet → just wait
* 3. Normal: tabs + editor present → ready immediately
*
* Stage 1 checks editor presence (catches empty + loading).
* Stage 2 checks the Ant Design tabs type to distinguish real tabs
* (type="editable-card") from the empty state (type="card"). The React
* source (TabbedSqlEditors) sets type based on queryEditors.length,
* so this directly reflects whether persisted tabs exist.
*/
async ensureEditorReady(): Promise<void> {
// Page-global check: are there ANY editors in the DOM (any tab)?
const anyEditor = this.page.locator(SqlLabPage.SELECTORS.ACE_EDITOR);
let tabSyncPromise: Promise<Response> | null = null;
if ((await anyEditor.count()) === 0) {
// No editor visible. Check if real query editors exist (editable-card)
// or if this is the empty state (card type, 0 queryEditors).
// type="editable-card" → queryEditors.length > 0 (even 1 real tab).
// type="card" → queryEditors.length === 0 (true empty state).
const isEditableCard = await this.editorTabs.element.evaluate(el =>
el.classList.contains('ant-tabs-editable-card'),
);
if (!isEditableCard) {
// Register before clicking — EditorAutoSync POSTs the new tab
// within its 5 s interval, so capture it before any await.
tabSyncPromise = waitForPost(this.page, /tabstateview\/?$/, {
timeout: 10_000,
});
// True empty state — click add-tab icon (works in card mode)
await this.editorTabs.element
.locator(SqlLabPage.SELECTORS.ADD_TAB_ICON)
.first()
.click();
}
// If editable-card: real tabs exist, editor is still mounting — just wait
}
// Wait for the editor in the ACTIVE panel, not page-global .first().
// In persisted multi-tab sessions, .first() can resolve to a hidden
// inactive editor. activePanel scopes to the visible tab panel.
await this.activePanel
.locator(SqlLabPage.SELECTORS.ACE_EDITOR)
.waitFor({ state: 'visible' });
await this.editor.waitForReady();
// If we created the initial tab, wait for its backend sync to complete.
// This prevents later waitForPost calls from accidentally matching
// this tab's creation POST instead of a subsequent tab's.
if (tabSyncPromise) {
await tabSyncPromise;
}
}
// ── Active Tab Panel ──
/**
* Gets the active tab panel. Ant Design keeps inactive tab panels mounted
* but sets aria-hidden="true" on them. Using :not([aria-hidden="true"])
* is more reliable than :visible during tab-switch animations where both
* panels may briefly have non-zero dimensions.
*/
private get activePanel(): Locator {
return this.page
.locator('[role="tabpanel"]:not([aria-hidden="true"])')
.filter({ has: this.page.locator(SqlLabPage.SELECTORS.ACE_EDITOR) });
}
// ── Elements ──
get editor(): AceEditor {
return new AceEditor(
this.page,
this.activePanel.locator(SqlLabPage.SELECTORS.ACE_EDITOR),
);
}
get resultsGrid(): AgGrid {
return new AgGrid(
this.page,
this.activePanel
.locator(SqlLabPage.SELECTORS.SOUTH_PANE)
.locator('[role="grid"]'),
);
}
get resultsPane(): Locator {
return this.activePanel.locator(SqlLabPage.SELECTORS.SOUTH_PANE);
}
get errorAlert(): Locator {
return this.resultsPane.locator('.ant-alert-error');
}
get databaseSelector(): Button {
return new Button(
this.page,
this.page.locator(
`${SqlLabPage.SELECTORS.LEFT_BAR} ${SqlLabPage.SELECTORS.DATABASE_SELECTOR}`,
),
);
}
get runQueryButton(): Button {
return new Button(
this.page,
this.activePanel.locator(SqlLabPage.SELECTORS.RUN_QUERY_BUTTON),
);
}
get saveButton(): Button {
return new Button(
this.page,
this.activePanel.locator(SqlLabPage.SELECTORS.SAVE_BUTTON),
);
}
get saveDatasetButton(): Button {
return new Button(
this.page,
this.activePanel.locator(SqlLabPage.SELECTORS.SAVE_DATASET_BUTTON),
);
}
get createChartButton(): Button {
return new Button(
this.page,
this.activePanel.locator(SqlLabPage.SELECTORS.EXPLORE_RESULTS_BUTTON),
);
}
// ── Editor Convenience ──
async setQuery(sql: string): Promise<void> {
await this.editor.setText(sql);
}
async getQuery(): Promise<string> {
return this.editor.getText();
}
// ── Tab Management ──
async getTabCount(): Promise<number> {
return this.editorTabs.getTabCount();
}
async getTabNames(): Promise<string[]> {
return this.editorTabs.getTabNames();
}
async getActiveTabName(): Promise<string> {
return this.editorTabs.getActiveTabName();
}
async addTab(): Promise<void> {
await this.editorTabs.addTab();
}
async addTabByShortcut(): Promise<void> {
const modifier = process.platform === 'win32' ? 'Control+q' : 'Control+t';
await this.page.keyboard.press(modifier);
}
async closeLastTab(): Promise<void> {
const countBefore = await this.getTabCount();
await this.editorTabs.removeLastTab();
// Wait for tab count to decrease
await this.page.waitForFunction(
([selector, expected]) => {
const container = document.querySelector(selector);
if (!container) return false;
const nav = container.querySelector(':scope > .ant-tabs-nav');
if (!nav) return false;
return nav.querySelectorAll('.ant-tabs-tab').length === expected;
},
[SqlLabPage.SELECTORS.SQL_EDITOR_TABS, countBefore - 1] as const,
{ timeout: TIMEOUT.UI_TRANSITION },
);
}
getTab(name: string): Locator {
return this.editorTabs.getTab(name);
}
// ── Database Selection (Left Sidebar) ──
async selectDatabase(dbName: string): Promise<void> {
await this.databaseSelector.click();
const popover = new Popover(this.page);
await popover.waitForVisible();
// Target the .ant-select wrapper (not the combobox input) because the
// selection-item overlay intercepts pointer events on the input.
const dbSelect = popover.element
.locator(SqlLabPage.SELECTORS.DATABASE_SELECTOR)
.locator('.ant-select')
.first();
const select = new Select(this.page, dbSelect);
await select.selectOption(dbName);
await popover.getButton('Select').click();
await popover
.waitForHidden({ timeout: TIMEOUT.UI_TRANSITION })
.catch(error => {
if (!(error instanceof Error) || error.name !== 'TimeoutError') {
throw error;
}
});
}
// ── Query Execution ──
/**
* Sets SQL, runs the query, and waits for the API response.
* Also observes the QueryStatusBar (.ant-steps) loading indicator to
* confirm the UI entered the execution cycle — this unmounts the old
* results grid, so waitForQueryResults() can trust that any grid it
* finds afterward contains data from THIS execution.
*/
async executeQuery(sql: string): Promise<Response> {
await this.setQuery(sql);
const responsePromise = waitForPost(this.page, 'api/v1/sqllab/execute/', {
timeout: TIMEOUT.QUERY_EXECUTION,
});
// Start observing the loading indicator BEFORE clicking Run so we
// catch it even for fast queries. QueryStatusBar (.ant-steps) appears
// when SQL Lab enters the running state and unmounts the results grid.
const loadingStarted = this.resultsPane
.locator('.ant-steps')
.waitFor({ state: 'visible', timeout: TIMEOUT.QUERY_EXECUTION });
await this.runQueryButton.click();
const [, response] = await Promise.all([loadingStarted, responsePromise]);
return response;
}
/**
* Wait for fresh query results to render in the AG Grid.
* Waits for the QueryStatusBar to disappear first, proving the execution
* cycle completed and React rendered the post-query grid.
* @param expectHeader - A column header that must be visible before returning.
* @param options.timeout - How long to wait (default: TIMEOUT.QUERY_EXECUTION)
*/
async waitForQueryResults(
expectHeader: string,
options?: { timeout?: number },
): Promise<void> {
const timeout = options?.timeout ?? TIMEOUT.QUERY_EXECUTION;
// Wait for QueryStatusBar to disappear — proves the loading → ready
// transition completed. If already hidden (fast query finished before
// this call), resolves immediately since executeQuery() already observed
// the loading state appear.
await this.resultsPane
.locator('.ant-steps')
.waitFor({ state: 'hidden', timeout });
const grid = this.resultsGrid.element;
await grid.waitFor({ state: 'visible', timeout });
await grid
.locator('.ag-header-cell', { hasText: expectHeader })
.first()
.waitFor({ state: 'visible', timeout });
}
// ── Row Limit ──
async getRowLimit(): Promise<string> {
const text = await this.activePanel
.locator(SqlLabPage.SELECTORS.LIMIT_DROPDOWN)
.textContent();
return text?.trim() ?? '';
}
/**
* Set the row limit via the Limit dropdown in the active panel.
* @param limit - The menu item label to select (e.g., "10", "100")
*/
async setRowLimit(limit: string): Promise<void> {
await this.activePanel.locator(SqlLabPage.SELECTORS.LIMIT_DROPDOWN).click();
await this.page.getByRole('menuitem', { name: limit, exact: true }).click();
}
}

View File

@@ -44,25 +44,18 @@ test.beforeEach(async ({ page }) => {
test('should redirect to login with incorrect username and password', async ({
page,
}) => {
// Setup request interception before login attempt
const loginRequestPromise = authPage.waitForLoginRequest();
// The form submission is async (SupersetClient.postForm uses ensureAuth)
// so listen for the page reload before triggering the login
await Promise.all([
page.waitForEvent('load', { timeout: TIMEOUT.PAGE_LOAD }),
authPage.loginWithCredentials('wronguser', 'wrongpassword'),
]);
// Attempt login with incorrect credentials (both username and password invalid)
await authPage.loginWithCredentials('wronguser', 'wrongpassword');
// Wait for login request and verify response
const loginResponse = await loginRequestPromise;
// Failed login returns 401 Unauthorized or 302 redirect to login
expect([401, 302]).toContain(loginResponse.status());
// Wait for redirect to complete before checking URL
await page.waitForURL(url => url.pathname.endsWith(URL.LOGIN), {
timeout: TIMEOUT.PAGE_LOAD,
});
// After the reload, wait for the React login form to render
await authPage.waitForLoginForm();
// Verify we stay on login page
const currentUrl = await authPage.getCurrentUrl();
expect(currentUrl).toContain(URL.LOGIN);
expect(page.url()).toContain(URL.LOGIN);
// Verify error message is shown
const hasError = await authPage.hasLoginError();
@@ -70,16 +63,12 @@ test('should redirect to login with incorrect username and password', async ({
});
test('should login with correct username and password', async ({ page }) => {
// Setup request interception before login attempt
const loginRequestPromise = authPage.waitForLoginRequest();
// Login with correct credentials
await authPage.loginWithCredentials(adminUsername, adminPassword);
// Wait for login request and verify response
const loginResponse = await loginRequestPromise;
// Successful login returns 302 redirect
expect(loginResponse.status()).toBe(302);
// Use waitForLoginSuccess (proven in global-setup) — guards against race
// conditions with cookie check before falling back to response interception
await authPage.waitForLoginSuccess({ timeout: TIMEOUT.PAGE_LOAD });
// Wait for successful redirect to welcome page
await page.waitForURL(url => url.pathname.endsWith(URL.WELCOME), {

View File

@@ -0,0 +1,315 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* SQL Lab E2E tests — sequential via chromium-sqllab project.
*
* Tab state is stored server-side per user (/tabstateview/*), and all workers
* share the same authenticated user. Parallel workers adding/removing tabs
* would cause nondeterministic tab counts and cross-worker deletions.
* See playwright.config.ts chromium-sqllab project for details.
*/
import { test, expect } from '../../helpers/fixtures/testAssets';
import { SqlLabPage } from '../../pages/SqlLabPage';
import { ExplorePage } from '../../pages/ExplorePage';
import { Input } from '../../components/core';
import { SaveQueryModal } from '../../components/modals/SaveQueryModal';
import { SaveDatasetModal } from '../../components/modals/SaveDatasetModal';
import { waitForPost } from '../../helpers/api/intercepts';
import {
expectStatus,
extractIdFromResponse,
} from '../../helpers/api/assertions';
import { apiGetSavedQuery } from '../../helpers/api/savedQuery';
import { TIMEOUT } from '../../utils/constants';
import { URL } from '../../utils/urls';
let sqlLabPage: SqlLabPage;
test.beforeEach(async ({ page }) => {
test.setTimeout(TIMEOUT.SLOW_TEST);
sqlLabPage = new SqlLabPage(page);
await sqlLabPage.gotoAndReady();
});
// ── Query Execution ──
test('executes a simple SELECT query and displays results', async () => {
await expect(sqlLabPage.databaseSelector.element).toBeVisible();
const response = await sqlLabPage.executeQuery('SELECT 1 AS test_col');
expectStatus(response, 200);
await sqlLabPage.waitForQueryResults('test_col');
const headers = await sqlLabPage.resultsGrid.getHeaderTexts();
expect(headers.some(h => h.includes('test_col'))).toBe(true);
});
test('shows error message for invalid SQL', async () => {
const invalidTable = 'a_table_that_does_not_exist_xyz_pw';
await sqlLabPage.executeQuery(`SELECT * FROM ${invalidTable}`);
const { errorAlert } = sqlLabPage;
await expect(errorAlert).toBeVisible({ timeout: TIMEOUT.QUERY_EXECUTION });
// Assert the error references the specific table name, proving this query
// triggered the failure — not a stale error from a prior test or session.
await expect(errorAlert).toContainText(invalidTable);
});
test('re-runs a query and refreshes results', async () => {
const firstResponse = await sqlLabPage.executeQuery('SELECT 1 AS first_col');
expectStatus(firstResponse, 200);
await sqlLabPage.waitForQueryResults('first_col');
const firstHeaders = await sqlLabPage.resultsGrid.getHeaderTexts();
expect(firstHeaders.some(h => h.includes('first_col'))).toBe(true);
const secondResponse = await sqlLabPage.executeQuery(
'SELECT 2 AS second_col',
);
expectStatus(secondResponse, 200);
await sqlLabPage.waitForQueryResults('second_col');
const secondHeaders = await sqlLabPage.resultsGrid.getHeaderTexts();
expect(secondHeaders.some(h => h.includes('second_col'))).toBe(true);
expect(secondHeaders.some(h => h.includes('first_col'))).toBe(false);
});
// ── Tabs ──
test('creates a new tab via button', async () => {
const initialTabCount = await sqlLabPage.getTabCount();
await sqlLabPage.addTab();
await sqlLabPage.editor.waitForReady();
expect(await sqlLabPage.getTabCount()).toBe(initialTabCount + 1);
const defaultContent = await sqlLabPage.getQuery();
expect(defaultContent).toContain('SELECT');
await sqlLabPage.closeLastTab();
expect(await sqlLabPage.getTabCount()).toBe(initialTabCount);
});
test('closes a tab via close button', async () => {
const initialTabCount = await sqlLabPage.getTabCount();
await sqlLabPage.addTab();
await sqlLabPage.editor.waitForReady();
expect(await sqlLabPage.getTabCount()).toBe(initialTabCount + 1);
await sqlLabPage.closeLastTab();
expect(await sqlLabPage.getTabCount()).toBe(initialTabCount);
});
test('preserves query state when switching tabs', async () => {
const tabOneSql = `SELECT 'tab_one_${Date.now()}'`;
const tabTwoSql = `SELECT 'tab_two_${Date.now()}'`;
const firstTabName = await sqlLabPage.getActiveTabName();
await sqlLabPage.setQuery(tabOneSql);
await sqlLabPage.addTab();
await sqlLabPage.editor.waitForReady();
const secondTabName = await sqlLabPage.getActiveTabName();
await sqlLabPage.setQuery(tabTwoSql);
// Use positional selection — tab names can collide in CI (both tabs may be
// named "Untitled Query 1" depending on server-side tab state from prior tests).
// Content assertions use toPass() because the editor hydrates asynchronously
// after the tab switch — the Ace editor mounts first, then Redux populates it.
await sqlLabPage.getTab(firstTabName).first().click();
await sqlLabPage.editor.waitForReady();
await expect(async () => {
expect(await sqlLabPage.getQuery()).toContain('tab_one_');
}).toPass({ timeout: TIMEOUT.UI_TRANSITION });
await sqlLabPage.getTab(secondTabName).last().click();
await sqlLabPage.editor.waitForReady();
await expect(async () => {
expect(await sqlLabPage.getQuery()).toContain('tab_two_');
}).toPass({ timeout: TIMEOUT.UI_TRANSITION });
await sqlLabPage.closeLastTab();
});
test('should open new tab by keyboard shortcut with correct defaults', async ({
page,
}) => {
const initialTabCount = await sqlLabPage.getTabCount();
await sqlLabPage.setQuery('some random query string');
// Register before addTabByShortcut — EditorAutoSync POSTs the new tab
// within its 5 s interval, so the POST can fire before any later line.
const tabStatePromise = waitForPost(page, /tabstateview\/?$/);
await sqlLabPage.addTabByShortcut();
await sqlLabPage.editor.waitForReady();
expect(await sqlLabPage.getTabCount()).toBe(initialTabCount + 1);
// Verify new tab has default SQL (not carried over from previous tab)
const defaultContent = await sqlLabPage.getQuery();
expect(defaultContent).toContain('SELECT');
// Wait for the auto-sync POST that persists the new tab to the backend
await tabStatePromise;
await page.reload();
await sqlLabPage.waitForPageLoad();
await sqlLabPage.ensureEditorReady();
expect(await sqlLabPage.getTabCount()).toBe(initialTabCount + 1);
await sqlLabPage.closeLastTab();
expect(await sqlLabPage.getTabCount()).toBe(initialTabCount);
});
// ── Save and Share ──
test('saves a query and loads it from saved queries', async ({
page,
testAssets,
}) => {
const queryText = 'SELECT 1 AS saved_test_col';
const savedQueryTitle = `pw_test_saved_query_${Date.now()}`;
await expect(sqlLabPage.databaseSelector.element).toBeVisible();
const executeResponse = await sqlLabPage.executeQuery(queryText);
expectStatus(executeResponse, 200);
await sqlLabPage.waitForQueryResults('saved_test_col');
await sqlLabPage.saveButton.click();
const saveModal = new SaveQueryModal(page);
await saveModal.waitForReady();
await saveModal.fillName(savedQueryTitle);
const savePromise = waitForPost(page, 'api/v1/saved_query/', {
timeout: TIMEOUT.API_RESPONSE,
});
await saveModal.clickFooterButton('Save');
const saveResponse = await savePromise;
expectStatus(saveResponse, 201);
const savedQueryId = await extractIdFromResponse(saveResponse);
testAssets.trackSavedQuery(savedQueryId);
await saveModal.waitForHidden();
const getResponse = await apiGetSavedQuery(page, savedQueryId);
const savedQuery = (await getResponse.json()).result;
expect(savedQuery.sql).toContain('saved_test_col');
expect(savedQuery.label).toBe(savedQueryTitle);
// Navigate through the Saved Queries list UI (not deep-link) to verify
// the query appears in the list and can be loaded from there.
await page.goto(URL.SAVED_QUERIES_LIST, { waitUntil: 'domcontentloaded' });
await page.locator('.ant-table').waitFor({
state: 'visible',
timeout: TIMEOUT.PAGE_LOAD,
});
// Search for the saved query by its unique name
const searchInput = new Input(page, 'input[data-test="filters-search"]');
await searchInput.fill(savedQueryTitle);
// Wait for the filtered row to appear in the table
const queryLink = page.getByRole('link', { name: savedQueryTitle });
await queryLink.waitFor({ state: 'visible', timeout: TIMEOUT.API_RESPONSE });
// Navigate to SQL Lab with the saved query ID. The list-view React Router
// <Link> uses makeUrl() which double-prefixes with basename in CI, causing
// the click to silently fail. Direct navigation tests the loading path
// reliably — the list search above already proves the query appears in the UI.
await page.goto(`${URL.SQLLAB}?savedQueryId=${savedQueryId}`);
await sqlLabPage.waitForPageLoad();
await sqlLabPage.ensureEditorReady();
const loadedSql = await sqlLabPage.getQuery();
expect(loadedSql).toContain('saved_test_col');
});
test('creates a dataset from query results', async ({ page, testAssets }) => {
await sqlLabPage.selectDatabase('examples');
const executeResponse = await sqlLabPage.executeQuery(
'SELECT 1 AS ds_test_col',
);
expectStatus(executeResponse, 200);
await sqlLabPage.waitForQueryResults('ds_test_col');
await sqlLabPage.saveDatasetButton.click();
const saveDatasetModal = new SaveDatasetModal(page);
await saveDatasetModal.waitForReady();
const datasetName = `pw_test_dataset_${Date.now()}`;
await saveDatasetModal.fillName(datasetName);
const datasetCreatePromise = waitForPost(page, 'api/v1/dataset/', {
timeout: TIMEOUT.API_RESPONSE,
});
const newPagePromise = page.context().waitForEvent('page', {
timeout: TIMEOUT.API_RESPONSE,
});
await saveDatasetModal.clickFooterButton('Save & Explore');
const createResponse = await datasetCreatePromise;
const datasetId = await extractIdFromResponse(createResponse);
testAssets.trackDataset(datasetId);
const newPage = await newPagePromise;
const explorePage = new ExplorePage(newPage);
await explorePage.waitForPageLoad({ timeout: TIMEOUT.PAGE_LOAD });
const loadedDatasetName = await explorePage.getDatasetName();
expect(loadedDatasetName).toContain(datasetName);
await newPage.close();
});
// ── Create Chart ──
test('should navigate to Explore from SQL Lab query results', async ({
page,
}) => {
await sqlLabPage.selectDatabase('examples');
const query = 'SELECT gender, name FROM birth_names';
const executeResponse = await sqlLabPage.executeQuery(query);
expectStatus(executeResponse, 200);
await sqlLabPage.waitForQueryResults('gender');
await expect(sqlLabPage.createChartButton.element).toBeEnabled();
await sqlLabPage.createChartButton.click();
const explorePage = new ExplorePage(page);
await explorePage.waitForPageLoad({ timeout: TIMEOUT.PAGE_LOAD });
const datasetName = await explorePage.getDatasetName();
expect(datasetName).toContain(query);
});

View File

@@ -58,4 +58,20 @@ export const TIMEOUT = {
* File import/upload operations (upload + server processing)
*/
FILE_IMPORT: 30000, // 30s for file import operations
/**
* UI transition timeout (tab close, popover dismiss, dropdown close)
*/
UI_TRANSITION: 5000, // 5s ceiling for Ant Design animations (~300-500ms actual)
/**
* SQL query execution (query → backend processing → results)
*/
QUERY_EXECUTION: 15000, // 15s for SQL queries that may take longer than default expect timeout
/**
* Extended test timeout for multi-step tests (page load + query execution + assertions).
* Use with test.setTimeout() when the default 30s test timeout is insufficient.
*/
SLOW_TEST: 60000, // 60s for tests that chain multiple slow operations
} as const;

View File

@@ -33,6 +33,7 @@ export const URL = {
DASHBOARD_LIST: 'dashboard/list/',
DATASET_LIST: 'tablemodelview/list',
LOGIN: 'login/',
SAVED_QUERIES_LIST: 'savedqueryview/list/',
SQLLAB: 'sqllab',
WELCOME: 'superset/welcome/',
} as const;

View File

@@ -21,6 +21,7 @@
import d3 from 'd3';
import { extent as d3Extent } from 'd3-array';
import {
ValueFormatter,
getNumberFormatter,
getSequentialSchemeRegistry,
CategoricalColorNamespace,
@@ -60,7 +61,8 @@ interface CountryMapProps {
height: number;
country: string;
linearColorScheme: string;
numberFormat: string;
numberFormat?: string; // left for backward compatibility
formatter: ValueFormatter;
colorScheme: string;
sliceId: number;
}
@@ -74,13 +76,12 @@ function CountryMap(element: HTMLElement, props: CountryMapProps) {
height,
country,
linearColorScheme,
numberFormat,
formatter,
colorScheme,
sliceId,
} = props;
const container = element;
const format = getNumberFormatter(numberFormat);
const rawExtents = d3Extent(data, v => v.metric);
const extents: [number, number] =
rawExtents[0] != null && rawExtents[1] != null
@@ -182,7 +183,7 @@ function CountryMap(element: HTMLElement, props: CountryMapProps) {
.style('top', `${position[1] + 30}px`)
.style('left', `${position[0]}px`)
.html(
`<div><strong>${getNameOfRegion(d)}</strong><br>${result.length > 0 ? format(result[0].metric) : ''}</div>`,
`<div><strong>${getNameOfRegion(d)}</strong><br>${result.length > 0 ? formatter(result[0].metric) : ''}</div>`,
);
};

View File

@@ -69,6 +69,7 @@ const config: ControlPanelConfig = {
},
},
],
['currency_format'],
['linear_color_scheme'],
],
},

View File

@@ -16,26 +16,48 @@
* specific language governing permissions and limitations
* under the License.
*/
import { ChartProps } from '@superset-ui/core';
import { ChartProps, getValueFormatter } from '@superset-ui/core';
export default function transformProps(chartProps: ChartProps) {
const { width, height, formData, queriesData } = chartProps;
const { width, height, formData, queriesData, datasource } = chartProps;
const {
linearColorScheme,
numberFormat,
currencyFormat,
selectCountry,
colorScheme,
sliceId,
metric,
} = formData;
const {
currencyFormats = {},
columnFormats = {},
currencyCodeColumn,
} = datasource;
const { data, detected_currency: detectedCurrency } = queriesData[0];
const formatter = getValueFormatter(
metric,
currencyFormats,
columnFormats,
numberFormat,
currencyFormat,
undefined, // key - not needed for single-metric charts
data,
currencyCodeColumn,
detectedCurrency,
);
return {
width,
height,
data: queriesData[0].data,
country: selectCountry ? String(selectCountry).toLowerCase() : null,
linearColorScheme,
numberFormat,
numberFormat, // left for backward compatibility
colorScheme,
sliceId,
formatter,
};
}

View File

@@ -93,6 +93,7 @@ describe('CountryMap (legacy d3)', () => {
linearColorScheme="bnbColors"
colorScheme=""
numberFormat=".2f"
formatter={jest.fn().mockReturnValue('100')}
/>,
);
@@ -115,6 +116,7 @@ describe('CountryMap (legacy d3)', () => {
country="canada"
linearColorScheme="bnbColors"
colorScheme=""
formatter={jest.fn().mockReturnValue('100')}
/>,
);
@@ -144,6 +146,7 @@ describe('CountryMap (legacy d3)', () => {
country="canada"
linearColorScheme="bnbColors"
colorScheme=""
formatter={jest.fn().mockReturnValue('100')}
/>,
);

View File

@@ -1,55 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [0.20.0](https://github.com/apache/superset/compare/v2021.41.0...v0.20.0) (2024-09-09)
### Bug Fixes
- **deckgl:** deckgl unable to load map ([#17851](https://github.com/apache/superset/issues/17851)) ([52f5dcb](https://github.com/apache/superset/commit/52f5dcb58eec7b188f4387b8781dcda4252a5680))
- **explore:** Prevent shared controls from checking feature flags outside React render ([#21315](https://github.com/apache/superset/issues/21315)) ([2285ebe](https://github.com/apache/superset/commit/2285ebe72ec4edded6d195052740b7f9f13d1f1b))
### Features
- apply standardized form data to tier 2 charts ([#20530](https://github.com/apache/superset/issues/20530)) ([de524bc](https://github.com/apache/superset/commit/de524bc59f011fd361dcdb7d35c2cb51f7eba442))
- **deckgl-map:** use an arbitraty Mabpox style URL ([#26027](https://github.com/apache/superset/issues/26027)) ([#26031](https://github.com/apache/superset/issues/26031)) ([af58784](https://github.com/apache/superset/commit/af587840403d83a7da7fb0f57bc10ad2335d4eeb))
# [0.19.0](https://github.com/apache/superset/compare/v2021.41.0...v0.19.0) (2024-09-07)
### Bug Fixes
- **deckgl:** deckgl unable to load map ([#17851](https://github.com/apache/superset/issues/17851)) ([52f5dcb](https://github.com/apache/superset/commit/52f5dcb58eec7b188f4387b8781dcda4252a5680))
- **explore:** Prevent shared controls from checking feature flags outside React render ([#21315](https://github.com/apache/superset/issues/21315)) ([2285ebe](https://github.com/apache/superset/commit/2285ebe72ec4edded6d195052740b7f9f13d1f1b))
### Features
- apply standardized form data to tier 2 charts ([#20530](https://github.com/apache/superset/issues/20530)) ([de524bc](https://github.com/apache/superset/commit/de524bc59f011fd361dcdb7d35c2cb51f7eba442))
- **deckgl-map:** use an arbitraty Mabpox style URL ([#26027](https://github.com/apache/superset/issues/26027)) ([#26031](https://github.com/apache/superset/issues/26031)) ([af58784](https://github.com/apache/superset/commit/af587840403d83a7da7fb0f57bc10ad2335d4eeb))
# [0.18.0](https://github.com/apache-superset/superset-ui/compare/v0.17.87...v0.18.0) (2021-08-30)
**Note:** Version bump only for package @superset-ui/legacy-plugin-chart-map-box
## [0.17.61](https://github.com/apache-superset/superset-ui/compare/v0.17.60...v0.17.61) (2021-07-02)
**Note:** Version bump only for package @superset-ui/legacy-plugin-chart-map-box

View File

@@ -1,52 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
## @superset-ui/legacy-plugin-chart-map-box
[![Version](https://img.shields.io/npm/v/@superset-ui/legacy-plugin-chart-map-box.svg?style=flat)](https://www.npmjs.com/package/@superset-ui/legacy-plugin-chart-map-box)
[![Libraries.io](https://img.shields.io/librariesio/release/npm/%40superset-ui%2Flegacy-plugin-chart-map-box?style=flat)](https://libraries.io/npm/@superset-ui%2Flegacy-plugin-chart-map-box)
This plugin provides MapBox for Superset.
### Usage
Configure `key`, which can be any `string`, and register the plugin. This `key` will be used to
lookup this chart throughout the app.
```js
import MapBoxChartPlugin from '@superset-ui/legacy-plugin-chart-map-box';
new MapBoxChartPlugin().configure({ key: 'map-box' }).register();
```
Then use it via `SuperChart`. See
[storybook](https://apache-superset.github.io/superset-ui-plugins/?selectedKind=plugin-chart-map-box)
for more details.
```js
<SuperChart
chartType="map-box"
width={600}
height={600}
formData={...}
queriesData={[{
data: {...},
}]}
/>
```

View File

@@ -1,243 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* eslint-disable react/jsx-sort-default-props, react/sort-prop-types */
/* eslint-disable react/forbid-prop-types, react/require-default-props */
import { Component } from 'react';
import MapGL from 'react-map-gl';
import { WebMercatorViewport } from '@math.gl/web-mercator';
import ScatterPlotGlowOverlay from './ScatterPlotGlowOverlay';
import './MapBox.css';
const NOOP = () => {};
export const DEFAULT_MAX_ZOOM = 16;
export const DEFAULT_POINT_RADIUS = 60;
interface Viewport {
longitude: number;
latitude: number;
zoom: number;
isDragging?: boolean;
}
interface Clusterer {
getClusters(bbox: number[], zoom: number): GeoJSONLocation[];
}
interface GeoJSONLocation {
geometry: {
coordinates: [number, number];
};
properties: Record<string, number | string | boolean | null | undefined>;
}
interface MapBoxProps {
width?: number;
height?: number;
aggregatorName?: string;
clusterer: Clusterer; // Required - used for getClusters()
globalOpacity?: number;
hasCustomMetric?: boolean;
mapStyle?: string;
mapboxApiKey: string;
onViewportChange?: (viewport: Viewport) => void;
pointRadius?: number;
pointRadiusUnit?: string;
renderWhileDragging?: boolean;
rgb?: (string | number)[];
bounds?: [[number, number], [number, number]]; // May be undefined for empty datasets
viewportLongitude?: number;
viewportLatitude?: number;
viewportZoom?: number;
}
interface MapBoxState {
viewport: Viewport;
}
const defaultProps: Partial<MapBoxProps> = {
width: 400,
height: 400,
globalOpacity: 1,
onViewportChange: NOOP,
pointRadius: DEFAULT_POINT_RADIUS,
pointRadiusUnit: 'Pixels',
};
class MapBox extends Component<MapBoxProps, MapBoxState> {
static defaultProps = defaultProps;
constructor(props: MapBoxProps) {
super(props);
const fitBounds = this.computeFitBoundsViewport();
this.state = {
viewport: this.mergeViewportWithProps(fitBounds),
};
this.handleViewportChange = this.handleViewportChange.bind(this);
}
handleViewportChange(viewport: Viewport) {
this.setState({ viewport });
const { onViewportChange } = this.props;
onViewportChange!(viewport);
}
mergeViewportWithProps(
fitBounds: Viewport,
viewport: Viewport = fitBounds,
props: MapBoxProps = this.props,
useFitBoundsForUnset = true,
): Viewport {
const { viewportLongitude, viewportLatitude, viewportZoom } = props;
return {
...viewport,
longitude:
viewportLongitude ??
(useFitBoundsForUnset ? fitBounds.longitude : viewport.longitude),
latitude:
viewportLatitude ??
(useFitBoundsForUnset ? fitBounds.latitude : viewport.latitude),
zoom:
viewportZoom ?? (useFitBoundsForUnset ? fitBounds.zoom : viewport.zoom),
};
}
computeFitBoundsViewport(): Viewport {
const { width = 400, height = 400, bounds } = this.props;
if (bounds && bounds[0] && bounds[1]) {
const mercator = new WebMercatorViewport({ width, height }).fitBounds(
bounds,
);
return {
latitude: mercator.latitude,
longitude: mercator.longitude,
zoom: mercator.zoom,
};
}
return { latitude: 0, longitude: 0, zoom: 1 };
}
componentDidUpdate(prevProps: MapBoxProps) {
const { viewport } = this.state;
const fitBoundsInputsChanged =
prevProps.width !== this.props.width ||
prevProps.height !== this.props.height ||
prevProps.bounds !== this.props.bounds;
const viewportPropsChanged =
prevProps.viewportLongitude !== this.props.viewportLongitude ||
prevProps.viewportLatitude !== this.props.viewportLatitude ||
prevProps.viewportZoom !== this.props.viewportZoom;
if (!fitBoundsInputsChanged && !viewportPropsChanged) {
return;
}
const fitBounds = this.computeFitBoundsViewport();
const nextViewport = this.mergeViewportWithProps(
fitBounds,
viewport,
this.props,
fitBoundsInputsChanged || viewportPropsChanged,
);
const viewportChanged =
nextViewport.longitude !== viewport.longitude ||
nextViewport.latitude !== viewport.latitude ||
nextViewport.zoom !== viewport.zoom;
if (viewportChanged) {
this.setState({ viewport: nextViewport });
}
}
render() {
const {
width,
height,
aggregatorName,
clusterer,
globalOpacity,
mapStyle,
mapboxApiKey,
pointRadius,
pointRadiusUnit,
renderWhileDragging,
rgb,
hasCustomMetric,
bounds,
} = this.props;
const { viewport } = this.state;
const isDragging =
viewport.isDragging === undefined ? false : viewport.isDragging;
// Compute the clusters based on the original bounds and current zoom level. Note when zoom/pan
// to an area outside of the original bounds, no additional queries are made to the backend to
// retrieve additional data.
// add this variable to widen the visible area
const offsetHorizontal = ((width ?? 400) * 0.5) / 100;
const offsetVertical = ((height ?? 400) * 0.5) / 100;
// Guard against empty datasets where bounds may be undefined
const bbox =
bounds && bounds[0] && bounds[1]
? [
bounds[0][0] - offsetHorizontal,
bounds[0][1] - offsetVertical,
bounds[1][0] + offsetHorizontal,
bounds[1][1] + offsetVertical,
]
: [-180, -90, 180, 90]; // Default to world bounds
const clusters = clusterer.getClusters(bbox, Math.round(viewport.zoom));
return (
<MapGL
{...viewport}
mapStyle={mapStyle}
width={width}
height={height}
mapboxApiAccessToken={mapboxApiKey}
onViewportChange={this.handleViewportChange}
preserveDrawingBuffer
>
<ScatterPlotGlowOverlay
{...viewport}
isDragging={isDragging}
locations={clusters}
dotRadius={pointRadius}
pointRadiusUnit={pointRadiusUnit}
rgb={rgb}
globalOpacity={globalOpacity}
compositeOperation="screen"
renderWhileDragging={renderWhileDragging}
aggregation={hasCustomMetric ? aggregatorName : undefined}
lngLatAccessor={(location: GeoJSONLocation) => {
const { coordinates } = location.geometry;
return [coordinates[0], coordinates[1]];
}}
/>
</MapGL>
);
}
}
export default MapBox;

Some files were not shown because too many files have changed in this diff Show More