Compare commits

...

180 Commits

Author SHA1 Message Date
Maxime Beauchemin
36cf9337a8 chore(list-view): make SelectOption.title an explicit typed field
Follow-up from code review on sc-104554. `SelectOption.title` was
previously accessed via the `[key: string]: unknown` index signature,
making the "plain-text fallback" contract implicit. Make it a typed
optional string so callers can rely on it and TypeScript can enforce
the shape. Simplify the label-resolution expression in `Select.tsx`
accordingly.
2026-04-21 05:09:52 +00:00
Maxime Beauchemin
d952109cbc fix(list-view): preserve user name in filter pill after navigation
In the Chart list (and other CRUD lists), filtering by a user, navigating
into an asset, and returning to the list replaced the user's name in the
filter pill with a numeric user id.

Root cause: Owner filter options supply a React element as `label` (via
`OwnerSelectLabel`, which renders name + email). When a selection was
serialized to URL / filter state, `SelectFilter.onChange` only accepted
string labels and otherwise fell back to `String(selected.value)` (the
numeric id). On return to the list, the rehydrated `{label, value}` held
the numeric id as the label and that is what the pill rendered.

Prefer the option's plain-text `title` (already set to the human-readable
name by `createFetchOwners`) before falling back to the stringified value.
Add a unit test covering both the ReactNode-with-title path and the
no-title fallback.
2026-04-21 04:51:48 +00:00
Maxime Beauchemin
151d7d76da fix(charts): set g.form_data for metric() Jinja macro on GET chart data endpoint (#39347)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-20 19:36:03 -07:00
Maxime Beauchemin
4f19bc4c5f fix(table): ensure dimensions appear before metrics in column order (#39346)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-20 17:44:26 -07:00
Beto Dealmeida
11607dde04 feat(sqllab): syntax validation for sqlite-based DB engine specs (#38698)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-04-20 18:29:51 -04:00
dependabot[bot]
e1bdb94efc chore(deps-dev): bump globals from 17.4.0 to 17.5.0 in /docs (#39479)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-20 15:16:03 -07:00
Beto Dealmeida
6535fdd556 chore: simplify Trino's OAuth detection (#39496) 2026-04-20 18:08:48 -04:00
Beto Dealmeida
5fb89b865d fix(oauth2): silence lock acquisition errors on token refresh (#39463)
Co-authored-by: Beto Dealmeida <beto@preset.io>
2026-04-20 18:08:33 -04:00
Amin Ghadersohi
6948e73ec7 feat(mcp): add get_chart_sql tool and expose chart filters in get_chart_info (#38700) 2026-04-20 17:50:10 -04:00
Maxime Beauchemin
c4cf03f899 fix(import): import tags during CLI native asset import (#39495)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-20 13:59:51 -07:00
Joe Li
d3de16c5f5 fix(dashboard): restore groupby in buildExistingColumnsSet and guard null customization config (#39416)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Richard Fogaça <richardfogaca@gmail.com>
2026-04-20 13:24:22 -07:00
bdonovan1
78fb09695b fix(chart): word cloud secondary sort prevents Druid TopN optimization when sort_by_metric enabled (#39073)
Co-authored-by: Brian Donovan <briand@netflix.com>
2026-04-20 16:28:31 -03:00
dependabot[bot]
06818008c2 chore(deps-dev): bump eslint from 10.2.0 to 10.2.1 in /superset-websocket (#39473)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-20 12:07:15 -07:00
dependabot[bot]
52ba4fd0cb chore(deps): bump antd from 6.3.5 to 6.3.6 in /docs (#39480)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-20 12:01:59 -07:00
Aitema-gmbh
4f2fa41f4e fix(a11y): WCAG 3.1.2 — set HTML lang attribute dynamically from locale (#39243)
Co-authored-by: Fedo Hagge-Kubat <office@aitema.org>
2026-04-20 11:33:10 -07:00
Kamil Gabryjelski
bf7ec853fa fix(big-number): use correct default font size for subtitle/subheader (#39493) 2026-04-20 18:21:18 +02:00
Michael S. Molina
9fe3f634ec perf(sql-lab): debounce schema browser search (#39489)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 12:59:01 -03:00
dependabot[bot]
899e9294b2 chore(deps): bump maplibre-gl from 5.22.0 to 5.23.0 in /superset-frontend (#39475)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-20 08:40:46 -07:00
dependabot[bot]
dc9b459b27 chore(deps): bump actions/setup-node from 6.3.0 to 6.4.0 (#39481)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-20 08:34:02 -07:00
wanjoc
7d3881f1da docs: Added instructions on configuring Superset SECRET_KEY (#25646)
Co-authored-by: Superset Dev <dev@superset.apache.org>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 08:33:27 -07:00
Evan Rusackas
e5f9a6bf4b chore(lint): convert superset-ui-core chart-composition to function components (#39455)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 08:33:04 -07:00
Amin Ghadersohi
5cff657812 fix(mcp): default XY chart x-axis to dataset primary datetime column (#39421)
Co-authored-by: codeant-ai-for-open-source[bot] <244253245+codeant-ai-for-open-source[bot]@users.noreply.github.com>
2026-04-20 11:14:54 -04:00
Arunkumar S
16387b0815 fix(sqllab): remove duplicate tooltip on share query link icon (#39289) 2026-04-20 22:01:21 +07:00
Alexandru Soare
0857611a4e fix(mcp): Add defensive validator for ColumnInfo.is_nullable (#39365) 2026-04-20 13:50:31 +03:00
Geidō
51ea2c297d fix(dataset): calculated columns in virtual datasets fail when used as dynamic aggregation filter dimensions (#39004)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 13:44:53 +03:00
dependabot[bot]
fbd062165e chore(deps): bump @swc/core from 1.15.24 to 1.15.26 in /docs (#39374)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-19 21:40:19 +07:00
dependabot[bot]
55625c911f chore(deps-dev): bump timezone-mock from 1.4.0 to 1.4.2 in /superset-frontend (#38049)
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: Joe Li <joe@preset.io>
Co-authored-by: hainenber <dotronghai96@gmail.com>
2026-04-19 17:19:08 +07:00
dependabot[bot]
fca64de8e9 chore(deps-dev): bump prettier from 3.8.2 to 3.8.3 in /superset-frontend (#39372)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-19 11:19:22 +07:00
dependabot[bot]
03725d1aaa chore(deps): bump dompurify from 3.3.3 to 3.4.0 in /superset-frontend (#39399)
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-19 10:58:36 +07:00
dependabot[bot]
a9487cbc84 chore(deps): bump aws-actions/amazon-ecr-login from 2.1.2 to 2.1.3 (#39403)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-18 12:51:07 +07:00
dependabot[bot]
ce5b2aa424 chore(deps): bump actions/upload-artifact from 7.0.0 to 7.0.1 (#39320)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-18 12:49:30 +07:00
dependabot[bot]
e535dce030 chore(deps-dev): bump prettier from 3.8.1 to 3.8.3 in /docs (#39400)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-18 11:58:29 +07:00
dependabot[bot]
a7310b1fce chore(deps): bump @docusaurus/core from 3.9.2 to 3.10.0 in /docs (#39188)
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: Đỗ Trọng Hải <41283691+hainenber@users.noreply.github.com>
Co-authored-by: hainenber <dotronghai96@gmail.com>
2026-04-18 11:43:47 +07:00
dependabot[bot]
cd6ce881a5 chore(deps): bump dompurify from 3.3.3 to 3.4.0 in /docs (#39398)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-18 09:54:38 +07:00
dependabot[bot]
f0ef9f5e9c chore(deps-dev): bump webpack from 5.105.4 to 5.106.2 in /docs (#39401)
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-18 09:52:53 +07:00
dependabot[bot]
4ae16cb140 chore(deps-dev): bump typescript-eslint from 8.58.0 to 8.58.2 in /docs (#39426)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-18 09:27:11 +07:00
David Hotham
3d85e8e23b chore: publish wheels (#36746)
Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
2026-04-17 17:21:23 -03:00
Evan Rusackas
690a411cf3 chore(ci): require PMC review for CI-executed scripts (#39462)
Co-authored-by: Claude Code <noreply@anthropic.com>
2026-04-17 12:55:27 -07:00
JUST.in DO IT
be680408c9 fix(sqllab): enhance table explore tree with schema pinning, column sorting, and table schema refresh (#39396)
Co-authored-by: Michael S. Molina <michael.s.molina@gmail.com>
2026-04-17 09:08:46 -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
637 changed files with 32113 additions and 8343 deletions

5
.github/CODEOWNERS vendored
View File

@@ -22,6 +22,11 @@
/.github/ @villebro @geido @eschutho @rusackas @betodealmeida @nytai @mistercrunch @craig-rueda @kgabryje @dpgaspar @sadpandajoe @hainenber
# Notify PMC members of changes to CI-executed scripts (supply-chain risk:
# scripts/ files run directly in CI workflows and can execute arbitrary code)
/scripts/ @villebro @geido @eschutho @rusackas @betodealmeida @nytai @mistercrunch @craig-rueda @kgabryje @dpgaspar @sadpandajoe @hainenber
# Notify PMC members of changes to required GitHub Actions
/.asf.yaml @villebro @geido @eschutho @rusackas @betodealmeida @nytai @mistercrunch @craig-rueda @kgabryje @dpgaspar @Antonio-RiveroMartnez

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"

5
.github/labeler.yml vendored
View File

@@ -17,6 +17,11 @@
- any-glob-to-any-file:
- 'superset/migrations/**'
"risk:ci-script":
- changed-files:
- any-glob-to-any-file:
- 'scripts/**'
############################################
# Dependencies
############################################

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

@@ -31,7 +31,7 @@ jobs:
working-directory: superset-embedded-sdk
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: './superset-embedded-sdk/.nvmrc'
registry-url: 'https://registry.npmjs.org'

View File

@@ -19,7 +19,7 @@ jobs:
working-directory: superset-embedded-sdk
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: './superset-embedded-sdk/.nvmrc'
registry-url: 'https://registry.npmjs.org'

View File

@@ -58,7 +58,7 @@ jobs:
- name: Login to Amazon ECR
if: steps.describe-services.outputs.active == 'true'
id: login-ecr
uses: aws-actions/amazon-ecr-login@f2e9fc6c2b355c1890b65e6f6f0e2ac3e6e22f78 # v2
uses: aws-actions/amazon-ecr-login@376925c9d111252e87ae59691e5a442dd100ef6a # v2
- name: Delete ECR image tag
if: steps.describe-services.outputs.active == 'true'
@@ -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 }}
@@ -199,7 +199,7 @@ jobs:
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@f2e9fc6c2b355c1890b65e6f6f0e2ac3e6e22f78 # v2
uses: aws-actions/amazon-ecr-login@376925c9d111252e87ae59691e5a442dd100ef6a # v2
- name: Load, tag and push image to ECR
id: push-image
@@ -235,7 +235,7 @@ jobs:
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@f2e9fc6c2b355c1890b65e6f6f0e2ac3e6e22f78 # v2
uses: aws-actions/amazon-ecr-login@376925c9d111252e87ae59691e5a442dd100ef6a # v2
- name: Check target image exists in ECR
id: check-image
@@ -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:
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: '20'

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

@@ -42,7 +42,7 @@ jobs:
echo "HOMEBREW_REPOSITORY=$HOMEBREW_REPOSITORY" >>"${GITHUB_ENV}"
brew install norwoodj/tap/helm-docs
- name: Setup Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: '20'
@@ -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

@@ -44,13 +44,13 @@ jobs:
- name: Install Node.js
if: env.HAS_TAGS
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: './superset-frontend/.nvmrc'
- 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

@@ -46,7 +46,7 @@ jobs:
persist-credentials: false
submodules: recursive
- name: Set up Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: './docs/.nvmrc'
- name: Setup Python
@@ -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

@@ -72,7 +72,7 @@ jobs:
persist-credentials: false
submodules: recursive
- name: Set up Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: './docs/.nvmrc'
- name: yarn install
@@ -104,14 +104,14 @@ jobs:
persist-credentials: false
submodules: recursive
- name: Set up Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: './docs/.nvmrc'
- name: yarn install
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

@@ -109,7 +109,7 @@ jobs:
run: testdata
- name: Setup Node.js
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: './superset-frontend/.nvmrc'
- name: Install npm dependencies
@@ -146,7 +146,7 @@ jobs:
SAFE_APP_ROOT=${APP_ROOT//\//_}
echo "safe_app_root=$SAFE_APP_ROOT" >> $GITHUB_OUTPUT
- name: Upload Artifacts
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
if: failure()
with:
path: ${{ github.workspace }}/superset-frontend/cypress-base/cypress/screenshots
@@ -226,7 +226,7 @@ jobs:
run: playwright_testdata
- name: Setup Node.js
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: './superset-frontend/.nvmrc'
- name: Install npm dependencies
@@ -259,7 +259,7 @@ jobs:
SAFE_APP_ROOT=${APP_ROOT//\//_}
echo "safe_app_root=$SAFE_APP_ROOT" >> $GITHUB_OUTPUT
- name: Upload Playwright Artifacts
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
if: failure()
with:
path: |

View File

@@ -58,7 +58,7 @@ jobs:
- name: Upload HTML coverage report
if: steps.check.outputs.superset-extensions-cli
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: superset-extensions-cli-coverage-html
path: htmlcov/

View File

@@ -58,7 +58,7 @@ jobs:
- name: Upload Docker Image Artifact
if: steps.check.outputs.frontend
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: docker-image
path: docker-image.tar.zst
@@ -91,7 +91,7 @@ jobs:
"npm run test -- --coverage --shard=${{ matrix.shard }}/8 --coverageReporters=json"
- name: Upload Coverage Artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: coverage-artifacts-${{ matrix.shard }}
path: superset-frontend/coverage

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

@@ -100,7 +100,7 @@ jobs:
run: playwright_testdata
- name: Setup Node.js
if: steps.check.outputs.python || steps.check.outputs.frontend
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: './superset-frontend/.nvmrc'
- name: Install npm dependencies
@@ -133,7 +133,7 @@ jobs:
SAFE_APP_ROOT=${APP_ROOT//\//_}
echo "safe_app_root=$SAFE_APP_ROOT" >> $GITHUB_OUTPUT
- name: Upload Playwright Artifacts
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
if: failure()
with:
path: |

View File

@@ -101,7 +101,7 @@ jobs:
"
- name: Upload database diagnostics artifact
if: steps.check.outputs.python
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: database-diagnostics
path: databases-diagnostics.json

View File

@@ -31,7 +31,7 @@ jobs:
- name: Setup Node.js
if: steps.check.outputs.frontend
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: './superset-frontend/.nvmrc'
- name: Install dependencies

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

@@ -62,7 +62,7 @@ jobs:
build: "true"
- name: Use Node.js 20
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 20
@@ -117,7 +117,7 @@ jobs:
fetch-depth: 0
- name: Use Node.js 20
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 20

View File

@@ -35,7 +35,7 @@ jobs:
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version-file: './superset-frontend/.nvmrc'

View File

@@ -458,7 +458,7 @@ cd ../
sed -i '' "s/version_string = .*/version_string = \"$SUPERSET_VERSION\"/" setup.py
# build the python distribution
python setup.py sdist
python -m build
```
Publish to PyPI

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

@@ -109,6 +109,14 @@ SECRET_KEY = 'YOUR_OWN_RANDOM_GENERATED_SECRET_KEY'
You can generate a strong secure key with `openssl rand -base64 42`.
Alternatively, you can set the secret key using `SUPERSET_SECRET_KEY` environment variable:
On a Unix-based system, such as Linux or macOS, you can do so by running the following command in your terminal:
```bash
export SUPERSET_SECRET_KEY=$(openssl rand -base64 42)
```
:::caution Use a strong secret key
This key will be used for securely signing session cookies and encrypting sensitive information stored in Superset's application metadata database.
Your deployment must use a complex, unique key.

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

@@ -41,12 +41,12 @@
},
"dependencies": {
"@ant-design/icons": "^6.1.1",
"@docusaurus/core": "3.9.2",
"@docusaurus/faster": "^3.9.2",
"@docusaurus/plugin-client-redirects": "3.9.2",
"@docusaurus/preset-classic": "3.9.2",
"@docusaurus/theme-live-codeblock": "^3.9.2",
"@docusaurus/theme-mermaid": "^3.9.2",
"@docusaurus/core": "^3.10.0",
"@docusaurus/faster": "^3.10.0",
"@docusaurus/plugin-client-redirects": "^3.10.0",
"@docusaurus/preset-classic": "3.10.0",
"@docusaurus/theme-live-codeblock": "^3.10.0",
"@docusaurus/theme-mermaid": "^3.10.0",
"@emotion/core": "^11.0.0",
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.14.1",
@@ -67,12 +67,12 @@
"@storybook/preview-api": "^8.6.18",
"@storybook/theming": "^8.6.15",
"@superset-ui/core": "^0.20.4",
"@swc/core": "^1.15.21",
"antd": "^6.3.5",
"baseline-browser-mapping": "^2.10.13",
"caniuse-lite": "^1.0.30001784",
"docusaurus-plugin-openapi-docs": "^4.6.0",
"docusaurus-theme-openapi-docs": "^4.6.0",
"@swc/core": "^1.15.26",
"antd": "^6.3.6",
"baseline-browser-mapping": "^2.10.19",
"caniuse-lite": "^1.0.30001788",
"docusaurus-plugin-openapi-docs": "^5.0.1",
"docusaurus-theme-openapi-docs": "^5.0.1",
"js-yaml": "^4.1.1",
"js-yaml-loader": "^1.2.2",
"json-bigint": "^1.0.0",
@@ -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",
@@ -103,11 +103,11 @@
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.5",
"eslint-plugin-react": "^7.37.5",
"globals": "^17.4.0",
"prettier": "^3.8.1",
"globals": "^17.5.0",
"prettier": "^3.8.3",
"typescript": "~5.9.3",
"typescript-eslint": "^8.58.0",
"webpack": "^5.105.4"
"typescript-eslint": "^8.58.2",
"webpack": "^5.106.2"
},
"browserslist": {
"production": [
@@ -124,7 +124,8 @@
"resolutions": {
"react-redux": "^9.2.0",
"@reduxjs/toolkit": "^2.5.0",
"baseline-browser-mapping": "^2.9.19"
"baseline-browser-mapping": "^2.9.19",
"webpackbar": "^7.0.0"
},
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
}

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

File diff suppressed because it is too large Load Diff

View File

@@ -109,6 +109,14 @@ SECRET_KEY = 'YOUR_OWN_RANDOM_GENERATED_SECRET_KEY'
You can generate a strong secure key with `openssl rand -base64 42`.
Alternatively, you can set the secret key using `SUPERSET_SECRET_KEY` environment variable:
On a Unix-based system, such as Linux or macOS, you can do so by running the following command in your terminal:
```bash
export SUPERSET_SECRET_KEY=$(openssl rand -base64 42)
```
:::caution Use a strong secret key
This key will be used for securely signing session cookies and encrypting sensitive information stored in Superset's application metadata database.
Your deployment must use a complex, unique key.

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",
@@ -183,6 +183,7 @@ risingwave = ["sqlalchemy-risingwave"]
shillelagh = ["shillelagh[all]>=1.4.3, <2"]
singlestore = ["sqlalchemy-singlestoredb>=1.1.1, <2"]
snowflake = ["snowflake-sqlalchemy>=1.2.4, <2"]
sqlite = ["syntaqlite>=0.1.0"]
spark = [
"pyhive[hive]>=0.6.5;python_version<'3.11'",
"pyhive[hive_pure_sasl]>=0.7",
@@ -226,6 +227,7 @@ development = [
"ruff",
"sqloxide",
"statsd",
"syntaqlite>=0.1.0",
]
[project.urls]
@@ -238,7 +240,7 @@ combine_as_imports = true
include_trailing_comma = true
line_length = 88
known_first_party = "superset, apache-superset-core, apache-superset-extensions-cli"
known_third_party = "alembic, apispec, backoff, celery, click, colorama, cron_descriptor, croniter, cryptography, dateutil, deprecation, flask, flask_appbuilder, flask_babel, flask_caching, flask_compress, flask_jwt_extended, flask_login, flask_migrate, flask_sqlalchemy, flask_talisman, flask_testing, flask_wtf, freezegun, geohash, geopy, holidays, humanize, isodate, jinja2, jwt, markdown, markupsafe, marshmallow, marshmallow-union, msgpack, nh3, numpy, pandas, parameterized, parsedatetime, pgsanity, polyline, prison, progress, pyarrow, sqlalchemy_bigquery, pyhive, pyparsing, pytest, pytest_mock, pytz, redis, requests, selenium, setuptools, shillelagh, simplejson, slack, sqlalchemy, sqlalchemy_utils, typing_extensions, urllib3, werkzeug, wtforms, wtforms_json, yaml"
known_third_party = "alembic, apispec, backoff, celery, click, colorama, cron_descriptor, croniter, cryptography, dateutil, deprecation, flask, flask_appbuilder, flask_babel, flask_caching, flask_compress, flask_jwt_extended, flask_login, flask_migrate, flask_sqlalchemy, flask_talisman, flask_testing, flask_wtf, freezegun, geohash, geopy, holidays, humanize, isodate, jinja2, jwt, markdown, markupsafe, marshmallow, marshmallow-union, msgpack, nh3, numpy, pandas, parameterized, parsedatetime, pgsanity, polyline, prison, progress, pyarrow, sqlalchemy_bigquery, pyhive, pyparsing, pytest, pytest_mock, pytz, redis, requests, selenium, setuptools, shillelagh, simplejson, slack, sqlalchemy, sqlalchemy_utils, syntaqlite, typing_extensions, urllib3, werkzeug, wtforms, wtforms_json, yaml"
multi_line_output = 3
order_by_type = false
@@ -372,6 +374,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
@@ -992,6 +992,8 @@ starlette==0.49.1
# via mcp
statsd==4.0.1
# via apache-superset
syntaqlite==0.1.0
# via apache-superset
tabulate==0.9.0
# via
# -c requirements/base-constraint.txt

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.3",
"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

@@ -42,7 +42,7 @@
"d3-time": "^3.1.0",
"d3-time-format": "^4.1.0",
"dayjs": "^1.11.20",
"dompurify": "^3.3.3",
"dompurify": "^3.4.0",
"fetch-retry": "^6.0.0",
"handlebars": "^4.7.9",
"jed": "^1.1.1",
@@ -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",
@@ -85,7 +85,7 @@
"fetch-mock": "^12.6.0",
"jest-mock-console": "^2.0.0",
"resize-observer-polyfill": "1.5.1",
"timezone-mock": "1.4.0"
"timezone-mock": "^1.4.2"
},
"peerDependencies": {
"@emotion/cache": "^11.4.0",

View File

@@ -17,7 +17,7 @@
* under the License.
*/
import { PureComponent, ReactNode } from 'react';
import { memo, ReactNode } from 'react';
import { isDefined } from '../utils';
@@ -29,7 +29,7 @@ type Props = {
contentWidth?: number;
contentHeight?: number;
height: number;
renderContent: ({
renderContent?: ({
height,
width,
}: {
@@ -39,36 +39,35 @@ type Props = {
width: number;
};
export default class ChartFrame extends PureComponent<Props, {}> {
static defaultProps = {
renderContent() {},
};
function ChartFrame({
contentWidth,
contentHeight,
width,
height,
renderContent = () => null,
}: Props) {
const overflowX = checkNumber(contentWidth) && contentWidth > width;
const overflowY = checkNumber(contentHeight) && contentHeight > height;
render() {
const { contentWidth, contentHeight, width, height, renderContent } =
this.props;
const overflowX = checkNumber(contentWidth) && contentWidth > width;
const overflowY = checkNumber(contentHeight) && contentHeight > height;
if (overflowX || overflowY) {
return (
<div
style={{
height,
overflowX: overflowX ? 'auto' : 'hidden',
overflowY: overflowY ? 'auto' : 'hidden',
width,
}}
>
{renderContent({
height: Math.max(contentHeight ?? 0, height),
width: Math.max(contentWidth ?? 0, width),
})}
</div>
);
}
return renderContent({ height, width });
if (overflowX || overflowY) {
return (
<div
style={{
height,
overflowX: overflowX ? 'auto' : 'hidden',
overflowY: overflowY ? 'auto' : 'hidden',
width,
}}
>
{renderContent({
height: Math.max(contentHeight ?? 0, height),
width: Math.max(contentWidth ?? 0, width),
})}
</div>
);
}
return <>{renderContent({ height, width })}</>;
}
export default memo(ChartFrame);

View File

@@ -17,26 +17,19 @@
* under the License.
*/
import { CSSProperties, ReactNode, PureComponent } from 'react';
import { CSSProperties, ReactNode, memo, useMemo } from 'react';
import { ParentSize } from '@visx/responsive';
const defaultProps = {
className: '',
height: 'auto' as number | string,
position: 'top',
width: 'auto' as number | string,
};
type Props = {
className: string;
className?: string;
debounceTime?: number;
width: number | string;
height: number | string;
width?: number | string;
height?: number | string;
legendJustifyContent?: 'center' | 'flex-start' | 'flex-end';
position: 'top' | 'left' | 'bottom' | 'right';
position?: 'top' | 'left' | 'bottom' | 'right';
renderChart: (dim: { width: number; height: number }) => ReactNode;
renderLegend?: (params: { direction: string }) => ReactNode;
} & Readonly<typeof defaultProps>;
};
const LEGEND_STYLE_BASE: CSSProperties = {
display: 'flex',
@@ -52,95 +45,101 @@ const CHART_STYLE_BASE: CSSProperties = {
position: 'relative',
};
class WithLegend extends PureComponent<Props, {}> {
static defaultProps = defaultProps;
getContainerDirection(): CSSProperties['flexDirection'] {
const { position } = this.props;
if (position === 'left') {
return 'row';
}
if (position === 'right') {
return 'row-reverse';
}
if (position === 'bottom') {
return 'column-reverse';
}
return 'column';
function getContainerDirection(
position: Props['position'],
): CSSProperties['flexDirection'] {
if (position === 'left') {
return 'row';
}
if (position === 'right') {
return 'row-reverse';
}
if (position === 'bottom') {
return 'column-reverse';
}
getLegendJustifyContent() {
const { legendJustifyContent, position } = this.props;
if (legendJustifyContent) {
return legendJustifyContent;
}
if (position === 'left' || position === 'right') {
return 'flex-start';
}
return 'flex-end';
}
render() {
const {
className,
debounceTime,
width,
height,
position,
renderChart,
renderLegend,
} = this.props;
const isHorizontal = position === 'left' || position === 'right';
const style: CSSProperties = {
display: 'flex',
flexDirection: this.getContainerDirection(),
height,
width,
};
const chartStyle: CSSProperties = { ...CHART_STYLE_BASE };
if (isHorizontal) {
chartStyle.width = 0;
} else {
chartStyle.height = 0;
}
const legendDirection = isHorizontal ? 'column' : 'row';
const legendStyle: CSSProperties = {
...LEGEND_STYLE_BASE,
flexDirection: legendDirection,
justifyContent: this.getLegendJustifyContent(),
};
return (
<div className={`with-legend ${className}`} style={style}>
{renderLegend && (
<div className="legend-container" style={legendStyle}>
{renderLegend({
// Pass flexDirection for @vx/legend to arrange legend items
direction: legendDirection,
})}
</div>
)}
<div className="main-container" style={chartStyle}>
<ParentSize debounceTime={debounceTime}>
{(parent: { width: number; height: number }) =>
parent.width > 0 && parent.height > 0
? // Only render when necessary
renderChart(parent)
: null
}
</ParentSize>
</div>
</div>
);
}
return 'column';
}
export default WithLegend;
function getLegendJustifyContent(
legendJustifyContent: Props['legendJustifyContent'],
position: Props['position'],
) {
if (legendJustifyContent) {
return legendJustifyContent;
}
if (position === 'left' || position === 'right') {
return 'flex-start';
}
return 'flex-end';
}
function WithLegend({
className = '',
debounceTime,
width = 'auto',
height = 'auto',
legendJustifyContent,
position = 'top',
renderChart,
renderLegend,
}: Props) {
const isHorizontal = position === 'left' || position === 'right';
const style: CSSProperties = useMemo(
() => ({
display: 'flex',
flexDirection: getContainerDirection(position),
height,
width,
}),
[position, height, width],
);
const chartStyle: CSSProperties = useMemo(() => {
const baseStyle = { ...CHART_STYLE_BASE };
if (isHorizontal) {
baseStyle.width = 0;
} else {
baseStyle.height = 0;
}
return baseStyle;
}, [isHorizontal]);
const legendDirection = isHorizontal ? 'column' : 'row';
const legendStyle: CSSProperties = useMemo(
() => ({
...LEGEND_STYLE_BASE,
flexDirection: legendDirection,
justifyContent: getLegendJustifyContent(legendJustifyContent, position),
}),
[legendDirection, legendJustifyContent, position],
);
return (
<div className={`with-legend ${className}`} style={style}>
{renderLegend && (
<div className="legend-container" style={legendStyle}>
{renderLegend({
// Pass flexDirection for @vx/legend to arrange legend items
direction: legendDirection,
})}
</div>
)}
<div className="main-container" style={chartStyle}>
<ParentSize debounceTime={debounceTime}>
{(parent: { width: number; height: number }) =>
parent.width > 0 && parent.height > 0
? // Only render when necessary
renderChart(parent)
: null
}
</ParentSize>
</div>
</div>
);
}
export default memo(WithLegend);

View File

@@ -17,31 +17,21 @@
* under the License.
*/
import { PureComponent, ReactNode } from 'react';
const defaultProps = {
className: '',
};
import { memo, ReactNode } from 'react';
type Props = {
className?: string;
children: ReactNode;
} & Readonly<typeof defaultProps>;
};
const CONTAINER_STYLE = { padding: 8 };
class TooltipFrame extends PureComponent<Props, {}> {
static defaultProps = defaultProps;
render() {
const { className, children } = this.props;
return (
<div className={className} style={CONTAINER_STYLE}>
{children}
</div>
);
}
function TooltipFrame({ className = '', children }: Props) {
return (
<div className={className} style={CONTAINER_STYLE}>
{children}
</div>
);
}
export default TooltipFrame;
export default memo(TooltipFrame);

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

@@ -109,10 +109,10 @@ test('should handle custom range with relative dates (now)', () => {
timeRangeFilter,
shifts,
startDate,
['5 days ago'],
['4 days ago'],
);
runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [
'5 days ago',
'4 days ago',
]);
runTimezoneTest(
NOW_UTC_IN_PACIFIC,
@@ -218,10 +218,10 @@ test('should handle null timeRangeFilter', () => {
timeRangeFilter,
shifts,
startDate,
['3 days ago'],
['2 days ago'],
);
runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [
'3 days ago',
'2 days ago',
]);
runTimezoneTest(
NOW_UTC_IN_PACIFIC,
@@ -304,10 +304,10 @@ test('should handle custom range with DATEADD function and relative start date',
timeRangeFilter,
shifts,
startDate,
['3 days ago'],
['2 days ago'],
);
runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [
'3 days ago',
'2 days ago',
]);
runTimezoneTest(
NOW_UTC_IN_PACIFIC,
@@ -362,10 +362,10 @@ test('should handle custom range with specific date and relative end date', () =
timeRangeFilter,
shifts,
startDate,
['8 days ago'],
['9 days ago'],
);
runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [
'8 days ago',
'9 days ago',
]);
runTimezoneTest(
NOW_UTC_IN_PACIFIC,
@@ -390,10 +390,10 @@ test('should handle custom range with specific date and specific end date', () =
timeRangeFilter,
shifts,
startDate,
['1 days ago'],
['2 days ago'],
);
runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [
'1 days ago',
'2 days ago',
]);
runTimezoneTest(
NOW_UTC_IN_PACIFIC,
@@ -474,7 +474,7 @@ test('should handle custom range with previous calendar week', () => {
timeRangeFilter,
shifts,
startDate,
['3 days ago'],
['1 days ago'],
);
runTimezoneTest(
'2024-06-05T00:06:00Z',
@@ -482,7 +482,7 @@ test('should handle custom range with previous calendar week', () => {
timeRangeFilter,
shifts,
startDate,
['3 days ago'],
['1 days ago'],
);
runTimezoneTest(
'2024-06-04T16:06:00-08:00',
@@ -507,7 +507,7 @@ test('should handle custom range with previous calendar month', () => {
timeRangeFilter,
shifts,
startDate,
['7 days ago'],
['5 days ago'],
);
runTimezoneTest(
'2024-06-05T00:06:00Z',
@@ -515,7 +515,7 @@ test('should handle custom range with previous calendar month', () => {
timeRangeFilter,
shifts,
startDate,
['7 days ago'],
['5 days ago'],
);
runTimezoneTest(
'2024-06-04T16:06:00-08:00',
@@ -541,7 +541,7 @@ test('should handle custom range with previous calendar year', () => {
timeRangeFilter,
shifts,
startDate,
['8 days ago'],
['6 days ago'],
);
runTimezoneTest(
'2024-06-05T00:06:00Z',
@@ -549,7 +549,7 @@ test('should handle custom range with previous calendar year', () => {
timeRangeFilter,
shifts,
startDate,
['8 days ago'],
['6 days ago'],
);
runTimezoneTest(
'2024-06-04T16:06:00-08:00',
@@ -760,10 +760,10 @@ test('should handle future custom shift with different format', () => {
timeRangeFilter,
shifts,
startDate,
['3 days after'],
['4 days after'],
);
runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [
'3 days after',
'4 days after',
]);
runTimezoneTest(
NOW_UTC_IN_PACIFIC,
@@ -771,7 +771,7 @@ test('should handle future custom shift with different format', () => {
timeRangeFilter,
shifts,
startDate,
['4 days after'],
['5 days after'],
);
});
@@ -850,10 +850,10 @@ test('should handle custom range with relative dates (hour)', () => {
timeRangeFilter,
shifts,
startDate,
['2 days ago'],
['4 days ago'],
);
runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [
'2 days ago',
'4 days ago',
]);
runTimezoneTest(
NOW_UTC_IN_PACIFIC,

View File

@@ -20,7 +20,7 @@
import { parseDttmToDate } from '@superset-ui/core';
import timezoneMock from 'timezone-mock';
// NOW will be set at midnight 2024-06-03 and transforme dfrom local timezone to UTC
// NOW will be set at midnight 2024-06-03 and transformed from local timezone to UTC
const NOW_IN_UTC = '2024-06-03T00:00:00Z';
const NOW_UTC_IN_EUROPE = '2024-06-02T22:00:00Z'; // Same as 2024-06-03T00:00:00+02:00
const NOW_UTC_IN_PACIFIC = '2024-06-03T08:00:00Z'; // Same as 2024-06-03T00:00:00-08:00
@@ -69,9 +69,9 @@ test('should return the current date for "today"', () => {
'today',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-06-01T22:00:00Z'),
new Date('2024-06-02T22:00:00Z'),
);
runTimezoneTest('today', NOW_IN_UTC, 'UTC', new Date('2024-06-02T00:00:00Z'));
runTimezoneTest('today', NOW_IN_UTC, 'UTC', new Date('2024-06-03T00:00:00Z'));
runTimezoneTest(
'today',
NOW_UTC_IN_PACIFIC,
@@ -125,13 +125,13 @@ test('should return yesterday date for "Last day"', () => {
'Last day',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-05-31T22:00:00Z'),
new Date('2024-06-01T22:00:00Z'),
);
runTimezoneTest(
'Last day',
NOW_IN_UTC,
'UTC',
new Date('2024-06-01T00:00:00Z'),
new Date('2024-06-02T00:00:00Z'),
);
runTimezoneTest(
'Last day',
@@ -147,13 +147,13 @@ test('should return the date one week ago for "Last week"', () => {
'Last week',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-05-25T22:00:00Z'),
new Date('2024-05-26T22:00:00Z'),
);
runTimezoneTest(
'Last week',
NOW_IN_UTC,
'UTC',
new Date('2024-05-26T00:00:00Z'),
new Date('2024-05-27T00:00:00Z'),
);
runTimezoneTest(
'Last week',
@@ -169,13 +169,13 @@ test('should return the date one month ago for "Last month"', () => {
'Last month',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-05-01T22:00:00Z'),
new Date('2024-05-02T22:00:00Z'),
);
runTimezoneTest(
'Last month',
NOW_IN_UTC,
'UTC',
new Date('2024-05-02T00:00:00Z'),
new Date('2024-05-03T00:00:00Z'),
);
runTimezoneTest(
'Last month',
@@ -191,13 +191,13 @@ test('should return the date three months ago for "Last quarter"', () => {
'Last quarter',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-03-01T22:00:00Z'),
new Date('2024-03-02T22:00:00Z'),
);
runTimezoneTest(
'Last quarter',
NOW_IN_UTC,
'UTC',
new Date('2024-03-02T00:00:00Z'),
new Date('2024-03-03T00:00:00Z'),
);
runTimezoneTest(
'Last quarter',
@@ -213,13 +213,13 @@ test('should return the date one year ago for "Last year"', () => {
'Last year',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2023-06-01T22:00:00Z'),
new Date('2023-06-02T22:00:00Z'),
);
runTimezoneTest(
'Last year',
NOW_IN_UTC,
'UTC',
new Date('2023-06-02T00:00:00Z'),
new Date('2023-06-03T00:00:00Z'),
);
runTimezoneTest(
'Last year',
@@ -235,19 +235,19 @@ test('should return the date for "previous calendar week"', () => {
'previous calendar week',
'2024-06-04T22:00:00Z',
'Etc/GMT-2',
new Date('2024-05-27T16:00:00Z'),
new Date('2024-05-26T22:00:00Z'),
);
runTimezoneTest(
'previous calendar week',
'2024-06-05T00:00:00Z',
'UTC',
new Date('2024-05-27T20:00:00Z'),
new Date('2024-05-27T00:00:00Z'),
);
runTimezoneTest(
'previous calendar week',
'2024-06-05T08:00:00Z',
'Etc/GMT+8',
new Date('2024-05-27T12:00:00Z'),
new Date('2024-05-27T08:00:00Z'),
);
});
@@ -257,19 +257,19 @@ test('should return the date for "previous calendar month"', () => {
'previous calendar month',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-05-01T10:00:00Z'),
new Date('2024-04-30T22:00:00Z'),
);
runTimezoneTest(
'previous calendar month',
NOW_IN_UTC,
'UTC',
new Date('2024-05-01T16:00:00Z'),
new Date('2024-05-01T00:00:00Z'),
);
runTimezoneTest(
'previous calendar month',
NOW_UTC_IN_PACIFIC,
'Etc/GMT+8',
new Date('2024-05-01T16:00:00Z'),
new Date('2024-05-01T08:00:00Z'),
);
});
@@ -279,19 +279,19 @@ test('should return the date for "previous calendar year"', () => {
'previous calendar year',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2023-01-01T16:00:00Z'),
new Date('2022-12-31T22:00:00Z'),
);
runTimezoneTest(
'previous calendar year',
NOW_IN_UTC,
'UTC',
new Date('2023-01-01T20:00:00Z'),
new Date('2023-01-01T00:00:00Z'),
);
runTimezoneTest(
'previous calendar year',
NOW_UTC_IN_PACIFIC,
'Etc/GMT+8',
new Date('2023-01-01T12:00:00Z'),
new Date('2023-01-01T08:00:00Z'),
);
});
@@ -301,13 +301,13 @@ test('should return the date for "1 day ago"', () => {
'1 day ago',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-05-31T22:00:00Z'),
new Date('2024-06-01T22:00:00Z'),
);
runTimezoneTest(
'1 day ago',
NOW_IN_UTC,
'UTC',
new Date('2024-06-01T00:00:00Z'),
new Date('2024-06-02T00:00:00Z'),
);
runTimezoneTest(
'1 day ago',
@@ -323,13 +323,13 @@ test('should return the date for "1 week ago"', () => {
'1 week ago',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-05-25T22:00:00Z'),
new Date('2024-05-26T22:00:00Z'),
);
runTimezoneTest(
'1 week ago',
NOW_IN_UTC,
'UTC',
new Date('2024-05-26T00:00:00Z'),
new Date('2024-05-27T00:00:00Z'),
);
runTimezoneTest(
'1 week ago',
@@ -345,13 +345,13 @@ test('should return the date for "1 month ago"', () => {
'1 month ago',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-05-01T22:00:00Z'),
new Date('2024-05-02T22:00:00Z'),
);
runTimezoneTest(
'1 month ago',
NOW_IN_UTC,
'UTC',
new Date('2024-05-02T00:00:00Z'),
new Date('2024-05-03T00:00:00Z'),
);
runTimezoneTest(
'1 month ago',
@@ -367,13 +367,13 @@ test('should return the date for "1 year ago"', () => {
'1 year ago',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2023-06-01T22:00:00Z'),
new Date('2023-06-02T22:00:00Z'),
);
runTimezoneTest(
'1 year ago',
NOW_IN_UTC,
'UTC',
new Date('2023-06-02T00:00:00Z'),
new Date('2023-06-03T00:00:00Z'),
);
runTimezoneTest(
'1 year ago',
@@ -389,13 +389,13 @@ test('should return the date for "2024-03-09"', () => {
'2024-03-09',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-03-07T22:00:00.000Z'),
new Date('2024-03-08T22:00:00.000Z'),
);
runTimezoneTest(
'2024-03-09',
NOW_IN_UTC,
'UTC',
new Date('2024-03-08T00:00:00.000Z'),
new Date('2024-03-09T00:00:00.000Z'),
);
runTimezoneTest(
'2024-03-09',
@@ -411,14 +411,14 @@ test('should return the current date for "Last day" with isEndDate true', () =>
'Last day',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-06-01T22:00:00Z'),
new Date('2024-06-02T22:00:00Z'),
true,
);
runTimezoneTest(
'Last day',
NOW_IN_UTC,
'UTC',
new Date('2024-06-02T00:00:00Z'),
new Date('2024-06-03T00:00:00Z'),
true,
);
runTimezoneTest(
@@ -436,14 +436,14 @@ test('should return the current date for "Last week" with isEndDate true', () =>
'Last week',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-06-01T22:00:00Z'),
new Date('2024-06-02T22:00:00Z'),
true,
);
runTimezoneTest(
'Last week',
NOW_IN_UTC,
'UTC',
new Date('2024-06-02T00:00:00Z'),
new Date('2024-06-03T00:00:00Z'),
true,
);
runTimezoneTest(
@@ -461,14 +461,14 @@ test('should return the current date for "Last quarter" with isEndDate true', ()
'Last quarter',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-06-01T22:00:00Z'),
new Date('2024-06-02T22:00:00Z'),
true,
);
runTimezoneTest(
'Last quarter',
NOW_IN_UTC,
'UTC',
new Date('2024-06-02T00:00:00Z'),
new Date('2024-06-03T00:00:00Z'),
true,
);
runTimezoneTest(
@@ -486,14 +486,14 @@ test('should return the current date for "Last year" with isEndDate true', () =>
'Last year',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-06-01T22:00:00Z'),
new Date('2024-06-02T22:00:00Z'),
true,
);
runTimezoneTest(
'Last year',
NOW_IN_UTC,
'UTC',
new Date('2024-06-02T00:00:00Z'),
new Date('2024-06-03T00:00:00Z'),
true,
);
runTimezoneTest(
@@ -511,21 +511,21 @@ test('should return the date for "previous calendar week" with isEndDate true',
'previous calendar week',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-06-03T16:00:00Z'),
new Date('2024-06-02T22:00:00Z'),
true,
);
runTimezoneTest(
'previous calendar week',
NOW_IN_UTC,
'UTC',
new Date('2024-06-03T20:00:00Z'),
new Date('2024-06-03T00:00:00Z'),
true,
);
runTimezoneTest(
'previous calendar week',
NOW_UTC_IN_PACIFIC,
'Etc/GMT+8',
new Date('2024-06-03T12:00:00Z'),
new Date('2024-06-03T08:00:00Z'),
true,
);
});
@@ -536,21 +536,21 @@ test('should return the date for "previous calendar month" with isEndDate true',
'previous calendar month',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-06-01T16:00:00Z'),
new Date('2024-05-31T22:00:00Z'),
true,
);
runTimezoneTest(
'previous calendar month',
NOW_IN_UTC,
'UTC',
new Date('2024-06-01T20:00:00Z'),
new Date('2024-06-01T00:00:00Z'),
true,
);
runTimezoneTest(
'previous calendar month',
NOW_UTC_IN_PACIFIC,
'Etc/GMT+8',
new Date('2024-06-01T12:00:00Z'),
new Date('2024-06-01T08:00:00Z'),
true,
);
});
@@ -561,21 +561,21 @@ test('should return the date for "previous calendar year" with isEndDate true',
'previous calendar year',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-01-01T16:00:00Z'),
new Date('2023-12-31T22:00:00Z'),
true,
);
runTimezoneTest(
'previous calendar year',
NOW_IN_UTC,
'UTC',
new Date('2024-01-01T20:00:00Z'),
new Date('2024-01-01T00:00:00Z'),
true,
);
runTimezoneTest(
'previous calendar year',
NOW_UTC_IN_PACIFIC,
'Etc/GMT+8',
new Date('2024-01-01T12:00:00Z'),
new Date('2024-01-01T08:00:00Z'),
true,
);
});
@@ -586,9 +586,9 @@ test('should return the date for "2024" with parts.length === 1', () => {
'2024',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2023-12-30T22:00:00.000Z'),
new Date('2023-12-31T22:00:00.000Z'),
);
runTimezoneTest('2024', NOW_IN_UTC, 'UTC', new Date('2023-12-31T00:00:00Z'));
runTimezoneTest('2024', NOW_IN_UTC, 'UTC', new Date('2024-01-01T00:00:00Z'));
runTimezoneTest(
'2024',
NOW_UTC_IN_PACIFIC,
@@ -603,13 +603,13 @@ test('should return the date for "2024-03" with parts.length === 2', () => {
'2024-03',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-02-28T22:00:00.000Z'),
new Date('2024-02-29T22:00:00.000Z'),
);
runTimezoneTest(
'2024-03',
NOW_IN_UTC,
'UTC',
new Date('2024-02-29T00:00:00Z'),
new Date('2024-03-01T00:00:00Z'),
);
runTimezoneTest(
'2024-03',
@@ -625,13 +625,13 @@ test('should return the date for "2024-03-06" with parts.length === 3', () => {
'2024-03-06',
NOW_UTC_IN_EUROPE,
'Etc/GMT-2',
new Date('2024-03-04T22:00:00.000Z'),
new Date('2024-03-05T22:00:00.000Z'),
);
runTimezoneTest(
'2024-03-06',
NOW_IN_UTC,
'UTC',
new Date('2024-03-05T00:00:00.000Z'),
new Date('2024-03-06T00:00:00.000Z'),
);
runTimezoneTest(
'2024-03-06',
@@ -643,7 +643,7 @@ test('should return the date for "2024-03-06" with parts.length === 3', () => {
test('should return the date for "2024-03-06" with computingShifts true', () => {
jest.useFakeTimers();
const expectedDate = new Date('2024-03-05T22:00:00Z');
const expectedDate = new Date('2024-03-06T22:00:00Z');
expectedDate.setHours(-expectedDate.getTimezoneOffset() / 60, 0, 0, 0);
runTimezoneTest(
'2024-03-06',
@@ -657,7 +657,7 @@ test('should return the date for "2024-03-06" with computingShifts true', () =>
test('should return the date for "2024-03-06" with computingShifts true and isEndDate true', () => {
jest.useFakeTimers();
const expectedDate = new Date('2024-03-05T22:00:00Z');
const expectedDate = new Date('2024-03-06T22:00:00Z');
expectedDate.setHours(-expectedDate.getTimezoneOffset() / 60, 0, 0, 0);
runTimezoneTest(
'2024-03-06',

View File

@@ -0,0 +1,216 @@
/**
* 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

@@ -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;

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