Compare commits

..

1 Commits

Author SHA1 Message Date
Evan Rusackas
46776b9a8c fix(typography): using tabular numbers in default theme 2025-06-30 17:45:14 -07:00
516 changed files with 9133 additions and 46658 deletions

View File

@@ -42,7 +42,7 @@ body:
options:
- master / latest-dev
- "5.0.0"
- "4.1.3"
- "4.1.2"
validations:
required: true
- type: dropdown

View File

@@ -12,10 +12,6 @@ updates:
# not until React >= 18.0.0
- dependency-name: "storybook"
- dependency-name: "@storybook*"
# JSDOM v30 doesn't play well with Jest v30
# Source: https://jestjs.io/blog#known-issues
# GH thread: https://github.com/jsdom/jsdom/issues/3492
- dependency-name: "jest-environment-jsdom"
directory: "/superset-frontend/"
schedule:
interval: "monthly"

View File

@@ -24,12 +24,6 @@ jobs:
submodules: recursive
fetch-depth: 1
- name: Check for file changes
id: check
uses: ./.github/actions/change-detector/
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Python
if: steps.check.outputs.python
uses: ./.github/actions/setup-backend/
@@ -39,20 +33,10 @@ jobs:
run: ./scripts/uv-pip-compile.sh
- name: Check for uncommitted changes
if: steps.check.outputs.python
run: |
echo "Full diff (for logging/debugging):"
git diff
echo "Filtered diff (excluding comments and whitespace):"
filtered_diff=$(git diff -U0 | grep '^[-+]' | grep -vE '^[-+]{3}' | grep -vE '^[-+][[:space:]]*#' | grep -vE '^[-+][[:space:]]*$' || true)
echo "$filtered_diff"
if [[ -n "$filtered_diff" ]]; then
echo
if [[ -n "$(git diff)" ]]; then
echo "ERROR: The pinned dependencies are not up-to-date."
echo "Please run './scripts/uv-pip-compile.sh' and commit the changes."
echo "More info: https://github.com/apache/superset/tree/master/requirements"
exit 1
else
echo "Pinned dependencies are up-to-date."

View File

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

View File

@@ -1,58 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
## Change Log
### 4.1.3 (Thu May 29 02:31:07 2025 -0500)
**Database Migrations**
**Features**
**Fixes**
- [#33522](https://github.com/apache/superset/pull/33522) fix(Sqllab): Autocomplete got stuck in UI when open it too fast (@rebenitez1802)
- [#33425](https://github.com/apache/superset/pull/33425) fix(table-chart): time shift is not working (@justinpark)
- [#32414](https://github.com/apache/superset/pull/32414) fix(api): Added uuid to list api calls (@withnale)
- [#33354](https://github.com/apache/superset/pull/33354) fix: loading examples from raw.githubusercontent.com fails with 429 errors (@mistercrunch)
- [#32382](https://github.com/apache/superset/pull/32382) fix(pinot): revert join and subquery flags (@yuribogomolov)
- [#32473](https://github.com/apache/superset/pull/32473) fix(plugin-chart-echarts): remove erroneous upper bound value (@villebro)
- [#33048](https://github.com/apache/superset/pull/33048) fix: improve error type on parse error (@justinpark)
- [#32968](https://github.com/apache/superset/pull/32968) fix(pivot-table): Revert "fix(Pivot Table): Fix column width to respect currency config (#31414)" (@justinpark)
- [#32795](https://github.com/apache/superset/pull/32795) fix(log): store navigation path to get correct logging path (@justinpark)
- [#33216](https://github.com/apache/superset/pull/33216) fix: Downgrade to marshmallow<4 (@amotl)
- [#32866](https://github.com/apache/superset/pull/32866) fix: make packages PEP 625 compliant (@sadpandajoe)
- [#32035](https://github.com/apache/superset/pull/32035) fix(fe/dashboard-list): display modifier info for `Last modified` data (@hainenber)
- [#32708](https://github.com/apache/superset/pull/32708) fix(logging): missing path in event data (@justinpark)
- [#32699](https://github.com/apache/superset/pull/32699) fix: Signature of Celery pruner jobs (@michael-s-molina)
- [#32681](https://github.com/apache/superset/pull/32681) fix(log): Update recent_activity by event name (@justinpark)
- [#32608](https://github.com/apache/superset/pull/32608) fix(welcome): perf on distinct recent activities (@justinpark)
- [#32572](https://github.com/apache/superset/pull/32572) fix: Log table retention policy (@michael-s-molina)
- [#32406](https://github.com/apache/superset/pull/32406) fix(model/helper): represent RLS filter clause in proper textual SQL string (@hainenber)
- [#32240](https://github.com/apache/superset/pull/32240) fix: upgrade to 3.11.11-slim-bookworm to address critical vulnerabilities (@gpchandran)
- [#30858](https://github.com/apache/superset/pull/30858) fix(chart data): removing query from /chart/data payload when accessing as guest user (@fisjac)
**Others**
- [#33612](https://github.com/apache/superset/pull/33612) chore: update Dockerfile - Upgrade to 3.11.12 (@gpchandran)
- [#33435](https://github.com/apache/superset/pull/33435) docs: CVEs fixed on 4.1.2 (@sha174n)
- [#33339](https://github.com/apache/superset/pull/33339) chore(🦾): bump python h11 0.14.0 -> 0.16.0 (@github-actions[bot])
- [#32745](https://github.com/apache/superset/pull/32745) chore(🦾): bump python sqlglot 26.1.3 -> 26.11.1 (@github-actions[bot])
- [#32782](https://github.com/apache/superset/pull/32782) chore: Revert "chore: bump base image in Dockerfile with `ARG PY_VER=3.11.11-slim-bookworm`" (@sadpandajoe)
- [#32780](https://github.com/apache/superset/pull/32780) chore: bump base image in Dockerfile with `ARG PY_VER=3.11.11-slim-bookworm` (@gpchandran)

View File

@@ -5,7 +5,7 @@
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
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0

View File

@@ -8,11 +8,11 @@ version: 1
## CORS
To configure CORS, or cross-origin resource sharing, the following dependency must be installed:
:::note
In Superset versions prior to `5.x` you have to install to install `flask-cors` with `pip install flask-cors` to enable CORS support.
:::
```python
pip install apache_superset[cors]
```
The following keys in `superset_config.py` can be specified to configure CORS:

View File

@@ -78,7 +78,7 @@ Affecting the Docker build process:
- **SUPERSET_BUILD_TARGET (default=dev):** which --target to build, either `lean` or `dev` are commonly used
- **INCLUDE_FIREFOX (default=false):** whether to include the Firefox headless browser in the build
- **INCLUDE_CHROMIUM (default=false):** whether to include the Chromium headless browser in the build
- **INCLUDE_CHROMIUM (default=false):** whether to include the Firefox headless browser in the build
- **BUILD_TRANSLATIONS(default=false):** whether to compile the translations from the .po files available
- **SUPERSET_LOAD_EXAMPLES (default=yes):** whether to load the examples into the database upon startup,
save some precious time on startup by `SUPERSET_LOAD_EXAMPLES=no docker compose up`
@@ -614,6 +614,9 @@ act --job test-python-38 --secret GITHUB_TOKEN=$GITHUB_TOKEN --event pull_reques
There is also a utility script included in the Superset codebase to run Python integration tests. The [readme can be found here](https://github.com/apache/superset/tree/master/scripts/tests).
There is also a utility script included in the Superset codebase to run python integration tests. The [readme can be
found here](https://github.com/apache/superset/tree/master/scripts/tests)
To run all integration tests, for example, run this script from the root directory:
```bash

View File

@@ -18,7 +18,7 @@
"eslint": "eslint . --ext .js,.jsx,.ts,.tsx"
},
"dependencies": {
"@ant-design/icons": "^6.0.0",
"@ant-design/icons": "^5.5.2",
"@docusaurus/core": "3.8.1",
"@docusaurus/plugin-client-redirects": "3.8.1",
"@docusaurus/preset-classic": "3.8.1",
@@ -26,7 +26,7 @@
"@emotion/styled": "^10.0.27",
"@saucelabs/theme-github-codeblock": "^0.3.0",
"@superset-ui/style": "^0.14.23",
"antd": "^5.26.3",
"antd": "^5.25.1",
"docusaurus-plugin-less": "^2.0.2",
"less": "^4.3.0",
"less-loader": "^12.3.0",
@@ -35,11 +35,11 @@
"react-dom": "^18.3.1",
"react-github-btn": "^1.4.0",
"react-svg-pan-zoom": "^3.13.1",
"swagger-ui-react": "^5.26.0"
"swagger-ui-react": "^5.25.2"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^3.8.1",
"@docusaurus/tsconfig": "^3.8.1",
"@docusaurus/tsconfig": "^3.8.0",
"@types/react": "^19.1.8",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",

View File

@@ -158,20 +158,13 @@
"@jridgewell/gen-mapping" "^0.3.5"
"@jridgewell/trace-mapping" "^0.3.24"
"@ant-design/colors@^7.0.0", "@ant-design/colors@^7.2.1":
version "7.2.1"
resolved "https://registry.yarnpkg.com/@ant-design/colors/-/colors-7.2.1.tgz#3bbc1c6c18550020d1622a0067ff03492318df98"
integrity sha512-lCHDcEzieu4GA3n8ELeZ5VQ8pKQAWcGGLRTQ50aQM2iqPpq2evTxER84jfdPvsPAtEcZ7m44NI45edFMo8oOYQ==
"@ant-design/colors@^7.0.0", "@ant-design/colors@^7.2.0":
version "7.2.0"
resolved "https://registry.npmjs.org/@ant-design/colors/-/colors-7.2.0.tgz"
integrity sha512-bjTObSnZ9C/O8MB/B4OUtd/q9COomuJAR2SYfhxLyHvCKn4EKwCN3e+fWGMo7H5InAyV0wL17jdE9ALrdOW/6A==
dependencies:
"@ant-design/fast-color" "^2.0.6"
"@ant-design/colors@^8.0.0":
version "8.0.0"
resolved "https://registry.yarnpkg.com/@ant-design/colors/-/colors-8.0.0.tgz#92b5aa1cd44896b62c7b67133b4d5a6a00266162"
integrity sha512-6YzkKCw30EI/E9kHOIXsQDHmMvTllT8STzjMb4K2qzit33RW2pqCJP0sk+hidBntXxE+Vz4n1+RvCTfBw6OErw==
dependencies:
"@ant-design/fast-color" "^3.0.0"
"@ant-design/cssinjs-utils@^1.1.3":
version "1.1.3"
resolved "https://registry.npmjs.org/@ant-design/cssinjs-utils/-/cssinjs-utils-1.1.3.tgz"
@@ -201,17 +194,12 @@
dependencies:
"@babel/runtime" "^7.24.7"
"@ant-design/fast-color@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@ant-design/fast-color/-/fast-color-3.0.0.tgz#fb5178203de825f284809538f5142203d0ef3d80"
integrity sha512-eqvpP7xEDm2S7dUzl5srEQCBTXZMmY3ekf97zI+M2DHOYyKdJGH0qua0JACHTqbkRnD/KHFQP9J1uMJ/XWVzzA==
"@ant-design/icons-svg@^4.4.0":
version "4.4.2"
resolved "https://registry.npmjs.org/@ant-design/icons-svg/-/icons-svg-4.4.2.tgz"
integrity sha512-vHbT+zJEVzllwP+CM+ul7reTEfBR0vgxFe7+lREAsAA7YGsYpboiq2sQNeQeRvh09GfQgs/GyFEvZpJ9cLXpXA==
"@ant-design/icons@^5.6.1":
"@ant-design/icons@^5.5.2", "@ant-design/icons@^5.6.1":
version "5.6.1"
resolved "https://registry.npmjs.org/@ant-design/icons/-/icons-5.6.1.tgz"
integrity sha512-0/xS39c91WjPAZOWsvi1//zjx6kAp4kxWwctR6kuU6p133w8RU0D2dSCvZC19uQyharg/sAvYxGYWl01BbZZfg==
@@ -222,16 +210,6 @@
classnames "^2.2.6"
rc-util "^5.31.1"
"@ant-design/icons@^6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@ant-design/icons/-/icons-6.0.0.tgz#302c935b8b0b429e4444cbc45809247276186d94"
integrity sha512-o0aCCAlHc1o4CQcapAwWzHeaW2x9F49g7P3IDtvtNXgHowtRWYb7kiubt8sQPFvfVIVU/jLw2hzeSlNt0FU+Uw==
dependencies:
"@ant-design/colors" "^8.0.0"
"@ant-design/icons-svg" "^4.4.0"
"@rc-component/util" "^1.2.1"
classnames "^2.2.6"
"@ant-design/react-slick@~1.1.2":
version "1.1.2"
resolved "https://registry.npmjs.org/@ant-design/react-slick/-/react-slick-1.1.2.tgz"
@@ -1106,7 +1084,15 @@
"@babel/plugin-transform-modules-commonjs" "^7.26.3"
"@babel/plugin-transform-typescript" "^7.27.0"
"@babel/runtime-corejs3@^7.20.7", "@babel/runtime-corejs3@^7.22.15", "@babel/runtime-corejs3@^7.25.9", "@babel/runtime-corejs3@^7.26.10", "@babel/runtime-corejs3@^7.27.1":
"@babel/runtime-corejs3@^7.20.7", "@babel/runtime-corejs3@^7.22.15", "@babel/runtime-corejs3@^7.25.9", "@babel/runtime-corejs3@^7.26.10":
version "7.27.0"
resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.27.0.tgz#c766df350ec7a2caf3ed64e3659b100954589413"
integrity sha512-UWjX6t+v+0ckwZ50Y5ShZLnlk95pP5MyW/pon9tiYzl3+18pkTHTFNTKr7rQbfRXPkowt2QAn30o1b6oswszew==
dependencies:
core-js-pure "^3.30.2"
regenerator-runtime "^0.14.0"
"@babel/runtime-corejs3@^7.27.1":
version "7.27.6"
resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.27.6.tgz#97644153808a62898e7c05f3361501417db3c48b"
integrity sha512-vDVrlmRAY8z9Ul/HxT+8ceAru95LQgkSKiXkSYZvqtbkPSfhZJgpRp45Cldbh1GJ1kxzQkI70AqyrTI58KpaWQ==
@@ -1979,10 +1965,10 @@
fs-extra "^11.1.1"
tslib "^2.6.0"
"@docusaurus/tsconfig@^3.8.1":
version "3.8.1"
resolved "https://registry.yarnpkg.com/@docusaurus/tsconfig/-/tsconfig-3.8.1.tgz#a1f7daadfc93455289200647f4ee10cdca540f7b"
integrity sha512-XBWCcqhRHhkhfolnSolNL+N7gj3HVE3CoZVqnVjfsMzCoOsuQw2iCLxVVHtO+rePUUfouVZHURDgmqIySsF66A==
"@docusaurus/tsconfig@^3.8.0":
version "3.8.0"
resolved "https://registry.yarnpkg.com/@docusaurus/tsconfig/-/tsconfig-3.8.0.tgz#ea7ee0917e1562cf0a6e95e049c42f1f61351f32"
integrity sha512-utLl48nNjSYBoq47RKukZ9fPLEX3nJWThzrujb0ndQQ1jc/gh4RhTRaAqItH9nImnsgGKmLMnyoMBpfGmoop+w==
"@docusaurus/types@3.8.1":
version "3.8.1"
@@ -2457,10 +2443,10 @@
classnames "^2.3.2"
rc-util "^5.24.4"
"@rc-component/trigger@^2.0.0", "@rc-component/trigger@^2.1.1", "@rc-component/trigger@^2.2.7":
version "2.2.7"
resolved "https://registry.yarnpkg.com/@rc-component/trigger/-/trigger-2.2.7.tgz#a2b97ecbb93280a3c424e51fa415b371b355d76a"
integrity sha512-Qggj4Z0AA2i5dJhzlfFSmg1Qrziu8dsdHOihROL5Kl18seO2Eh/ZaTYt2c8a/CyGaTChnFry7BEYew1+/fhSbA==
"@rc-component/trigger@^2.0.0", "@rc-component/trigger@^2.1.1", "@rc-component/trigger@^2.2.6":
version "2.2.6"
resolved "https://registry.npmjs.org/@rc-component/trigger/-/trigger-2.2.6.tgz"
integrity sha512-/9zuTnWwhQ3S3WT1T8BubuFTT46kvnXgaERR9f4BTKyn61/wpf/BvbImzYBubzJibU707FxwbKszLlHjcLiv1Q==
dependencies:
"@babel/runtime" "^7.23.2"
"@rc-component/portal" "^1.1.0"
@@ -2469,13 +2455,6 @@
rc-resize-observer "^1.3.1"
rc-util "^5.44.0"
"@rc-component/util@^1.2.1":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@rc-component/util/-/util-1.2.1.tgz#2c3158f11a4193478cec44ca42915da31f67d8a0"
integrity sha512-AUVu6jO+lWjQnUOOECwu8iR0EdElQgWW5NBv5vP/Uf9dWbAX3udhMutRlkVXjuac2E40ghkFy+ve00mc/3Fymg==
dependencies:
react-is "^18.2.0"
"@saucelabs/theme-github-codeblock@^0.3.0":
version "0.3.0"
resolved "https://registry.npmjs.org/@saucelabs/theme-github-codeblock/-/theme-github-codeblock-0.3.0.tgz"
@@ -4038,12 +4017,12 @@ ansi-styles@^6.1.0:
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5"
integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==
antd@^5.26.3:
version "5.26.3"
resolved "https://registry.yarnpkg.com/antd/-/antd-5.26.3.tgz#cbbb7e1b48a972dc7b6ee8b6948f51cc91c263f8"
integrity sha512-M/s9Q39h/+G7AWnS6fbNxmAI9waTH4ti022GVEXBLq2j810V1wJ3UOQps13nEilzDNcyxnFN/EIbqIgS7wSYaA==
antd@^5.25.1:
version "5.25.1"
resolved "https://registry.yarnpkg.com/antd/-/antd-5.25.1.tgz#859b419a18d113492304ccd66c29074a71902241"
integrity sha512-4KC7KuPCjr0z3Vuw9DsF+ceqJaPLbuUI3lOX1sY8ix25ceamp+P8yxOmk3Y2JHCD2ZAhq+5IQ/DTJRN2adWYKQ==
dependencies:
"@ant-design/colors" "^7.2.1"
"@ant-design/colors" "^7.2.0"
"@ant-design/cssinjs" "^1.23.0"
"@ant-design/cssinjs-utils" "^1.1.3"
"@ant-design/fast-color" "^2.0.6"
@@ -4054,7 +4033,7 @@ antd@^5.26.3:
"@rc-component/mutate-observer" "^1.1.0"
"@rc-component/qrcode" "~1.0.0"
"@rc-component/tour" "~1.15.1"
"@rc-component/trigger" "^2.2.7"
"@rc-component/trigger" "^2.2.6"
classnames "^2.5.1"
copy-to-clipboard "^3.3.3"
dayjs "^1.11.11"
@@ -4062,7 +4041,7 @@ antd@^5.26.3:
rc-checkbox "~3.5.0"
rc-collapse "~3.9.0"
rc-dialog "~9.6.0"
rc-drawer "~7.3.0"
rc-drawer "~7.2.0"
rc-dropdown "~4.2.1"
rc-field-form "~2.7.0"
rc-image "~7.12.0"
@@ -4078,17 +4057,17 @@ antd@^5.26.3:
rc-rate "~2.13.1"
rc-resize-observer "^1.4.3"
rc-segmented "~2.7.0"
rc-select "~14.16.8"
rc-select "~14.16.7"
rc-slider "~11.1.8"
rc-steps "~6.0.1"
rc-switch "~4.1.0"
rc-table "~7.51.1"
rc-table "~7.50.4"
rc-tabs "~15.6.1"
rc-textarea "~1.10.0"
rc-tooltip "~6.4.0"
rc-tree "~5.13.1"
rc-tree-select "~5.27.0"
rc-upload "~4.9.2"
rc-upload "~4.9.0"
rc-util "^5.44.4"
scroll-into-view-if-needed "^3.1.0"
throttle-debounce "^5.0.2"
@@ -10398,10 +10377,10 @@ rc-dialog@~9.6.0:
rc-motion "^2.3.0"
rc-util "^5.21.0"
rc-drawer@~7.3.0:
version "7.3.0"
resolved "https://registry.yarnpkg.com/rc-drawer/-/rc-drawer-7.3.0.tgz#1bb5fe5f9da38b6a2b2a7dffc9fcb647252a328f"
integrity sha512-DX6CIgiBWNpJIMGFO8BAISFkxiuKitoizooj4BDyee8/SnBn0zwO2FHrNDpqqepj0E/TFTDpmEBCyFuTgC7MOg==
rc-drawer@~7.2.0:
version "7.2.0"
resolved "https://registry.npmjs.org/rc-drawer/-/rc-drawer-7.2.0.tgz"
integrity sha512-9lOQ7kBekEJRdEpScHvtmEtXnAsy+NGDXiRWc2ZVC7QXAazNVbeT4EraQKYwCME8BJLa8Bxqxvs5swwyOepRwg==
dependencies:
"@babel/runtime" "^7.23.9"
"@rc-component/portal" "^1.1.1"
@@ -10573,7 +10552,7 @@ rc-segmented@~2.7.0:
rc-motion "^2.4.4"
rc-util "^5.17.0"
rc-select@~14.16.2, rc-select@~14.16.8:
rc-select@~14.16.2, rc-select@~14.16.7:
version "14.16.8"
resolved "https://registry.yarnpkg.com/rc-select/-/rc-select-14.16.8.tgz#78e6782f1ccc1f03d9003bc3effa4ed609d29a97"
integrity sha512-NOV5BZa1wZrsdkKaiK7LHRuo5ZjZYMDxPP6/1+09+FB4KoNi8jcG1ZqLE3AVCxEsYMBe65OBx71wFoHRTP3LRg==
@@ -10613,10 +10592,10 @@ rc-switch@~4.1.0:
classnames "^2.2.1"
rc-util "^5.30.0"
rc-table@~7.51.1:
version "7.51.1"
resolved "https://registry.yarnpkg.com/rc-table/-/rc-table-7.51.1.tgz#cd69ae3262d3b61e4c93c979c12786906e944691"
integrity sha512-5iq15mTHhvC42TlBLRCoCBLoCmGlbRZAlyF21FonFnS/DIC8DeRqnmdyVREwt2CFbPceM0zSNdEeVfiGaqYsKw==
rc-table@~7.50.4:
version "7.50.4"
resolved "https://registry.yarnpkg.com/rc-table/-/rc-table-7.50.4.tgz#687b5bf76d1a94168f75481cbc83be9442010432"
integrity sha512-Y+YuncnQqoS5e7yHvfvlv8BmCvwDYDX/2VixTBEhkMDk9itS9aBINp4nhzXFKiBP/frG4w0pS9d9Rgisl0T1Bw==
dependencies:
"@babel/runtime" "^7.10.1"
"@rc-component/context" "^1.4.0"
@@ -10681,10 +10660,10 @@ rc-tree@~5.13.0, rc-tree@~5.13.1:
rc-util "^5.16.1"
rc-virtual-list "^3.5.1"
rc-upload@~4.9.2:
version "4.9.2"
resolved "https://registry.yarnpkg.com/rc-upload/-/rc-upload-4.9.2.tgz#297f52fd1b1c2a4b570c3e42444609b7530531bb"
integrity sha512-nHx+9rbd1FKMiMRYsqQ3NkXUv7COHPBo3X1Obwq9SWS6/diF/A0aJ5OHubvwUAIDs+4RMleljV0pcrNUc823GQ==
rc-upload@~4.9.0:
version "4.9.0"
resolved "https://registry.yarnpkg.com/rc-upload/-/rc-upload-4.9.0.tgz#911963ab5a0b538c743765371c05e2de9e3f5436"
integrity sha512-pAzlPnyiFn1GCtEybEG2m9nXNzQyWXqWV2xFYCmDxjN9HzyjS5Pz2F+pbNdYw8mMJsixLEKLG0wVy9vOGxJMJA==
dependencies:
"@babel/runtime" "^7.18.3"
classnames "^2.2.5"
@@ -12019,10 +11998,10 @@ swagger-client@^3.35.5:
ramda "^0.30.1"
ramda-adjunct "^5.1.0"
swagger-ui-react@^5.26.0:
version "5.26.0"
resolved "https://registry.yarnpkg.com/swagger-ui-react/-/swagger-ui-react-5.26.0.tgz#b15a903d556cc0ec2a56a969beb9d5bc9ea52910"
integrity sha512-4e6bP9bdJyh+SqQW0lxulPn/SDno4+oWrKXsuon5Z9kjtV0zeoWEJ1c70Qxp8kN/c3caFwec8OyxDNhvo14pkw==
swagger-ui-react@^5.25.2:
version "5.25.2"
resolved "https://registry.yarnpkg.com/swagger-ui-react/-/swagger-ui-react-5.25.2.tgz#27e8570c7225a0beffcfae26b569c8dd1274c545"
integrity sha512-derGtL7NKvF0w4XIULgiWmS1y3EMEVQAJwLVLTAzVo6/ilLhwP9HCz2yjkVVHzK58gvOzrhO3DKk/Effpr5LJw==
dependencies:
"@babel/runtime-corejs3" "^7.27.1"
"@scarf/scarf" "=1.4.0"

View File

@@ -29,7 +29,7 @@ maintainers:
- name: craig-rueda
email: craig@craigrueda.com
url: https://github.com/craig-rueda
version: 0.14.3
version: 0.14.2
dependencies:
- name: postgresql
version: 13.4.4

View File

@@ -23,7 +23,7 @@ NOTE: This file is generated by helm-docs: https://github.com/norwoodj/helm-docs
# superset
![Version: 0.14.3](https://img.shields.io/badge/Version-0.14.3-informational?style=flat-square)
![Version: 0.14.2](https://img.shields.io/badge/Version-0.14.2-informational?style=flat-square)
Apache Superset is a modern, enterprise-ready business intelligence web application

View File

@@ -28,9 +28,9 @@ metadata:
chart: {{ template "superset.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
{{- if .Values.init.jobAnnotations }}
annotations: {{- toYaml .Values.init.jobAnnotations | nindent 4 }}
{{- end }}
@@ -44,10 +44,10 @@ spec:
{{- if or .Values.extraLabels .Values.init.podLabels }}
labels:
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 8 }}
{{- toYaml .Values.extraLabels | nindent 8 }}
{{- end }}
{{- if .Values.init.podLabels }}
{{- toYaml .Values.init.podLabels | nindent 8 }}
{{- toYaml .Values.init.podLabels | nindent 8 }}
{{- end }}
{{- end }}
spec:

View File

@@ -20,7 +20,7 @@
{{- with .Values.supersetCeleryBeat.podDisruptionBudget }}
{{- if .enabled -}}
{{- if and .minAvailable .maxUnavailable }}
{{- fail "Only one of minAvailable or maxUnavailable should be set" }}
{{- fail "Only one of minAvailable or maxUnavailable should be set" }}
{{- end}}
apiVersion: policy/v1
kind: PodDisruptionBudget
@@ -35,12 +35,12 @@ metadata:
{{- toYaml $.Values.extraLabels | nindent 4 }}
{{- end }}
spec:
{{- if .minAvailable }}
{{- if .minAvailable }}
minAvailable: {{ .minAvailable }}
{{- end }}
{{- if .maxUnavailable }}
{{- end }}
{{- if .maxUnavailable }}
maxUnavailable: {{ .maxUnavailable }}
{{- end }}
{{- end }}
selector:
matchLabels:
{{- include "supersetCeleryBeat.selectorLabels" $ | nindent 6 }}

View File

@@ -20,7 +20,7 @@
{{- with .Values.supersetCeleryFlower.podDisruptionBudget }}
{{- if .enabled -}}
{{- if and .minAvailable .maxUnavailable }}
{{- fail "Only one of minAvailable or maxUnavailable should be set" }}
{{- fail "Only one of minAvailable or maxUnavailable should be set" }}
{{- end}}
apiVersion: policy/v1
kind: PodDisruptionBudget
@@ -35,12 +35,12 @@ metadata:
{{- toYaml $.Values.extraLabels | nindent 4 }}
{{- end }}
spec:
{{- if .minAvailable }}
{{- if .minAvailable }}
minAvailable: {{ .minAvailable }}
{{- end }}
{{- if .maxUnavailable }}
{{- end }}
{{- if .maxUnavailable }}
maxUnavailable: {{ .maxUnavailable }}
{{- end }}
{{- end }}
selector:
matchLabels:
{{- include "supersetCeleryFlower.selectorLabels" $ | nindent 6 }}

View File

@@ -20,7 +20,7 @@
{{- with .Values.supersetWorker.podDisruptionBudget }}
{{- if .enabled -}}
{{- if and .minAvailable .maxUnavailable }}
{{- fail "Only one of minAvailable or maxUnavailable should be set" }}
{{- fail "Only one of minAvailable or maxUnavailable should be set" }}
{{- end}}
apiVersion: policy/v1
kind: PodDisruptionBudget
@@ -35,12 +35,12 @@ metadata:
{{- toYaml $.Values.extraLabels | nindent 4 }}
{{- end }}
spec:
{{- if .minAvailable }}
{{- if .minAvailable }}
minAvailable: {{ .minAvailable }}
{{- end }}
{{- if .maxUnavailable }}
{{- end }}
{{- if .maxUnavailable }}
maxUnavailable: {{ .maxUnavailable }}
{{- end }}
{{- end }}
selector:
matchLabels:
{{- include "supersetWorker.selectorLabels" $ | nindent 6 }}

View File

@@ -20,7 +20,7 @@
{{- with .Values.supersetWebsockets.podDisruptionBudget }}
{{- if .enabled -}}
{{- if and .minAvailable .maxUnavailable }}
{{- fail "Only one of minAvailable or maxUnavailable should be set" }}
{{- fail "Only one of minAvailable or maxUnavailable should be set" }}
{{- end}}
apiVersion: policy/v1
kind: PodDisruptionBudget
@@ -35,12 +35,12 @@ metadata:
{{- toYaml $.Values.extraLabels | nindent 4 }}
{{- end }}
spec:
{{- if .minAvailable }}
{{- if .minAvailable }}
minAvailable: {{ .minAvailable }}
{{- end }}
{{- if .maxUnavailable }}
{{- end }}
{{- if .maxUnavailable }}
maxUnavailable: {{ .maxUnavailable }}
{{- end }}
{{- end }}
selector:
matchLabels:
{{- include "supersetWebsockets.selectorLabels" $ | nindent 6 }}

View File

@@ -20,7 +20,7 @@
{{- with .Values.supersetNode.podDisruptionBudget }}
{{- if .enabled -}}
{{- if and .minAvailable .maxUnavailable }}
{{- fail "Only one of minAvailable or maxUnavailable should be set" }}
{{- fail "Only one of minAvailable or maxUnavailable should be set" }}
{{- end}}
apiVersion: policy/v1
kind: PodDisruptionBudget
@@ -35,12 +35,12 @@ metadata:
{{- toYaml $.Values.extraLabels | nindent 4 }}
{{- end }}
spec:
{{- if .minAvailable }}
{{- if .minAvailable }}
minAvailable: {{ .minAvailable }}
{{- end }}
{{- if .maxUnavailable }}
{{- end }}
{{- if .maxUnavailable }}
maxUnavailable: {{ .maxUnavailable }}
{{- end }}
{{- end }}
selector:
matchLabels:
{{- include "supersetNode.selectorLabels" $ | nindent 6 }}

View File

@@ -40,13 +40,12 @@ dependencies = [
"click>=8.0.3",
"click-option-group",
"colorama",
"flask-cors>=4.0.2, <7.0",
"croniter>=0.3.28",
"cron-descriptor",
"cryptography>=42.0.4, <45.0.0",
"deprecation>=2.1.0, <2.2.0",
"flask>=2.2.5, <3.0.0",
"flask-appbuilder>=4.8.0, <5.0.0",
"flask-appbuilder>=4.7.0, <5.0.0",
"flask-caching>=2.1.0, <3",
"flask-compress>=1.13, <2.0",
"flask-talisman>=1.0.0, <2.0",
@@ -116,6 +115,7 @@ bigquery = [
]
clickhouse = ["clickhouse-connect>=0.5.14, <1.0"]
cockroachdb = ["cockroachdb>=0.3.5, <0.4"]
cors = ["flask-cors>=4.0.2, <5.0"]
crate = ["sqlalchemy-cratedb>=0.40.1, <1"]
databend = ["databend-sqlalchemy>=0.3.2, <1.0"]
databricks = [

View File

@@ -7,14 +7,7 @@ To alter the pinned dependency, you can edit/alter the `.in` and `pyproject.toml
```bash
./scripts/uv-pip-compile.sh
```
:::warning
The pinned dependencies are based on the `current` version of python supported in Superset.
Output of `./scripts/uv-pip-compile.sh` may vary slightly based on the python version you are using to run the command.
Check the `pyproject.toml` file for the current version of python supported.
:::
This will generate the pinned requirements in the `.txt` files, which will be used in our CI/CD pipelines and in the Docker images.
We recommend to everyone in the community to use the pinned requirements in their local development environments, to ensure consistency across different environments, though we don't force requirements as part of our python package semantics to allow flexibility for users to install different versions of the dependencies if they wish.
Note that `development.txt` is a superset of what's in `base.txt`, and all version numbers for shared library should fully match at all times. `translations.txt` is meant as a supplemental file to be used in conjunction with the other requirements files, and is not meant to be used standalone.

View File

@@ -104,7 +104,6 @@ flask==2.3.3
# flask-babel
# flask-caching
# flask-compress
# flask-cors
# flask-jwt-extended
# flask-limiter
# flask-login
@@ -112,7 +111,7 @@ flask==2.3.3
# flask-session
# flask-sqlalchemy
# flask-wtf
flask-appbuilder==4.8.0
flask-appbuilder==4.7.0
# via apache-superset (pyproject.toml)
flask-babel==2.0.0
# via flask-appbuilder
@@ -120,8 +119,6 @@ flask-caching==2.3.1
# via apache-superset (pyproject.toml)
flask-compress==1.17
# via apache-superset (pyproject.toml)
flask-cors==4.0.2
# via apache-superset (pyproject.toml)
flask-jwt-extended==4.7.1
# via flask-appbuilder
flask-limiter==3.12

View File

@@ -16,4 +16,4 @@
# specific language governing permissions and limitations
# under the License.
#
-e .[development,bigquery,druid,gevent,gsheets,mysql,postgres,presto,prophet,trino,thumbnails]
-e .[development,bigquery,cors,druid,gevent,gsheets,mysql,postgres,presto,prophet,trino,thumbnails]

View File

@@ -1,28 +1,19 @@
# This file was autogenerated by uv via the following command:
# uv pip compile requirements/development.in -c requirements/base.txt -o requirements/development.txt
# uv pip compile pyproject.toml requirements/development.in -o requirements/development.txt
-e .
# via -r requirements/development.in
alembic==1.15.2
# via
# -c requirements/base.txt
# flask-migrate
# via flask-migrate
amqp==5.3.1
# via
# -c requirements/base.txt
# kombu
# via kombu
apispec==6.6.1
# via
# -c requirements/base.txt
# flask-appbuilder
# via flask-appbuilder
apsw==3.50.1.0
# via
# -c requirements/base.txt
# shillelagh
# via shillelagh
astroid==3.3.10
# via pylint
attrs==25.3.0
# via
# -c requirements/base.txt
# cattrs
# jsonschema
# outcome
@@ -30,69 +21,50 @@ attrs==25.3.0
# requests-cache
# trio
babel==2.17.0
# via
# -c requirements/base.txt
# flask-babel
# via flask-babel
backoff==2.2.1
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
bcrypt==4.3.0
# via
# -c requirements/base.txt
# paramiko
# via paramiko
billiard==4.2.1
# via
# -c requirements/base.txt
# celery
# via celery
blinker==1.9.0
# via
# -c requirements/base.txt
# flask
# via flask
bottleneck==1.5.0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
brotli==1.1.0
# via
# -c requirements/base.txt
# flask-compress
# via flask-compress
cachelib==0.13.0
# via
# -c requirements/base.txt
# flask-caching
# flask-session
cachetools==5.5.2
# via
# -c requirements/base.txt
# google-auth
# via google-auth
cattrs==25.1.1
# via
# -c requirements/base.txt
# requests-cache
# via requests-cache
celery==5.5.2
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
certifi==2025.6.15
# via
# -c requirements/base.txt
# requests
# selenium
cffi==1.17.1
# via
# -c requirements/base.txt
# cryptography
# pynacl
cfgv==3.4.0
# via pre-commit
charset-normalizer==3.4.2
# via
# -c requirements/base.txt
# requests
# via requests
click==8.2.1
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# celery
# click-didyoumean
@@ -102,26 +74,20 @@ click==8.2.1
# flask
# flask-appbuilder
click-didyoumean==0.3.1
# via
# -c requirements/base.txt
# celery
# via celery
click-option-group==0.5.7
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
click-plugins==1.1.1
# via
# -c requirements/base.txt
# celery
# via celery
click-repl==0.3.0
# via
# -c requirements/base.txt
# celery
# via celery
cmdstanpy==1.1.0
# via prophet
colorama==0.4.6
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# flask-appbuilder
contourpy==1.0.7
@@ -130,15 +96,15 @@ coverage==7.6.8
# via pytest-cov
cron-descriptor==1.4.5
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
croniter==6.0.0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
cryptography==44.0.3
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# paramiko
# pyopenssl
@@ -147,40 +113,30 @@ cycler==0.12.1
db-dtypes==1.3.1
# via pandas-gbq
defusedxml==0.7.1
# via
# -c requirements/base.txt
# odfpy
# via odfpy
deprecated==1.2.18
# via
# -c requirements/base.txt
# limits
# via limits
deprecation==2.1.0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
dill==0.4.0
# via pylint
distlib==0.3.8
# via virtualenv
dnspython==2.7.0
# via
# -c requirements/base.txt
# email-validator
# via email-validator
docker==7.0.0
# via apache-superset
email-validator==2.2.0
# via
# -c requirements/base.txt
# flask-appbuilder
# via flask-appbuilder
et-xmlfile==2.0.0
# via
# -c requirements/base.txt
# openpyxl
# via openpyxl
filelock==3.12.2
# via virtualenv
flask==2.3.3
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# flask-appbuilder
# flask-babel
@@ -195,61 +151,52 @@ flask==2.3.3
# flask-sqlalchemy
# flask-testing
# flask-wtf
flask-appbuilder==4.8.0
flask-appbuilder==4.7.0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
flask-babel==2.0.0
# via
# -c requirements/base.txt
# flask-appbuilder
# via flask-appbuilder
flask-caching==2.3.1
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
flask-compress==1.17
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
flask-cors==4.0.2
# via
# -c requirements/base.txt
# apache-superset
# via apache-superset
flask-jwt-extended==4.7.1
# via
# -c requirements/base.txt
# flask-appbuilder
# via flask-appbuilder
flask-limiter==3.12
# via
# -c requirements/base.txt
# flask-appbuilder
# via flask-appbuilder
flask-login==0.6.3
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# flask-appbuilder
flask-migrate==3.1.0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
flask-session==0.8.0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
flask-sqlalchemy==2.5.1
# via
# -c requirements/base.txt
# flask-appbuilder
# flask-migrate
flask-talisman==1.1.0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
flask-testing==0.8.1
# via apache-superset
flask-wtf==1.2.2
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# flask-appbuilder
fonttools==4.55.0
@@ -259,12 +206,10 @@ freezegun==1.5.1
future==1.0.0
# via pyhive
geographiclib==2.0
# via
# -c requirements/base.txt
# geopy
# via geopy
geopy==2.4.1
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
gevent==24.2.1
# via apache-superset
@@ -277,7 +222,6 @@ google-api-core==2.23.0
# sqlalchemy-bigquery
google-auth==2.40.3
# via
# -c requirements/base.txt
# google-api-core
# google-auth-oauthlib
# google-cloud-bigquery
@@ -309,7 +253,7 @@ googleapis-common-protos==1.66.0
# grpcio-status
greenlet==3.1.1
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# gevent
# shillelagh
@@ -322,30 +266,27 @@ grpcio-status==1.60.1
# via google-api-core
gunicorn==23.0.0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
h11==0.16.0
# via
# -c requirements/base.txt
# wsproto
# via wsproto
hashids==1.3.1
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
holidays==0.25
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# prophet
humanize==4.12.3
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
identify==2.5.36
# via pre-commit
idna==3.10
# via
# -c requirements/base.txt
# email-validator
# requests
# trio
@@ -356,27 +297,24 @@ iniconfig==2.0.0
# via pytest
isodate==0.7.2
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
isort==6.0.1
# via pylint
itsdangerous==2.2.0
# via
# -c requirements/base.txt
# flask
# flask-wtf
jinja2==3.1.6
# via
# -c requirements/base.txt
# flask
# flask-babel
jsonpath-ng==1.7.0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
jsonschema==4.23.0
# via
# -c requirements/base.txt
# flask-appbuilder
# openapi-schema-validator
# openapi-spec-validator
@@ -384,82 +322,66 @@ jsonschema-path==0.3.4
# via openapi-spec-validator
jsonschema-specifications==2025.4.1
# via
# -c requirements/base.txt
# jsonschema
# openapi-schema-validator
kiwisolver==1.4.7
# via matplotlib
kombu==5.5.3
# via
# -c requirements/base.txt
# celery
# via celery
korean-lunar-calendar==0.3.1
# via
# -c requirements/base.txt
# holidays
# via holidays
lazy-object-proxy==1.10.0
# via openapi-spec-validator
limits==5.1.0
# via
# -c requirements/base.txt
# flask-limiter
# via flask-limiter
mako==1.3.10
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# alembic
# apache-superset
markdown==3.8
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
markdown-it-py==3.0.0
# via
# -c requirements/base.txt
# rich
# via rich
markupsafe==3.0.2
# via
# -c requirements/base.txt
# jinja2
# mako
# werkzeug
# wtforms
marshmallow==3.26.1
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# flask-appbuilder
# marshmallow-sqlalchemy
marshmallow-sqlalchemy==1.4.0
# via
# -c requirements/base.txt
# flask-appbuilder
# via flask-appbuilder
matplotlib==3.9.0
# via prophet
mccabe==0.7.0
# via pylint
mdurl==0.1.2
# via
# -c requirements/base.txt
# markdown-it-py
# via markdown-it-py
msgpack==1.0.8
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
msgspec==0.19.0
# via
# -c requirements/base.txt
# flask-session
# via flask-session
mysqlclient==2.2.6
# via apache-superset
nh3==0.2.21
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
nodeenv==1.8.0
# via pre-commit
numpy==1.26.4
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# bottleneck
# cmdstanpy
@@ -472,31 +394,22 @@ numpy==1.26.4
oauthlib==3.2.2
# via requests-oauthlib
odfpy==1.4.1
# via
# -c requirements/base.txt
# pandas
# via pandas
openapi-schema-validator==0.6.3
# via
# -c requirements/base.txt
# openapi-spec-validator
# via openapi-spec-validator
openapi-spec-validator==0.7.1
# via apache-superset
openpyxl==3.1.5
# via
# -c requirements/base.txt
# pandas
# via pandas
ordered-set==4.1.0
# via
# -c requirements/base.txt
# flask-limiter
# via flask-limiter
outcome==1.3.0.post0
# via
# -c requirements/base.txt
# trio
# trio-websocket
packaging==25.0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# apispec
# db-dtypes
@@ -512,7 +425,7 @@ packaging==25.0
# sqlalchemy-bigquery
pandas==2.0.3
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# cmdstanpy
# db-dtypes
@@ -524,18 +437,18 @@ parameterized==0.9.0
# via apache-superset
paramiko==3.5.1
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# sshtunnel
parsedatetime==2.6
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
pathable==0.4.3
# via jsonschema-path
pgsanity==0.2.9
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
pillow==10.3.0
# via
@@ -543,32 +456,25 @@ pillow==10.3.0
# matplotlib
platformdirs==4.3.8
# via
# -c requirements/base.txt
# pylint
# requests-cache
# virtualenv
pluggy==1.5.0
# via pytest
ply==3.11
# via
# -c requirements/base.txt
# jsonpath-ng
# via jsonpath-ng
polyline==2.0.2
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
pre-commit==4.1.0
# via apache-superset
prison==0.2.1
# via
# -c requirements/base.txt
# flask-appbuilder
# via flask-appbuilder
progress==1.6
# via apache-superset
prompt-toolkit==3.0.51
# via
# -c requirements/base.txt
# click-repl
# via click-repl
prophet==1.1.5
# via apache-superset
proto-plus==1.25.0
@@ -588,25 +494,21 @@ psycopg2-binary==2.9.6
# via apache-superset
pyarrow==18.1.0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# db-dtypes
# pandas-gbq
pyasn1==0.6.1
# via
# -c requirements/base.txt
# pyasn1-modules
# python-ldap
# rsa
pyasn1-modules==0.4.2
# via
# -c requirements/base.txt
# google-auth
# python-ldap
pycparser==2.22
# via
# -c requirements/base.txt
# cffi
# via cffi
pydata-google-auth==1.9.0
# via pandas-gbq
pydruid==0.6.9
@@ -614,38 +516,30 @@ pydruid==0.6.9
pyfakefs==5.3.5
# via apache-superset
pygments==2.19.1
# via
# -c requirements/base.txt
# rich
# via rich
pyhive==0.7.0
# via apache-superset
pyinstrument==4.4.0
# via apache-superset
pyjwt==2.10.1
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# flask-appbuilder
# flask-jwt-extended
pylint==3.3.7
# via apache-superset
pynacl==1.5.0
# via
# -c requirements/base.txt
# paramiko
# via paramiko
pyopenssl==25.1.0
# via
# -c requirements/base.txt
# shillelagh
# via shillelagh
pyparsing==3.2.3
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# matplotlib
pysocks==1.7.1
# via
# -c requirements/base.txt
# urllib3
# via urllib3
pytest==7.4.4
# via
# apache-superset
@@ -657,7 +551,7 @@ pytest-mock==3.10.0
# via apache-superset
python-dateutil==2.9.0.post0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# celery
# croniter
@@ -672,45 +566,40 @@ python-dateutil==2.9.0.post0
# trino
python-dotenv==1.1.0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
python-geohash==0.8.5
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
python-ldap==3.4.4
# via apache-superset
pytz==2025.2
# via
# -c requirements/base.txt
# croniter
# flask-babel
# pandas
# trino
pyxlsb==1.0.10
# via
# -c requirements/base.txt
# pandas
# via pandas
pyyaml==6.0.2
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# apispec
# jsonschema-path
# pre-commit
redis==4.6.0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
referencing==0.36.2
# via
# -c requirements/base.txt
# jsonschema
# jsonschema-path
# jsonschema-specifications
requests==2.32.4
# via
# -c requirements/base.txt
# docker
# google-api-core
# google-cloud-bigquery
@@ -722,33 +611,24 @@ requests==2.32.4
# shillelagh
# trino
requests-cache==1.2.1
# via
# -c requirements/base.txt
# shillelagh
# via shillelagh
requests-oauthlib==2.0.0
# via google-auth-oauthlib
rfc3339-validator==0.1.4
# via
# -c requirements/base.txt
# openapi-schema-validator
# via openapi-schema-validator
rich==13.9.4
# via
# -c requirements/base.txt
# flask-limiter
# via flask-limiter
rpds-py==0.25.0
# via
# -c requirements/base.txt
# jsonschema
# referencing
rsa==4.9.1
# via
# -c requirements/base.txt
# google-auth
# via google-auth
ruff==0.8.0
# via apache-superset
selenium==4.32.0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
setuptools==80.7.1
# via
@@ -759,34 +639,29 @@ setuptools==80.7.1
# zope-interface
shillelagh==1.3.5
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
simplejson==3.20.1
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
six==1.17.0
# via
# -c requirements/base.txt
# prison
# python-dateutil
# rfc3339-validator
# wtforms-json
slack-sdk==3.35.0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
sniffio==1.3.1
# via
# -c requirements/base.txt
# trio
# via trio
sortedcontainers==2.4.0
# via
# -c requirements/base.txt
# trio
# via trio
sqlalchemy==1.4.54
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# alembic
# apache-superset
# flask-appbuilder
@@ -799,24 +674,24 @@ sqlalchemy-bigquery==1.12.0
# via apache-superset
sqlalchemy-utils==0.38.3
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# flask-appbuilder
sqlglot==26.28.1
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
sqloxide==0.1.51
# via apache-superset
sshtunnel==0.4.0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
statsd==4.0.1
# via apache-superset
tabulate==0.9.0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
tomlkit==0.13.3
# via pylint
@@ -828,16 +703,13 @@ trino==0.330.0
# via apache-superset
trio==0.30.0
# via
# -c requirements/base.txt
# selenium
# trio-websocket
trio-websocket==0.12.2
# via
# -c requirements/base.txt
# selenium
# via selenium
typing-extensions==4.14.0
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# alembic
# apache-superset
# cattrs
@@ -848,71 +720,55 @@ typing-extensions==4.14.0
# shillelagh
tzdata==2025.2
# via
# -c requirements/base.txt
# kombu
# pandas
tzlocal==5.2
# via trino
url-normalize==2.2.1
# via
# -c requirements/base.txt
# requests-cache
# via requests-cache
urllib3==2.5.0
# via
# -c requirements/base.txt
# docker
# requests
# requests-cache
# selenium
vine==5.1.0
# via
# -c requirements/base.txt
# amqp
# celery
# kombu
virtualenv==20.29.2
# via pre-commit
wcwidth==0.2.13
# via
# -c requirements/base.txt
# prompt-toolkit
# via prompt-toolkit
websocket-client==1.8.0
# via
# -c requirements/base.txt
# selenium
# via selenium
werkzeug==3.1.3
# via
# -c requirements/base.txt
# flask
# flask-appbuilder
# flask-jwt-extended
# flask-login
wrapt==1.17.2
# via
# -c requirements/base.txt
# deprecated
# via deprecated
wsproto==1.2.0
# via
# -c requirements/base.txt
# trio-websocket
# via trio-websocket
wtforms==3.2.1
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# flask-appbuilder
# flask-wtf
# wtforms-json
wtforms-json==0.3.5
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
xlrd==2.0.1
# via
# -c requirements/base.txt
# pandas
# via pandas
xlsxwriter==3.0.9
# via
# -c requirements/base.txt
# apache-superset (pyproject.toml)
# apache-superset
# pandas
zope-event==5.0
@@ -920,6 +776,4 @@ zope-event==5.0
zope-interface==5.4.0
# via gevent
zstandard==0.23.0
# via
# -c requirements/base.txt
# flask-compress
# via flask-compress

View File

@@ -1,4 +1,430 @@
# This file was autogenerated by uv via the following command:
# uv pip compile requirements/translations.in -o requirements/translations.txt
# uv pip compile pyproject.toml requirements/translations.in -o requirements/translations.txt
alembic==1.16.2
# via flask-migrate
amqp==5.3.1
# via kombu
apispec==6.8.2
# via flask-appbuilder
apsw==3.50.2.0
# via shillelagh
attrs==25.3.0
# via
# cattrs
# jsonschema
# outcome
# referencing
# requests-cache
# trio
babel==2.17.0
# via -r requirements/translations.in
# via
# -r requirements/translations.in
# flask-babel
backoff==2.2.1
# via apache-superset (pyproject.toml)
bcrypt==4.3.0
# via paramiko
billiard==4.2.1
# via celery
blinker==1.9.0
# via flask
bottleneck==1.5.0
# via apache-superset (pyproject.toml)
brotli==1.1.0
# via flask-compress
cachelib==0.13.0
# via
# flask-caching
# flask-session
cachetools==5.5.2
# via google-auth
cattrs==25.1.1
# via requests-cache
celery==5.5.3
# via apache-superset (pyproject.toml)
certifi==2025.6.15
# via
# requests
# selenium
cffi==1.17.1
# via
# cryptography
# pynacl
charset-normalizer==3.4.2
# via requests
click==8.2.1
# via
# apache-superset (pyproject.toml)
# celery
# click-didyoumean
# click-option-group
# click-plugins
# click-repl
# flask
# flask-appbuilder
click-didyoumean==0.3.1
# via celery
click-option-group==0.5.7
# via apache-superset (pyproject.toml)
click-plugins==1.1.1.2
# via celery
click-repl==0.3.0
# via celery
colorama==0.4.6
# via
# apache-superset (pyproject.toml)
# flask-appbuilder
cron-descriptor==1.4.5
# via apache-superset (pyproject.toml)
croniter==6.0.0
# via apache-superset (pyproject.toml)
cryptography==44.0.3
# via
# apache-superset (pyproject.toml)
# paramiko
# pyopenssl
defusedxml==0.7.1
# via odfpy
deprecated==1.2.18
# via limits
deprecation==2.1.0
# via apache-superset (pyproject.toml)
dnspython==2.7.0
# via email-validator
email-validator==2.2.0
# via flask-appbuilder
et-xmlfile==2.0.0
# via openpyxl
flask==2.3.3
# via
# apache-superset (pyproject.toml)
# flask-appbuilder
# flask-babel
# flask-caching
# flask-compress
# flask-jwt-extended
# flask-limiter
# flask-login
# flask-migrate
# flask-session
# flask-sqlalchemy
# flask-wtf
flask-appbuilder==4.7.0
# via apache-superset (pyproject.toml)
flask-babel==2.0.0
# via flask-appbuilder
flask-caching==2.3.1
# via apache-superset (pyproject.toml)
flask-compress==1.17
# via apache-superset (pyproject.toml)
flask-jwt-extended==4.7.1
# via flask-appbuilder
flask-limiter==3.12
# via flask-appbuilder
flask-login==0.6.3
# via
# apache-superset (pyproject.toml)
# flask-appbuilder
flask-migrate==3.1.0
# via apache-superset (pyproject.toml)
flask-session==0.8.0
# via apache-superset (pyproject.toml)
flask-sqlalchemy==2.5.1
# via
# flask-appbuilder
# flask-migrate
flask-talisman==1.1.0
# via apache-superset (pyproject.toml)
flask-wtf==1.2.2
# via
# apache-superset (pyproject.toml)
# flask-appbuilder
geographiclib==2.0
# via geopy
geopy==2.4.1
# via apache-superset (pyproject.toml)
google-auth==2.40.3
# via shillelagh
greenlet==3.1.1
# via
# apache-superset (pyproject.toml)
# shillelagh
gunicorn==23.0.0
# via apache-superset (pyproject.toml)
h11==0.16.0
# via wsproto
hashids==1.3.1
# via apache-superset (pyproject.toml)
holidays==0.25
# via apache-superset (pyproject.toml)
humanize==4.12.3
# via apache-superset (pyproject.toml)
idna==3.10
# via
# email-validator
# requests
# trio
# url-normalize
isodate==0.7.2
# via apache-superset (pyproject.toml)
itsdangerous==2.2.0
# via
# flask
# flask-wtf
jinja2==3.1.6
# via
# flask
# flask-babel
jsonpath-ng==1.7.0
# via apache-superset (pyproject.toml)
jsonschema==4.24.0
# via flask-appbuilder
jsonschema-specifications==2025.4.1
# via jsonschema
kombu==5.5.4
# via celery
korean-lunar-calendar==0.3.1
# via holidays
limits==5.4.0
# via flask-limiter
mako==1.3.10
# via
# apache-superset (pyproject.toml)
# alembic
markdown==3.8.2
# via apache-superset (pyproject.toml)
markdown-it-py==3.0.0
# via rich
markupsafe==3.0.2
# via
# jinja2
# mako
# werkzeug
# wtforms
marshmallow==3.26.1
# via
# apache-superset (pyproject.toml)
# flask-appbuilder
# marshmallow-sqlalchemy
marshmallow-sqlalchemy==1.4.2
# via flask-appbuilder
mdurl==0.1.2
# via markdown-it-py
msgpack==1.0.8
# via apache-superset (pyproject.toml)
msgspec==0.19.0
# via flask-session
nh3==0.2.21
# via apache-superset (pyproject.toml)
numpy==2.2.6
# via
# apache-superset (pyproject.toml)
# bottleneck
# pandas
odfpy==1.4.1
# via pandas
openpyxl==3.1.5
# via pandas
ordered-set==4.1.0
# via flask-limiter
outcome==1.3.0.post0
# via
# trio
# trio-websocket
packaging==25.0
# via
# apache-superset (pyproject.toml)
# apispec
# deprecation
# gunicorn
# kombu
# limits
# marshmallow
# shillelagh
pandas==2.0.3
# via apache-superset (pyproject.toml)
paramiko==3.5.1
# via
# apache-superset (pyproject.toml)
# sshtunnel
parsedatetime==2.6
# via apache-superset (pyproject.toml)
pgsanity==0.2.9
# via apache-superset (pyproject.toml)
platformdirs==4.3.8
# via requests-cache
ply==3.11
# via jsonpath-ng
polyline==2.0.2
# via apache-superset (pyproject.toml)
prison==0.2.1
# via flask-appbuilder
prompt-toolkit==3.0.51
# via click-repl
pyarrow==18.1.0
# via apache-superset (pyproject.toml)
pyasn1==0.6.1
# via
# pyasn1-modules
# rsa
pyasn1-modules==0.4.2
# via google-auth
pycparser==2.22
# via cffi
pygments==2.19.2
# via rich
pyjwt==2.10.1
# via
# apache-superset (pyproject.toml)
# flask-appbuilder
# flask-jwt-extended
pynacl==1.5.0
# via paramiko
pyopenssl==25.1.0
# via shillelagh
pyparsing==3.2.3
# via apache-superset (pyproject.toml)
pysocks==1.7.1
# via urllib3
python-dateutil==2.9.0.post0
# via
# apache-superset (pyproject.toml)
# celery
# croniter
# flask-appbuilder
# holidays
# pandas
# shillelagh
python-dotenv==1.1.1
# via apache-superset (pyproject.toml)
python-geohash==0.8.5
# via apache-superset (pyproject.toml)
pytz==2025.2
# via
# croniter
# flask-babel
# pandas
pyxlsb==1.0.10
# via pandas
pyyaml==6.0.2
# via
# apache-superset (pyproject.toml)
# apispec
redis==4.6.0
# via apache-superset (pyproject.toml)
referencing==0.36.2
# via
# jsonschema
# jsonschema-specifications
requests==2.32.4
# via
# requests-cache
# shillelagh
requests-cache==1.2.1
# via shillelagh
rich==13.9.4
# via flask-limiter
rpds-py==0.25.1
# via
# jsonschema
# referencing
rsa==4.9.1
# via google-auth
selenium==4.34.0
# via apache-superset (pyproject.toml)
shillelagh==1.3.5
# via apache-superset (pyproject.toml)
simplejson==3.20.1
# via apache-superset (pyproject.toml)
six==1.17.0
# via
# prison
# python-dateutil
# wtforms-json
slack-sdk==3.35.0
# via apache-superset (pyproject.toml)
sniffio==1.3.1
# via trio
sortedcontainers==2.4.0
# via trio
sqlalchemy==1.4.54
# via
# apache-superset (pyproject.toml)
# alembic
# flask-appbuilder
# flask-sqlalchemy
# marshmallow-sqlalchemy
# shillelagh
# sqlalchemy-utils
sqlalchemy-utils==0.38.3
# via
# apache-superset (pyproject.toml)
# flask-appbuilder
sqlglot==26.31.0
# via apache-superset (pyproject.toml)
sshtunnel==0.4.0
# via apache-superset (pyproject.toml)
tabulate==0.9.0
# via apache-superset (pyproject.toml)
trio==0.30.0
# via
# selenium
# trio-websocket
trio-websocket==0.12.2
# via selenium
typing-extensions==4.14.0
# via
# apache-superset (pyproject.toml)
# alembic
# cattrs
# limits
# pyopenssl
# referencing
# selenium
# shillelagh
tzdata==2025.2
# via
# kombu
# pandas
url-normalize==2.2.1
# via requests-cache
urllib3==2.4.0
# via
# requests
# requests-cache
# selenium
vine==5.1.0
# via
# amqp
# celery
# kombu
wcwidth==0.2.13
# via prompt-toolkit
websocket-client==1.8.0
# via selenium
werkzeug==3.1.3
# via
# flask
# flask-appbuilder
# flask-jwt-extended
# flask-login
wrapt==1.17.2
# via deprecated
wsproto==1.2.0
# via trio-websocket
wtforms==3.2.1
# via
# apache-superset (pyproject.toml)
# flask-appbuilder
# flask-wtf
# wtforms-json
wtforms-json==0.3.5
# via apache-superset (pyproject.toml)
xlrd==2.0.2
# via pandas
xlsxwriter==3.0.9
# via
# apache-superset (pyproject.toml)
# pandas
zstandard==0.23.0
# via flask-compress

View File

@@ -24,8 +24,7 @@ ADDITIONAL_ARGS="$@"
# Generate the requirements/base.txt file
uv pip compile pyproject.toml requirements/base.in -o requirements/base.txt $ADDITIONAL_ARGS
# Generate the requirements/development.txt file, making sure requirements/base.txt is a constraint to keep the versions in sync. Note that `development.txt` is a Superset of `base.txt` where version for the shared libs should match their version.
# Generate the requirements/development.txt file, making sure requirements/base.txt is a constraint to keep the versions in sync
uv pip compile requirements/development.in -c requirements/base.txt -o requirements/development.txt $ADDITIONAL_ARGS
# NOTE translation is intended as a "supplemental" set of pins that can be combined with either base or dev as needed
uv pip compile requirements/translations.in -o requirements/translations.txt $ADDITIONAL_ARGS

View File

@@ -46,7 +46,6 @@ export type UiConfigType = {
urlParams?: {
[key: string]: any;
};
showRowLimitWarning?: boolean;
};
export type EmbedDashboardParams = {
@@ -134,9 +133,6 @@ export async function embedDashboard({
if (dashboardUiConfig.emitDataMasks) {
configNumber += 16;
}
if (dashboardUiConfig.showRowLimitWarning) {
configNumber += 32;
}
}
return configNumber;
}

View File

@@ -86,7 +86,9 @@ module.exports = {
],
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 2018,
ecmaFeatures: {
experimentalObjectRestSpread: true,
},
},
env: {
browser: true,
@@ -125,11 +127,6 @@ module.exports = {
'react-prefer-function-component',
'prettier',
],
// Add this TS ESlint rule in separate `rules` section to avoid breakages with JS/TS files in /cypress-base.
// TODO(hainenber): merge it to below `rules` section.
rules: {
'@typescript-eslint/prefer-optional-chain': 'error',
},
overrides: [
{
files: ['*.ts', '*.tsx'],
@@ -163,7 +160,7 @@ module.exports = {
'@typescript-eslint/no-non-null-assertion': 0, // disabled temporarily
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/explicit-module-boundary-types': 0, // re-enable up for discussion
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/prefer-optional-chain': 2,
camelcase: 0,
'class-methods-use-this': 0,
'func-names': 0,
@@ -398,7 +395,6 @@ module.exports = {
},
},
],
// eslint-disable-next-line no-dupe-keys
rules: {
'theme-colors/no-literal-colors': 'error',
'icons/no-fa-icons-usage': 'error',

View File

@@ -46,10 +46,10 @@ module.exports = {
plugins: [
'lodash',
'@babel/plugin-syntax-dynamic-import',
['@babel/plugin-transform-class-properties', { loose: true }],
['@babel/plugin-transform-optional-chaining', { loose: true }],
['@babel/plugin-transform-private-methods', { loose: true }],
['@babel/plugin-transform-nullish-coalescing-operator', { loose: true }],
['@babel/plugin-proposal-class-properties', { loose: true }],
['@babel/plugin-proposal-optional-chaining', { loose: true }],
['@babel/plugin-proposal-private-methods', { loose: true }],
['@babel/plugin-proposal-nullish-coalescing-operator', { loose: true }],
['@babel/plugin-transform-runtime', { corejs: 3 }],
// only used in packages/superset-ui-core/src/chart/components/reactify.tsx
['babel-plugin-typescript-to-proptypes', { loose: true }],

View File

@@ -27,6 +27,13 @@ describe('Login view', () => {
cy.visit(LOGIN);
});
it('should load login page', () => {
cy.getBySel('login-form').should('be.visible');
cy.getBySel('username-input').should('be.visible');
cy.getBySel('password-input').should('be.visible');
cy.getBySel('login-button').should('be.visible');
});
it('should redirect to login with incorrect username and password', () => {
interceptLogin();
cy.getBySel('login-form').should('be.visible');

View File

@@ -1,4 +1,3 @@
/* eslint-disable camelcase */
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -17,18 +16,22 @@
* specific language governing permissions and limitations
* under the License.
*/
import { ValueGetterParams } from 'ag-grid-community';
const filterValueGetter = (params: ValueGetterParams) => {
const raw = params.data[params.colDef.field as string];
const formatter = params.colDef.valueFormatter as Function;
if (!raw || !formatter) return null;
const formatted = formatter({
value: raw,
import { REGISTER } from 'cypress/utils/urls';
describe('Register view', () => {
beforeEach(() => {
cy.visit(REGISTER);
});
const numeric = parseFloat(String(formatted).replace('%', '').trim());
return Number.isNaN(numeric) ? null : numeric;
};
export default filterValueGetter;
it('should load register page', () => {
cy.getBySel('register-form').should('be.visible');
cy.getBySel('username-input').should('be.visible');
cy.getBySel('first-name-input').should('be.visible');
cy.getBySel('last-name-input').should('be.visible');
cy.getBySel('email-input').should('be.visible');
cy.getBySel('password-input').should('be.visible');
cy.getBySel('confirm-password-input').should('be.visible');
cy.getBySel('register-button').should('be.visible');
});
});

View File

@@ -21,21 +21,30 @@ import qs from 'querystring';
import {
dashboardView,
nativeFilters,
exploreView,
dataTestChartName,
} from 'cypress/support/directories';
import {
addCountryNameFilter,
addParentFilterWithValue,
applyAdvancedTimeRangeFilterOnDashboard,
applyNativeFilterValueWithIndex,
cancelNativeFilterSettings,
checkNativeFilterTooltip,
clickOnAddFilterInModal,
collapseFilterOnLeftPanel,
deleteNativeFilter,
enterNativeFilterEditModal,
expandFilterOnLeftPanel,
fillNativeFilterForm,
getNativeFilterPlaceholderWithIndex,
inputNativeFilterDefaultValue,
saveNativeFilterSettings,
nativeFilterTooltips,
undoDeleteNativeFilter,
validateFilterContentOnDashboard,
valueNativeFilterOptions,
validateFilterNameOnDashboard,
testItems,
WORLD_HEALTH_CHARTS,
@@ -46,19 +55,19 @@ import {
visitDashboard,
} from './shared_dashboard_functions';
// function selectFilter(index: number) {
// cy.get("[data-test='filter-title-container'] [draggable='true']")
// .eq(index)
// .click();
// }
function selectFilter(index: number) {
cy.get("[data-test='filter-title-container'] [draggable='true']")
.eq(index)
.click();
}
// function closeFilterModal() {
// cy.get('body').then($body => {
// if ($body.find('[data-test="native-filter-modal-cancel-button"]').length) {
// cy.getBySel('native-filter-modal-cancel-button').click();
// }
// });
// }
function closeFilterModal() {
cy.get('body').then($body => {
if ($body.find('[data-test="native-filter-modal-cancel-button"]').length) {
cy.getBySel('native-filter-modal-cancel-button').click();
}
});
}
describe('Native filters', () => {
describe('Nativefilters initial state not required', () => {
@@ -174,139 +183,46 @@ describe('Native filters', () => {
validateFilterContentOnDashboard(testItems.topTenChart.filterColumnYear);
});
describe.only('Numerical Range Filter - Display Modes', () => {
beforeEach(() => {
visitDashboard();
it('User can create a numerical range filter', () => {
visitDashboard();
enterNativeFilterEditModal(false);
fillNativeFilterForm(
testItems.filterType.numerical,
testItems.filterNumericalColumn,
testItems.datasetForNativeFilter,
testItems.filterNumericalColumn,
);
saveNativeFilterSettings([]);
// Assertions
cy.get('[data-test="range-filter-from-input"]')
.should('be.visible')
.click();
cy.get('[data-test="range-filter-from-input"]').type('{selectall}40');
cy.get('[data-test="range-filter-to-input"]')
.should('be.visible')
.click();
cy.get('[data-test="range-filter-to-input"]').type('{selectall}50');
cy.get(nativeFilters.applyFilter).click({
force: true,
});
const expandFilterConfiguration = () => {
cy.get('.ant-collapse-header')
.contains('Filter Configuration')
.should('be.visible')
.then($header => {
cy.wrap($header)
.closest('.ant-collapse-item')
.invoke('hasClass', 'ant-collapse-item-active')
.then(isExpanded => {
if (!isExpanded) cy.wrap($header).click();
});
});
// Assert that the URL contains 'native_filters'
cy.url().then(u => {
const ur = new URL(u);
expect(ur.search).to.include('native_filters');
cy.get('.ant-collapse-content-box').should('be.visible');
};
const selectRangeTypeOption = (label: string) => {
cy.contains('Range Type')
.should('be.visible')
.closest('.ant-form-item')
.within(() => {
cy.get('.ant-select-selector').click();
});
cy.get('.ant-select-dropdown:visible')
.contains('.ant-select-item-option', label)
.click();
};
const applyAndAssertInputs = (from: string, to: string) => {
// Set 'from' input
cy.get('[data-test="range-filter-from-input"]').clear();
cy.get('[data-test="range-filter-from-input"]').type(from);
cy.get('[data-test="range-filter-from-input"]').blur();
// Set 'to' input
cy.get('[data-test="range-filter-to-input"]').clear();
cy.get('[data-test="range-filter-to-input"]').type(to);
cy.get('[data-test="range-filter-to-input"]').blur();
// Assert values without chaining after .invoke()
cy.get('[data-test="range-filter-from-input"]')
.invoke('val')
.then(val => {
expect(val).to.equal(from);
});
.should('equal', '40');
// Assert that the "To" input has the correct value
cy.get('[data-test="range-filter-to-input"]')
.invoke('val')
.then(val => {
expect(val).to.equal(to);
});
};
it('User can create a numerical range filter with "Range Inputs" display mode', () => {
enterNativeFilterEditModal(false);
fillNativeFilterForm(
testItems.filterType.numerical,
testItems.filterNumericalColumn,
testItems.datasetForNativeFilter,
testItems.filterNumericalColumn,
);
expandFilterConfiguration();
selectRangeTypeOption('Range Inputs');
saveNativeFilterSettings([]);
cy.wait(500); // allow filter to mount
applyAndAssertInputs('40', '70');
});
it('User can change the display mode to "Slider"', () => {
enterNativeFilterEditModal(false);
fillNativeFilterForm(
testItems.filterType.numerical,
testItems.filterNumericalColumn,
testItems.datasetForNativeFilter,
testItems.filterNumericalColumn,
);
expandFilterConfiguration();
cy.contains('Range Type')
.should('be.visible')
.closest('.ant-form-item')
.within(() => {
cy.get('.ant-select-selector').click({ force: true });
});
cy.get('.ant-select-dropdown:visible .ant-select-item-option')
.contains(/^Slider$/)
.click({ force: true });
cy.get('.ant-select-selector').should('contain.text', 'Slider');
saveNativeFilterSettings([]);
cy.get('.ant-slider', { timeout: 10000 }).should('be.visible');
cy.get('[data-test="range-filter-from-input"]', {
timeout: 5000,
}).should('not.exist');
cy.get('[data-test="range-filter-to-input"]', { timeout: 5000 }).should(
'not.exist',
);
});
it('User can change the display mode to "Slider and range input"', () => {
enterNativeFilterEditModal(false);
// Re-create filter
fillNativeFilterForm(
testItems.filterType.numerical,
testItems.filterNumericalColumn,
testItems.datasetForNativeFilter,
testItems.filterNumericalColumn,
);
expandFilterConfiguration();
selectRangeTypeOption('Slider and range input');
saveNativeFilterSettings([]);
cy.wait(500);
applyAndAssertInputs('40', '70');
.should('equal', '50');
});
});

View File

@@ -16,29 +16,37 @@
* specific language governing permissions and limitations
* under the License.
*/
import qs from 'querystring';
import {
dashboardView,
nativeFilters,
exploreView,
dataTestChartName,
} from 'cypress/support/directories';
import {
addCountryNameFilter,
addParentFilterWithValue,
applyAdvancedTimeRangeFilterOnDashboard,
applyNativeFilterValueWithIndex,
cancelNativeFilterSettings,
checkNativeFilterTooltip,
clickOnAddFilterInModal,
collapseFilterOnLeftPanel,
deleteNativeFilter,
enterNativeFilterEditModal,
expandFilterOnLeftPanel,
fillNativeFilterForm,
getNativeFilterPlaceholderWithIndex,
inputNativeFilterDefaultValue,
saveNativeFilterSettings,
nativeFilterTooltips,
undoDeleteNativeFilter,
validateFilterContentOnDashboard,
valueNativeFilterOptions,
validateFilterNameOnDashboard,
testItems,
WORLD_HEALTH_CHARTS,
} from './utils';
import {
prepareDashboardFilters,

View File

@@ -363,26 +363,9 @@ export function saveNativeFilterSettings(charts: ChartSpec[]) {
cy.get(nativeFilters.modal.footer)
.contains('Save')
.should('be.visible')
.click({ force: true });
// Wait for modal to either close or remain open
cy.get('body').should($body => {
const modalExists = $body.find(nativeFilters.modal.container).length > 0;
if (modalExists) {
cy.get(nativeFilters.modal.footer)
.contains('Save')
.should('be.visible')
.click({ force: true });
}
});
// Ensure modal is closed
.click();
cy.get(nativeFilters.modal.container).should('not.exist');
// Wait for all charts to load
charts.forEach(chart => {
waitForChartLoad(chart);
});
charts.forEach(waitForChartLoad);
}
/** ************************************************************************

View File

@@ -18,6 +18,7 @@
*/
import '@cypress/code-coverage/support';
import '@applitools/eyes-cypress/commands';
import failOnConsoleError from 'cypress-fail-on-console-error';
import { expect } from 'chai';
import rison from 'rison';

View File

@@ -10,7 +10,7 @@
"allowJs": true,
"noEmit": true
},
"files": ["cypress/support/index.d.ts", "./node_modules/@applitools/eyes-cypress/types/index.d.ts"],
"files": ["cypress/support/index.d.ts", "./node_modules/@applitools/eyes-cypress/eyes-index.d.ts"],
"include": ["cypress/**/*.ts", "./cypress.config.ts"],
"exclude": ["node_modules"]
}

View File

@@ -37,7 +37,6 @@ module.exports = {
setupFilesAfterEnv: ['<rootDir>/spec/helpers/setup.ts'],
snapshotSerializers: ['@emotion/jest/serializer'],
testEnvironmentOptions: {
globalsCleanup: true,
url: 'http://localhost',
},
collectCoverageFrom: [
@@ -56,7 +55,7 @@ module.exports = {
],
coverageReporters: ['lcov', 'json-summary', 'html', 'text'],
transformIgnorePatterns: [
'node_modules/(?!d3-(interpolate|color|time)|remark-gfm|markdown-table|micromark-*.|decode-named-character-reference|character-entities|mdast-util-*.|unist-util-*.|ccount|escape-string-regexp|nanoid|@rjsf/*.|sinon|echarts|zrender|fetch-mock|pretty-ms|parse-ms|ol|@babel/runtime|@emotion|cheerio|cheerio/lib|parse5|dom-serializer|entities|htmlparser2|rehype-sanitize|hast-util-sanitize|unified|unist-.*|hast-.*|rehype-.*|remark-.*|mdast-.*|micromark-.*|parse-entities|property-information|space-separated-tokens|comma-separated-tokens|bail|devlop|zwitch|longest-streak|geostyler|geostyler-.*|react-error-boundary|react-json-tree|react-base16-styling|lodash-es)',
'node_modules/(?!d3-(interpolate|color|time)|remark-gfm|markdown-table|micromark-*.|decode-named-character-reference|character-entities|mdast-util-*.|unist-util-*.|ccount|escape-string-regexp|nanoid|@rjsf/*.|sinon|echarts|zrender|fetch-mock|pretty-ms|parse-ms|ol|@babel/runtime|@emotion|cheerio|cheerio/lib|parse5|dom-serializer|entities|htmlparser2|rehype-sanitize|hast-util-sanitize|unified|unist-.*|hast-.*|rehype-.*|remark-.*|mdast-.*|micromark-.*|parse-entities|property-information|space-separated-tokens|comma-separated-tokens|bail|devlop|zwitch|longest-streak|jest-enzyme|geostyler|geostyler-.*)',
],
preset: 'ts-jest',
transform: {

File diff suppressed because it is too large Load Diff

View File

@@ -84,7 +84,7 @@
"dependencies": {
"@emotion/cache": "^11.4.0",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@emotion/styled": "^11.3.0",
"@reduxjs/toolkit": "^1.9.3",
"@rjsf/core": "^5.21.1",
"@rjsf/utils": "^5.24.3",
@@ -104,7 +104,6 @@
"@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/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-handlebars": "file:./plugins/plugin-chart-handlebars",
@@ -155,7 +154,7 @@
"json-stringify-pretty-compact": "^2.0.0",
"lodash": "^4.17.21",
"luxon": "^3.5.0",
"mapbox-gl": "^3.13.0",
"mapbox-gl": "^2.10.0",
"markdown-to-jsx": "^7.7.4",
"match-sorter": "^6.3.4",
"memoize-one": "^5.2.1",
@@ -165,6 +164,7 @@
"ol": "^7.5.2",
"polished": "^4.3.1",
"prop-types": "^15.8.1",
"rc-trigger": "^5.3.4",
"re-resizable": "^6.10.1",
"react": "^17.0.2",
"react-checkbox-tree": "^1.8.0",
@@ -176,7 +176,7 @@
"react-google-recaptcha": "^3.1.0",
"react-hot-loader": "^4.13.1",
"react-intersection-observer": "^9.16.0",
"react-json-tree": "^0.20.0",
"react-json-tree": "^0.17.0",
"react-lines-ellipsis": "^0.15.4",
"react-loadable": "^5.5.0",
"react-redux": "^7.2.9",
@@ -186,6 +186,7 @@
"react-search-input": "^0.11.3",
"react-sortable-hoc": "^2.0.0",
"react-split": "^2.0.9",
"react-syntax-highlighter": "^15.4.5",
"react-table": "^7.8.0",
"react-transition-group": "^4.4.5",
"react-virtualized-auto-sizer": "^1.0.25",
@@ -203,16 +204,19 @@
"use-event-callback": "^0.1.0",
"use-immer": "^0.9.0",
"use-query-params": "^1.1.9",
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
"yargs": "^17.7.2"
},
"devDependencies": {
"@applitools/eyes-storybook": "^3.55.6",
"@babel/cli": "^7.27.2",
"@applitools/eyes-storybook": "^3.50.9",
"@babel/cli": "^7.22.6",
"@babel/compat-data": "^7.26.8",
"@babel/core": "^7.26.0",
"@babel/eslint-parser": "^7.25.9",
"@babel/node": "^7.22.6",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
"@babel/plugin-proposal-private-methods": "^7.18.6",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-modules-commonjs": "^7.26.3",
"@babel/plugin-transform-runtime": "^7.27.1",
@@ -254,11 +258,13 @@
"@types/node": "^22.12.0",
"@types/react": "^17.0.83",
"@types/react-dom": "^17.0.26",
"@types/react-gravatar": "^2.6.14",
"@types/react-json-tree": "^0.6.11",
"@types/react-loadable": "^5.5.11",
"@types/react-redux": "^7.1.10",
"@types/react-resizable": "^3.0.8",
"@types/react-router-dom": "^5.3.3",
"@types/react-syntax-highlighter": "^15.5.13",
"@types/react-transition-group": "^4.4.12",
"@types/react-ultimate-pagination": "^1.2.4",
"@types/react-virtualized-auto-sizer": "^1.0.4",
@@ -269,16 +275,17 @@
"@types/sinon": "^17.0.3",
"@types/testing-library__jest-dom": "^5.14.9",
"@types/tinycolor2": "^1.4.3",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"babel-jest": "^30.0.2",
"@types/yargs": "12 - 18",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"babel-jest": "^29.7.0",
"babel-loader": "^10.0.0",
"babel-plugin-dynamic-import-node": "^2.3.3",
"babel-plugin-jsx-remove-data-test-id": "^3.0.0",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-typescript-to-proptypes": "^2.0.0",
"cheerio": "1.1.0",
"copy-webpack-plugin": "^13.0.0",
"cheerio": "1.0.0-rc.10",
"copy-webpack-plugin": "^12.0.2",
"cross-env": "^7.0.3",
"css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^7.0.2",
@@ -308,9 +315,9 @@
"history": "^5.3.0",
"html-webpack-plugin": "^5.6.3",
"imports-loader": "^5.0.0",
"jest": "^30.0.2",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-html-reporter": "^4.3.0",
"jest-html-reporter": "^3.10.2",
"jest-websocket-mock": "^2.5.0",
"jsdom": "^26.0.0",
"lerna": "^8.2.1",
@@ -329,19 +336,19 @@
"storybook": "8.1.11",
"style-loader": "^4.0.0",
"thread-loader": "^4.0.4",
"ts-jest": "^29.4.0",
"ts-jest": "^29.2.5",
"ts-loader": "^9.5.1",
"tscw-config": "^1.1.2",
"tsx": "^4.19.2",
"typescript": "5.4.5",
"typescript": "5.1.6",
"vm-browserify": "^1.1.2",
"webpack": "^5.99.9",
"webpack": "^5.98.0",
"webpack-bundle-analyzer": "^4.10.1",
"webpack-cli": "^6.0.1",
"webpack-dev-server": "^5.2.1",
"webpack-manifest-plugin": "^5.0.1",
"webpack-sources": "^3.3.3",
"webpack-visualizer-plugin2": "^1.2.0"
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.15.1",
"webpack-manifest-plugin": "^5.0.0",
"webpack-sources": "^3.2.3",
"webpack-visualizer-plugin2": "^1.1.0"
},
"peerDependencies": {
"ace-builds": "^1.41.0",

View File

@@ -28,7 +28,7 @@ import { <%= packageLabel %>Props, <%= packageLabel %>StylesProps } from './type
// https://github.com/apache-superset/superset-ui/blob/master/packages/superset-ui-core/src/theme/index.ts
const Styles = styled.div<<%= packageLabel %>StylesProps>`
background-color: ${({ theme }) => theme.colorPrimaryBg};
background-color: ${({ theme }) => theme.colors.primary.light2};
padding: ${({ theme }) => theme.sizeUnit * 4}px;
border-radius: ${({ theme }) => theme.borderRadius}px;
height: ${({ height }) => height}px;

View File

@@ -30,14 +30,14 @@
"dependencies": {
"chalk": "^5.4.1",
"lodash-es": "^4.17.21",
"yeoman-generator": "^7.5.1",
"yeoman-generator": "^7.4.0",
"yosay": "^3.0.0"
},
"devDependencies": {
"cross-env": "^7.0.3",
"fs-extra": "^11.3.0",
"jest": "^30.0.2",
"yeoman-test": "^10.1.1"
"fs-extra": "^11.2.0",
"jest": "^29.7.0",
"yeoman-test": "^8.3.0"
},
"engines": {
"npm": ">= 4.0.0",

View File

@@ -27,9 +27,10 @@ import {
import { PostProcessingFactory } from './types';
import { extractExtraMetrics } from './utils';
export const sortOperator: PostProcessingFactory<
PostProcessingSort
> = formData => {
export const sortOperator: PostProcessingFactory<PostProcessingSort> = (
formData,
queryObject,
) => {
// the sortOperator only used in the barchart v2
const sortableLabels = [
getXAxisLabel(formData),

View File

@@ -29,7 +29,6 @@ export const TITLE_POSITION_OPTIONS: [string, string][] = [
['Left', t('Left')],
['Top', t('Top')],
];
export const titleControls: ControlPanelSectionConfig = {
label: t('Chart Title'),
tabOverride: 'customize',
@@ -44,6 +43,7 @@ export const titleControls: ControlPanelSectionConfig = {
label: t('X Axis Title'),
renderTrigger: true,
default: '',
description: t('Changing this control takes effect instantly'),
},
},
],
@@ -58,6 +58,7 @@ export const titleControls: ControlPanelSectionConfig = {
renderTrigger: true,
default: TITLE_MARGIN_OPTIONS[0],
choices: formatSelectOptions(TITLE_MARGIN_OPTIONS),
description: t('Changing this control takes effect instantly'),
},
},
],
@@ -70,6 +71,7 @@ export const titleControls: ControlPanelSectionConfig = {
label: t('Y Axis Title'),
renderTrigger: true,
default: '',
description: t('Changing this control takes effect instantly'),
},
},
],
@@ -84,6 +86,7 @@ export const titleControls: ControlPanelSectionConfig = {
renderTrigger: true,
default: TITLE_MARGIN_OPTIONS[1],
choices: formatSelectOptions(TITLE_MARGIN_OPTIONS),
description: t('Changing this control takes effect instantly'),
},
},
],
@@ -98,6 +101,7 @@ export const titleControls: ControlPanelSectionConfig = {
renderTrigger: true,
default: TITLE_POSITION_OPTIONS[0][0],
choices: TITLE_POSITION_OPTIONS,
description: t('Changing this control takes effect instantly'),
},
},
],

View File

@@ -17,12 +17,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import {
GenericDataType,
QueryColumn,
t,
validateNonEmpty,
} from '@superset-ui/core';
import { QueryColumn, t, validateNonEmpty } from '@superset-ui/core';
import {
ExtraControlProps,
SharedControlConfig,
@@ -57,19 +52,6 @@ type Control = {
* feature flags are set and when they're checked.
*/
function filterOptions(
options: (ColumnMeta | QueryColumn)[],
allowedDataTypes?: GenericDataType[],
) {
if (!allowedDataTypes) {
return options;
}
return options.filter(
o =>
o.type_generic !== undefined && allowedDataTypes.includes(o.type_generic),
);
}
export const dndGroupByControl: SharedControlConfig<
'DndColumnSelect' | 'SelectControl',
ColumnMeta
@@ -99,20 +81,14 @@ export const dndGroupByControl: SharedControlConfig<
const newState: ExtraControlProps = {};
const { datasource } = state;
if (datasource?.columns[0]?.hasOwnProperty('groupby')) {
const options = filterOptions(
(datasource as Dataset).columns.filter(c => c.groupby),
controlState?.allowedDataTypes,
);
const options = (datasource as Dataset).columns.filter(c => c.groupby);
if (controlState?.includeTime) {
options.unshift(DATASET_TIME_COLUMN_OPTION);
}
newState.options = options;
newState.savedMetrics = (datasource as Dataset).metrics || [];
} else {
const options = filterOptions(
(datasource?.columns as QueryColumn[]) || [],
controlState?.allowedDataTypes,
);
const options = (datasource?.columns as QueryColumn[]) || [];
if (controlState?.includeTime) {
options.unshift(QUERY_TIME_COLUMN_OPTION);
}
@@ -201,19 +177,6 @@ export const dndAdhocMetricControl: typeof dndAdhocMetricsControl = {
),
};
export const dndTooltipColumnsControl: typeof dndColumnsControl = {
...dndColumnsControl,
label: t('Tooltip (columns)'),
description: t('Columns to show in the tooltip.'),
};
export const dndTooltipMetricsControl: typeof dndAdhocMetricsControl = {
...dndAdhocMetricsControl,
label: t('Tooltip (metrics)'),
description: t('Metrics to show in the tooltip.'),
validators: [],
};
export const dndAdhocMetricControl2: typeof dndAdhocMetricControl = {
...dndAdhocMetricControl,
label: t('Right Axis Metric'),

View File

@@ -45,7 +45,6 @@ import {
isDefined,
NO_TIME_RANGE,
validateMaxValue,
getColumnLabel,
} from '@superset-ui/core';
import {
@@ -83,8 +82,6 @@ import {
dndSeriesControl,
dndAdhocMetricControl2,
dndXAxisControl,
dndTooltipColumnsControl,
dndTooltipMetricsControl,
} from './dndControls';
const categoricalSchemeRegistry = getCategoricalSchemeRegistry();
@@ -376,14 +373,6 @@ const temporal_columns_lookup: SharedControlConfig<'HiddenControl'> = {
),
};
const zoomable: SharedControlConfig<'CheckboxControl'> = {
type: 'CheckboxControl',
label: t('Data Zoom'),
default: false,
renderTrigger: true,
description: t('Enable data zooming controls'),
};
const sort_by_metric: SharedControlConfig<'CheckboxControl'> = {
type: 'CheckboxControl',
label: t('Sort by metric'),
@@ -392,26 +381,6 @@ const sort_by_metric: SharedControlConfig<'CheckboxControl'> = {
),
};
const order_by_cols: SharedControlConfig<'SelectControl'> = {
type: 'SelectControl',
label: t('Ordering'),
description: t('Order results by selected columns'),
multi: true,
default: [],
shouldMapStateToProps: () => true,
mapStateToProps: ({ datasource }) => ({
choices: (datasource?.columns || [])
.map(col =>
[true, false].map(asc => [
JSON.stringify([col.column_name, asc]),
`${getColumnLabel(col.column_name)} [${asc ? 'asc' : 'desc'}]`,
]),
)
.flat(),
}),
resetOnHide: false,
};
export default {
metrics: dndAdhocMetricsControl,
metric: dndAdhocMetricControl,
@@ -423,8 +392,6 @@ export default {
secondary_metric: dndSecondaryMetricControl,
groupby: dndGroupByControl,
columns: dndColumnsControl,
tooltip_columns: dndTooltipColumnsControl,
tooltip_metrics: dndTooltipMetricsControl,
granularity,
granularity_sqla: dndGranularitySqlaControl,
time_grain_sqla,
@@ -450,10 +417,8 @@ export default {
legacy_order_by: dndSortByControl,
truncate_metric,
x_axis: dndXAxisControl,
zoomable,
show_empty_columns,
temporal_columns_lookup,
currency_format,
sort_by_metric,
order_by_cols,
};

View File

@@ -90,7 +90,6 @@ export interface Dataset {
database?: Record<string, unknown>;
normalize_columns?: boolean;
always_filter_main_dttm?: boolean;
extra?: object | string;
}
export interface ControlPanelState {
@@ -162,7 +161,6 @@ export type InternalControlType =
| 'DatasourceControl'
| 'DateFilterControl'
| 'FixedOrMetricControl'
| 'ColorBreakpointsControl'
| 'HiddenControl'
| 'SelectAsyncControl'
| 'SelectControl'

View File

@@ -26,10 +26,10 @@
"dependencies": {
"@ant-design/icons": "^5.2.6",
"@babel/runtime": "^7.25.6",
"@fontsource/fira-code": "^5.2.6",
"@fontsource/inter": "^5.2.6",
"@fontsource/fira-code": "^5.0.18",
"@fontsource/inter": "^5.0.20",
"@types/json-bigint": "^1.0.4",
"ace-builds": "^1.43.1",
"ace-builds": "^1.41.0",
"brace": "^0.11.1",
"classnames": "^2.2.5",
"csstype": "^3.1.3",
@@ -51,14 +51,13 @@
"react-js-cron": "^5.2.0",
"react-draggable": "^4.4.6",
"react-resize-detector": "^7.1.2",
"react-syntax-highlighter": "^15.4.5",
"react-ultimate-pagination": "^1.3.2",
"react-error-boundary": "^6.0.0",
"react-error-boundary": "^5.0.0",
"react-markdown": "^8.0.7",
"regenerator-runtime": "^0.14.1",
"rehype-raw": "^7.0.0",
"rehype-sanitize": "^6.0.0",
"remark-gfm": "^4.0.1",
"remark-gfm": "^3.0.1",
"reselect": "^4.0.0",
"rison": "^0.1.1",
"seedrandom": "^3.0.5",
@@ -66,16 +65,15 @@
"xss": "^1.0.14"
},
"devDependencies": {
"@emotion/styled": "^11.14.1",
"@emotion/styled": "^11.3.0",
"@types/d3-format": "^3.0.4",
"@types/d3-interpolate": "^3.0.4",
"@types/d3-scale": "^2.1.1",
"@types/d3-time": "^3.0.4",
"@types/d3-time-format": "^4.0.3",
"@types/react-table": "^7.7.20",
"@types/react-syntax-highlighter": "^15.5.13",
"@types/jquery": "^3.5.8",
"@types/lodash": "^4.17.20",
"@types/lodash": "^4.17.16",
"@types/math-expression-evaluator": "^1.3.3",
"@types/node": "^22.10.3",
"@types/prop-types": "^15.7.2",
@@ -90,7 +88,7 @@
"antd": "^5.24.6",
"@emotion/cache": "^11.4.0",
"@emotion/react": "^11.4.1",
"@emotion/styled": "^11.14.1",
"@emotion/styled": "^11.3.0",
"@testing-library/dom": "^8.20.1",
"@testing-library/jest-dom": "*",
"@testing-library/react": "^12.1.5",

View File

@@ -16,11 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
export const ELEMENT_HEIGHT_SCALE = 0.85 as const;
export enum Dimension {
StartTime = 'startTime',
EndTime = 'endTime',
Index = 'index',
SeriesCount = 'seriesCount',
// /superset/sqllab_viz
interface SqlLabPostRequest {
data: {
schema: string;
sql: string;
dbId: number;
templateParams?: string | undefined;
datasourceName: string;
metrics?: string[];
columns?: string[];
};
}

View File

@@ -55,11 +55,7 @@ export enum AppSection {
Embedded = 'EMBEDDED',
}
export type FilterState = {
value?: any;
customColumnLabel?: string;
[key: string]: any;
};
export type FilterState = { value?: any; [key: string]: any };
export type DataMask = {
extraFormData?: ExtraFormData;

View File

@@ -31,7 +31,6 @@ export enum VizType {
Compare = 'compare',
CountryMap = 'country_map',
Funnel = 'funnel',
Gantt = 'gantt_chart',
Gauge = 'gauge_chart',
Graph = 'graph_chart',
Handlebars = 'handlebars',
@@ -55,7 +54,6 @@ export enum VizType {
Step = 'echarts_timeseries_step',
Sunburst = 'sunburst_v2',
Table = 'table',
TableAgGrid = 'ag-grid-table',
TimePivot = 'time_pivot',
TimeTable = 'time_table',
Timeseries = 'echarts_timeseries',

View File

@@ -27,8 +27,6 @@ import getLabelsColorMap, {
import { getAnalogousColors } from './utils';
import { FeatureFlag, isFeatureEnabled } from '../utils';
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
// Use type augmentation to correct the fact that
// an instance of CategoricalScale is also a function
interface CategoricalColorScale {

View File

@@ -165,7 +165,7 @@ export default {
defaultValue: { summary: 'false' },
},
},
popupRender: {
dropdownRender: {
control: false,
description:
'Custom render function for dropdown content. `(menus: ReactNode) => ReactNode`',

View File

@@ -1,320 +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 { Typography, Flex, Space } from '@superset-ui/core/components';
import CodeSyntaxHighlighter from '.';
import type { CodeSyntaxHighlighterProps, SupportedLanguage } from '.';
const { Title, Text, Paragraph } = Typography;
const languages: SupportedLanguage[] = ['sql', 'json', 'htmlbars', 'markdown'];
// Sample code for each language
const sampleCode = {
sql: `-- Complex SQL Query Example
SELECT
u.id,
u.username,
u.email,
COUNT(o.id) as total_orders,
SUM(o.amount) as total_spent,
AVG(o.amount) as avg_order_value
FROM users u
LEFT JOIN orders o ON u.id = o.user_id
WHERE u.created_at >= '2023-01-01'
AND u.status = 'active'
GROUP BY u.id, u.username, u.email
HAVING COUNT(o.id) > 0
ORDER BY total_spent DESC, total_orders DESC
LIMIT 50;`,
json: `{
"user": {
"id": 12345,
"username": "john_doe",
"email": "john@example.com",
"profile": {
"firstName": "John",
"lastName": "Doe",
"age": 30,
"preferences": {
"theme": "dark",
"language": "en",
"notifications": true
}
},
"orders": [
{
"id": "order_001",
"amount": 99.99,
"status": "completed",
"items": ["laptop", "mouse"]
},
{
"id": "order_002",
"amount": 49.99,
"status": "pending",
"items": ["keyboard"]
}
]
}
}`,
htmlbars: `{{!-- Handlebars Template Example --}}
<div class="user-profile">
<h1>Welcome, {{user.firstName}} {{user.lastName}}!</h1>
{{#if user.orders}}
<div class="orders-section">
<h2>Your Orders ({{user.orders.length}})</h2>
{{#each user.orders}}
<div class="order-card {{status}}">
<h3>Order #{{id}}</h3>
<p class="amount">\${{amount}}</p>
<p class="status">Status: {{capitalize status}}</p>
{{#if items}}
<ul class="items">
{{#each items}}
<li>{{this}}</li>
{{/each}}
</ul>
{{/if}}
</div>
{{/each}}
</div>
{{else}}
<p class="no-orders">No orders found.</p>
{{/if}}
</div>`,
markdown: `# CodeSyntaxHighlighter Component
A **themed syntax highlighter** for Superset that supports multiple languages and automatic theme switching.
## Features
- 🎨 **Automatic theming** - Adapts to light/dark modes
- ⚡ **Lazy loading** - Languages load on-demand for better performance
- 🔧 **TypeScript support** - Full type safety
- 📱 **Responsive** - Works on all screen sizes
## Supported Languages
| Language | Extension | Use Case |
|----------|-----------|----------|
| SQL | \`.sql\` | Database queries |
| JSON | \`.json\` | Data interchange |
| HTML/Handlebars | \`.hbs\` | Templates |
| Markdown | \`.md\` | Documentation |
## Usage
\`\`\`typescript
import CodeSyntaxHighlighter from '@superset-ui/core/components/CodeSyntaxHighlighter';
<CodeSyntaxHighlighter language="sql">
SELECT * FROM users WHERE active = true;
</CodeSyntaxHighlighter>
\`\`\`
> **Note**: Languages are loaded lazily for optimal performance!`,
};
export default {
title: 'Components/CodeSyntaxHighlighter',
component: CodeSyntaxHighlighter,
parameters: {
docs: {
description: {
component:
"A themed syntax highlighter component that automatically adapts to Superset's light/dark themes and supports lazy loading of languages.",
},
},
},
};
// Gallery showing all supported languages
export const LanguageGallery = () => (
<Space direction="vertical" size="large" style={{ width: '100%' }}>
{languages.map(language => (
<div key={language}>
<Title
level={3}
style={{ textTransform: 'capitalize', marginBottom: 16 }}
>
{language.toUpperCase()} Example
</Title>
<CodeSyntaxHighlighter language={language}>
{sampleCode[language]}
</CodeSyntaxHighlighter>
</div>
))}
</Space>
);
// Interactive playground
export const InteractivePlayground = (args: CodeSyntaxHighlighterProps) => (
<CodeSyntaxHighlighter {...args}>
{args.children || sampleCode[args.language || 'sql']}
</CodeSyntaxHighlighter>
);
InteractivePlayground.args = {
language: 'sql',
showLineNumbers: false,
wrapLines: true,
children: sampleCode.sql,
};
InteractivePlayground.argTypes = {
language: {
control: { type: 'select' },
options: languages,
description: 'Programming language for syntax highlighting',
},
showLineNumbers: {
control: { type: 'boolean' },
description: 'Display line numbers alongside the code',
},
wrapLines: {
control: { type: 'boolean' },
description: 'Wrap long lines instead of showing horizontal scroll',
},
children: {
control: { type: 'text' },
description: 'Code content to highlight',
},
customStyle: {
control: { type: 'object' },
description: 'Custom CSS styles to apply to the syntax highlighter',
},
};
// Showcase different styling options
export const StylingExamples = () => (
<Space direction="vertical" size="large" style={{ width: '100%' }}>
{/* Default styling */}
<div>
<Title level={3}>Default Styling</Title>
<CodeSyntaxHighlighter language="sql">
SELECT id, name FROM users WHERE active = true;
</CodeSyntaxHighlighter>
</div>
{/* With line numbers */}
<div>
<Title level={3}>With Line Numbers</Title>
<CodeSyntaxHighlighter language="sql" showLineNumbers>
{sampleCode.sql}
</CodeSyntaxHighlighter>
</div>
{/* Custom styling */}
<div>
<Title level={3}>Custom Styling (Compact)</Title>
<CodeSyntaxHighlighter
language="json"
customStyle={{
fontSize: '12px',
padding: '12px',
maxHeight: '200px',
overflow: 'auto',
}}
>
{sampleCode.json}
</CodeSyntaxHighlighter>
</div>
{/* No line wrapping */}
<div>
<Title level={3}>No Line Wrapping</Title>
<CodeSyntaxHighlighter
language="sql"
wrapLines={false}
customStyle={{ maxWidth: '400px' }}
>
{`SELECT very_long_column_name, another_very_long_column_name, yet_another_extremely_long_column_name FROM very_long_table_name WHERE condition = 'this is a very long condition';`}
</CodeSyntaxHighlighter>
</div>
</Space>
);
// Performance and edge cases
export const EdgeCases = () => (
<Space direction="vertical" size="large" style={{ width: '100%' }}>
{/* Very long single line */}
<div>
<Title level={3}>Very Long Single Line</Title>
<CodeSyntaxHighlighter language="sql">
{`SELECT ${'very_long_column_name, '.repeat(20)}id FROM users;`}
</CodeSyntaxHighlighter>
</div>
{/* Special characters */}
<div>
<Title level={3}>Special Characters & Escaping</Title>
<CodeSyntaxHighlighter language="sql">
{`SELECT * FROM "table-name" WHERE field = 'O\\'Brien' AND data = '{"key": "value"}';`}
</CodeSyntaxHighlighter>
</div>
{/* Multiple languages showcase */}
<div>
<Title level={3}>Quick Language Comparison</Title>
<Flex gap="middle">
<div style={{ flex: 1 }}>
<Title level={4}>SQL</Title>
<CodeSyntaxHighlighter language="sql">
SELECT id, name FROM users;
</CodeSyntaxHighlighter>
</div>
<div style={{ flex: 1 }}>
<Title level={4}>JSON</Title>
<CodeSyntaxHighlighter language="json">
{`{"users": [{"id": 1, "name": "John"}]}`}
</CodeSyntaxHighlighter>
</div>
</Flex>
</div>
</Space>
);
// Theme testing helper
export const ThemeShowcase = () => (
<Space direction="vertical" size="middle" style={{ width: '100%' }}>
<Paragraph>
<Text strong>Theme Testing:</Text> Switch between light and dark themes in
Storybook to see automatic adaptation.
</Paragraph>
<Space direction="vertical" size="large" style={{ width: '100%' }}>
{languages.map(language => (
<div key={language}>
<Title level={4} style={{ textTransform: 'uppercase' }}>
{language}
</Title>
<CodeSyntaxHighlighter language={language}>
{sampleCode[language].split('\n').slice(0, 5).join('\n')}
</CodeSyntaxHighlighter>
</div>
))}
</Space>
</Space>
);

View File

@@ -1,156 +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 { render, screen } from '../../spec';
import CodeSyntaxHighlighter from './index';
// Simple mock that just returns the content
jest.mock(
'react-syntax-highlighter/dist/cjs/light',
() =>
function MockSyntaxHighlighter({ children, ...props }: any) {
return (
<pre data-testid="syntax-highlighter" data-language={props.language}>
{children}
</pre>
);
},
);
// Mock the language modules
jest.mock(
'react-syntax-highlighter/dist/cjs/languages/hljs/sql',
() => 'sql-mock',
);
jest.mock(
'react-syntax-highlighter/dist/cjs/languages/hljs/json',
() => 'json-mock',
);
jest.mock(
'react-syntax-highlighter/dist/cjs/languages/hljs/htmlbars',
() => 'html-mock',
);
jest.mock(
'react-syntax-highlighter/dist/cjs/languages/hljs/markdown',
() => 'md-mock',
);
// Mock the styles
jest.mock('react-syntax-highlighter/dist/cjs/styles/hljs/github', () => ({}));
jest.mock(
'react-syntax-highlighter/dist/cjs/styles/hljs/atom-one-dark',
() => ({}),
);
describe('CodeSyntaxHighlighter', () => {
it('renders code content', () => {
render(<CodeSyntaxHighlighter>SELECT * FROM users;</CodeSyntaxHighlighter>);
expect(screen.getByText('SELECT * FROM users;')).toBeInTheDocument();
});
it('renders with default SQL language', () => {
render(<CodeSyntaxHighlighter>SELECT * FROM users;</CodeSyntaxHighlighter>);
// Should show content (the important thing is content is visible)
expect(screen.getByText('SELECT * FROM users;')).toBeInTheDocument();
});
it('renders with specified language', () => {
render(
<CodeSyntaxHighlighter language="json">
{`{ "key": "value" }`}
</CodeSyntaxHighlighter>,
);
// Should show content regardless of which element renders it
expect(screen.getByText('{ "key": "value" }')).toBeInTheDocument();
});
it('supports all expected languages', () => {
const languages = ['sql', 'json', 'htmlbars', 'markdown'] as const;
languages.forEach(language => {
const { unmount } = render(
<CodeSyntaxHighlighter language={language}>
{`Test content for ${language}`}
</CodeSyntaxHighlighter>,
);
// Should render the content (either in fallback or syntax highlighter)
expect(
screen.getByText(`Test content for ${language}`),
).toBeInTheDocument();
unmount();
});
});
it('renders fallback pre element initially', () => {
render(
<CodeSyntaxHighlighter language="sql">
SELECT COUNT(*) FROM table;
</CodeSyntaxHighlighter>,
);
// Should render the content in some form
expect(screen.getByText('SELECT COUNT(*) FROM table;')).toBeInTheDocument();
});
it('handles special characters', () => {
const specialContent = "SELECT * FROM `users` WHERE name = 'O\\'Brien';";
render(
<CodeSyntaxHighlighter language="sql">
{specialContent}
</CodeSyntaxHighlighter>,
);
expect(screen.getByText(specialContent)).toBeInTheDocument();
});
it('accepts custom styles', () => {
render(
<CodeSyntaxHighlighter language="sql" customStyle={{ fontSize: '16px' }}>
SELECT * FROM users;
</CodeSyntaxHighlighter>,
);
expect(screen.getByText('SELECT * FROM users;')).toBeInTheDocument();
});
it('accepts showLineNumbers prop', () => {
render(
<CodeSyntaxHighlighter language="sql" showLineNumbers>
SELECT * FROM users;
</CodeSyntaxHighlighter>,
);
expect(screen.getByText('SELECT * FROM users;')).toBeInTheDocument();
});
it('accepts wrapLines prop', () => {
render(
<CodeSyntaxHighlighter language="sql" wrapLines={false}>
SELECT * FROM users;
</CodeSyntaxHighlighter>,
);
expect(screen.getByText('SELECT * FROM users;')).toBeInTheDocument();
});
});

View File

@@ -1,149 +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 { useEffect, 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 { themeObject } from '@superset-ui/core';
export type SupportedLanguage = 'sql' | 'htmlbars' | 'markdown' | 'json';
export interface CodeSyntaxHighlighterProps {
children: string;
language?: SupportedLanguage;
customStyle?: React.CSSProperties;
showLineNumbers?: boolean;
wrapLines?: boolean;
style?: any; // Override theme style if needed
}
// Track which languages have been registered to avoid duplicate registrations
const registeredLanguages = new Set<SupportedLanguage>();
// Language import functions - these will be called lazily
const languageImporters = {
sql: () => import('react-syntax-highlighter/dist/cjs/languages/hljs/sql'),
htmlbars: () =>
import('react-syntax-highlighter/dist/cjs/languages/hljs/htmlbars'),
markdown: () =>
import('react-syntax-highlighter/dist/cjs/languages/hljs/markdown'),
json: () => import('react-syntax-highlighter/dist/cjs/languages/hljs/json'),
};
/**
* Lazily register a language for syntax highlighting
*/
const registerLanguage = async (language: SupportedLanguage): Promise<void> => {
if (registeredLanguages.has(language)) {
return; // Already registered
}
try {
const languageModule = await languageImporters[language]();
SyntaxHighlighterBase.registerLanguage(language, languageModule.default);
registeredLanguages.add(language);
} catch (error) {
console.warn(`Failed to load language ${language}:`, error);
}
};
/**
* A themed syntax highlighter component that automatically adapts to Superset's current theme.
* Supports light/dark mode switching and provides consistent styling across the application.
* Languages are loaded lazily to improve initial page load performance.
* Uses ultra-neutral themes for professional, consistent appearance.
*/
export const CodeSyntaxHighlighter: React.FC<CodeSyntaxHighlighterProps> = ({
children,
language = 'sql',
customStyle = {},
showLineNumbers = false,
wrapLines = true,
style: overrideStyle,
}) => {
const [isLanguageReady, setIsLanguageReady] = useState(
registeredLanguages.has(language),
);
useEffect(() => {
const loadLanguage = async () => {
if (!registeredLanguages.has(language)) {
await registerLanguage(language);
setIsLanguageReady(true);
}
};
loadLanguage();
}, [language]);
const isDark = themeObject.isThemeDark();
const themeStyle = overrideStyle || (isDark ? tomorrow : github);
const defaultCustomStyle: React.CSSProperties = {
background: themeObject.theme.colorBgElevated,
padding: themeObject.theme.sizeUnit * 4,
border: 0,
borderRadius: themeObject.theme.borderRadius,
...customStyle,
};
// Show a simple pre-formatted text while language is loading
if (!isLanguageReady) {
return (
<pre
style={{
...defaultCustomStyle,
fontFamily: 'monospace',
whiteSpace: 'pre-wrap',
margin: 0,
}}
>
{children}
</pre>
);
}
return (
<SyntaxHighlighterBase
language={language}
style={themeStyle}
customStyle={defaultCustomStyle}
showLineNumbers={showLineNumbers}
wrapLines={wrapLines}
>
{children}
</SyntaxHighlighterBase>
);
};
/**
* Utility function to preload specific languages if needed
* This can be called strategically in components that know they'll need certain languages
*/
export const preloadLanguages = async (
languages: SupportedLanguage[],
): Promise<void> => {
const promises = languages
.filter(lang => !registeredLanguages.has(lang))
.map(registerLanguage);
await Promise.all(promises);
};
export default CodeSyntaxHighlighter;

View File

@@ -38,7 +38,7 @@ const StyledCollapse = styled((props: CollapseProps) => (
${({ expandIconPosition }) =>
expandIconPosition &&
expandIconPosition === 'end' &&
expandIconPosition === 'right' &&
`
.anticon.anticon-right.ant-collapse-arrow > svg {
transform: rotate(90deg) !important;
@@ -72,7 +72,7 @@ const StyledCollapse = styled((props: CollapseProps) => (
.ant-collapse-header {
${({ expandIconPosition }) =>
expandIconPosition &&
expandIconPosition === 'end' &&
expandIconPosition === 'right' &&
`
.anticon.anticon-right.ant-collapse-arrow > svg {
transform: rotate(-90deg) !important;

View File

@@ -62,12 +62,12 @@ test('Calling "onHide"', async () => {
expect(props.onConfirm).toHaveBeenCalledTimes(0);
// type "del" in the input
userEvent.type(screen.getByTestId('delete-modal-input'), 'del');
await userEvent.type(screen.getByTestId('delete-modal-input'), 'del');
expect(screen.getByTestId('delete-modal-input')).toHaveValue('del');
// close the modal
expect(screen.getByTestId('close-modal-btn')).toBeInTheDocument();
userEvent.click(screen.getByTestId('close-modal-btn'));
expect(screen.getByText('×')).toBeInTheDocument();
await userEvent.click(screen.getByText('×'));
expect(props.onHide).toHaveBeenCalledTimes(1);
expect(props.onConfirm).toHaveBeenCalledTimes(0);

View File

@@ -89,7 +89,7 @@ export const MenuDotsDropdown = ({
iconOrientation = IconOrientation.Vertical,
...rest
}: MenuDotsDropdownProps) => (
<AntdDropdown popupRender={() => overlay} {...rest}>
<AntdDropdown dropdownRender={() => overlay} {...rest}>
<MenuDotsWrapper data-test="dropdown-trigger">
{RenderIcon(iconOrientation)}
</MenuDotsWrapper>

View File

@@ -23,7 +23,7 @@ import { Tooltip } from '../Tooltip';
import type { DropdownButtonProps } from './types';
export const DropdownButton = ({
popupRender,
dropdownRender,
tooltip,
tooltipPlacement,
children,
@@ -51,7 +51,7 @@ export const DropdownButton = ({
`;
const button = (
<Dropdown.Button
popupRender={popupRender}
dropdownRender={dropdownRender}
{...rest}
css={[
defaultBtnCss,

View File

@@ -17,10 +17,8 @@
* under the License.
*/
import {
CSSProperties,
cloneElement,
forwardRef,
ReactElement,
RefObject,
useEffect,
useImperativeHandle,
@@ -28,85 +26,17 @@ import {
useMemo,
useState,
useRef,
ReactNode,
useCallback,
} from 'react';
import { Global } from '@emotion/react';
import { css, t, useTheme, usePrevious } from '@superset-ui/core';
import { useResizeDetector } from 'react-resize-detector';
import { Badge, Icons, Button, Tooltip, Popover } from '..';
/**
* Container item.
*/
export interface DropdownItem {
/**
* String that uniquely identifies the item.
*/
id: string;
/**
* The element to be rendered.
*/
element: ReactElement;
}
/**
* Horizontal container that displays overflowed items in a dropdown.
* It shows an indicator of how many items are currently overflowing.
*/
export interface DropdownContainerProps {
/**
* Array of items. The id property is used to uniquely identify
* the elements when rendering or dealing with event handlers.
*/
items: DropdownItem[];
/**
* Event handler called every time an element moves between
* main container and dropdown.
*/
onOverflowingStateChange?: (overflowingState: {
notOverflowed: string[];
overflowed: string[];
}) => void;
/**
* Option to customize the content of the dropdown.
*/
dropdownContent?: (overflowedItems: DropdownItem[]) => ReactElement;
/**
* Dropdown ref.
*/
dropdownRef?: RefObject<HTMLDivElement>;
/**
* Dropdown additional style properties.
*/
dropdownStyle?: CSSProperties;
/**
* Displayed count in the dropdown trigger.
*/
dropdownTriggerCount?: number;
/**
* Icon of the dropdown trigger.
*/
dropdownTriggerIcon?: ReactElement;
/**
* Text of the dropdown trigger.
*/
dropdownTriggerText?: string;
/**
* Text of the dropdown trigger tooltip
*/
dropdownTriggerTooltip?: ReactNode | null;
/**
* Main container additional style properties.
*/
style?: CSSProperties;
/**
* Force render popover content before it's first opened
*/
forceRender?: boolean;
}
export type DropdownRef = HTMLDivElement & { open: () => void };
import type {
DropdownContainerProps,
DropdownItem,
DropdownRef,
} from './types';
const MAX_HEIGHT = 500;
@@ -143,37 +73,6 @@ export const DropdownContainer = forwardRef(
const [showOverflow, setShowOverflow] = useState(false);
// callback to update item widths so that the useLayoutEffect runs whenever
// width of any of the child changes
const recalculateItemWidths = useCallback(() => {
const mainItemsContainerNode = current?.children.item(0);
if (mainItemsContainerNode) {
const visibleChildrenElements = Array.from(
mainItemsContainerNode.children,
);
setItemsWidth(prevGlobalWidths => {
if (prevGlobalWidths.length !== items.length) {
return prevGlobalWidths;
}
const newGlobalWidths = [...prevGlobalWidths];
let changed = false;
visibleChildrenElements.forEach((child, indexInVisible) => {
const originalItemIndex = indexInVisible;
if (originalItemIndex < newGlobalWidths.length) {
const newWidth = child.getBoundingClientRect().width;
if (newGlobalWidths[originalItemIndex] !== newWidth) {
newGlobalWidths[originalItemIndex] = newWidth;
changed = true;
}
}
});
return changed ? newGlobalWidths : prevGlobalWidths;
});
}
}, [current?.children, items.length]);
const reduceItems = (items: DropdownItem[]): [DropdownItem[], string[]] =>
items.reduce(
([items, ids], item) => {
@@ -223,7 +122,24 @@ export const DropdownContainer = forwardRef(
childrenArray.map(child => resizeObserver.unobserve(child));
resizeObserver.disconnect();
};
}, [items.length, current, recalculateItemWidths]);
}, [items.length]);
// callback to update item widths so that the useLayoutEffect runs whenever
// width of any of the child changes
const recalculateItemWidths = () => {
const container = current?.children.item(0);
if (container) {
const { children } = container;
const childrenArray = Array.from(children);
const currentWidths = childrenArray.map(
child => child.getBoundingClientRect().width,
);
// Update state with new widths
setItemsWidth(currentWidths);
}
};
useLayoutEffect(() => {
if (popoverVisible) {
@@ -290,7 +206,6 @@ export const DropdownContainer = forwardRef(
overflowedItems.length,
previousWidth,
width,
popoverVisible,
]);
useEffect(() => {
@@ -461,3 +376,5 @@ export const DropdownContainer = forwardRef(
);
},
);
export type { DropdownItem, DropdownRef };

View File

@@ -64,7 +64,7 @@ export const FaveStar = ({
<Icons.StarFilled
aria-label="starred"
iconSize="l"
iconColor={theme.colorWarning}
iconColor={theme.colors.warning.base}
name="favorite-selected"
/>
) : (

View File

@@ -25,7 +25,7 @@ import { BaseIconComponent } from './BaseIcon';
const AsyncIcon = (props: IconType) => {
const [, setLoaded] = useState(false);
const ImportedSVG = useRef<FC<SVGProps<SVGSVGElement>>>();
const { fileName, ...restProps } = props;
const { fileName } = props;
useEffect(() => {
let cancelled = false;
@@ -46,7 +46,7 @@ const AsyncIcon = (props: IconType) => {
return (
<BaseIconComponent
component={ImportedSVG.current || TransparentIcon}
{...restProps}
{...props}
/>
);
};

View File

@@ -43,12 +43,11 @@ export const BaseIconComponent: React.FC<
iconSize,
viewBox,
customIcons,
fileName,
...rest
}) => {
const theme = useTheme();
const whatRole = rest?.onClick ? 'button' : 'img';
const ariaLabel = genAriaLabel(fileName || '');
const ariaLabel = genAriaLabel(rest.fileName || '');
const style = {
color: iconColor,
fontSize: iconSize

View File

@@ -33,6 +33,7 @@ export function Label(props: LabelProps) {
onClick,
children,
icon,
id,
...rest
} = props;

View File

@@ -37,7 +37,7 @@ export const DatasetTypeLabel: React.FC<DatasetTypeLabelProps> = ({
datasetType === 'physical' ? (
<Icons.InsertRowAboveOutlined
iconSize={SIZE}
iconColor={theme.colorPrimary}
iconColor={theme.colors.primary.dark1}
/>
) : (
<Icons.ConsoleSqlOutlined iconSize={SIZE} />

View File

@@ -18,7 +18,7 @@
*/
import { isValidElement, cloneElement, useMemo, useRef, useState } from 'react';
import { isNil } from 'lodash';
import { css, styled, t, useTheme } from '@superset-ui/core';
import { css, styled, t } from '@superset-ui/core';
import { Modal as AntdModal, ModalProps as AntdModalProps } from 'antd';
import { Resizable } from 're-resizable';
import Draggable, {
@@ -26,7 +26,6 @@ import Draggable, {
DraggableData,
DraggableEvent,
} from 'react-draggable';
import { Icons } from '../Icons';
import { Button } from '../Button';
import type { ModalProps, StyledModalProps } from './types';
@@ -46,16 +45,8 @@ export const BaseModal = (props: AntdModalProps) => (
);
export const StyledModal = styled(BaseModal)<StyledModalProps>`
${({
theme,
responsive,
maxWidth,
resizable,
height,
draggable,
hideFooter,
}) => css`
${responsive &&
${({ theme, responsive, maxWidth }) =>
responsive &&
css`
max-width: ${maxWidth ?? '900px'};
padding-left: ${theme.sizeUnit * 3}px;
@@ -64,120 +55,120 @@ export const StyledModal = styled(BaseModal)<StyledModalProps>`
top: 0;
`}
.ant-modal-content {
background-color: ${theme.colorBgContainer};
display: flex;
flex-direction: column;
max-height: calc(100vh - ${theme.sizeUnit * 8}px);
margin-bottom: ${theme.sizeUnit * 4}px;
margin-top: ${theme.sizeUnit * 4}px;
padding: 0;
}
.ant-modal-header {
flex: 0 0 auto;
border-radius: ${theme.borderRadius}px ${theme.borderRadius}px 0 0;
padding: ${theme.sizeUnit * 4}px ${theme.sizeUnit * 6}px;
.ant-modal-title {
font-weight: ${theme.fontWeightStrong};
}
.ant-modal-title h4 {
display: flex;
margin: 0;
align-items: center;
}
}
.ant-modal-close {
width: ${theme.sizeUnit * 14}px;
height: ${theme.sizeUnit * 14}px;
padding: ${theme.sizeUnit * 6}px ${theme.sizeUnit * 4}px
${theme.sizeUnit * 4}px;
top: 0;
right: 0;
display: flex;
justify-content: center;
}
.ant-modal-close:hover {
background: transparent;
}
.ant-modal-close-x {
.ant-modal-content {
background-color: ${({ theme }) => theme.colorBgContainer};
display: flex;
flex-direction: column;
max-height: ${({ theme }) => `calc(100vh - ${theme.sizeUnit * 8}px)`};
margin-bottom: ${({ theme }) => theme.sizeUnit * 4}px;
margin-top: ${({ theme }) => theme.sizeUnit * 4}px;
padding: 0;
}
.ant-modal-header {
flex: 0 0 auto;
border-radius: ${({ theme }) => theme.borderRadius}px
${({ theme }) => theme.borderRadius}px 0 0;
padding: ${({ theme }) => theme.sizeUnit * 4}px
${({ theme }) => theme.sizeUnit * 6}px;
.ant-modal-title {
font-weight: ${({ theme }) => theme.fontWeightStrong};
}
.ant-modal-title h4 {
display: flex;
margin: 0;
align-items: center;
[data-test='close-modal-btn'] {
justify-content: center;
}
.close {
flex: 1 1 auto;
margin-bottom: ${theme.sizeUnit}px;
color: ${theme.colorPrimaryText};
font-weight: ${theme.fontWeightLight};
}
}
}
.ant-modal-close {
width: ${({ theme }) => theme.sizeUnit * 14}px;
height: ${({ theme }) => theme.sizeUnit * 14}px;
top: 0;
right: 0;
}
.ant-modal-close:hover {
background: transparent;
}
.ant-modal-close-x {
display: flex;
align-items: center;
.close {
flex: 1 1 auto;
margin-bottom: ${({ theme }) => theme.sizeUnit}px;
color: ${({ theme }) => theme.colorPrimaryText};
font-size: 32px;
font-weight: ${({ theme }) => theme.fontWeightLight};
}
}
.ant-modal-body {
flex: 0 1 auto;
padding: ${({ theme }) => theme.sizeUnit * 4}px;
overflow: auto;
${({ resizable, height }) => !resizable && height && `height: ${height};`}
}
.ant-modal-footer {
flex: 0 0 1;
border-top: ${({ theme }) => theme.sizeUnit / 4}px solid
${({ theme }) => theme.colorSplit};
padding: ${({ theme }) => theme.sizeUnit * 4}px;
margin-top: 0;
.btn {
font-size: 12px;
}
.ant-modal-body {
flex: 0 1 auto;
padding: ${theme.sizeUnit * 4}px;
overflow: auto;
${!resizable && height && `height: ${height};`}
.btn + .btn {
margin-left: ${({ theme }) => theme.sizeUnit * 2}px;
}
}
.ant-modal-footer {
flex: 0 0 1;
border-top: ${theme.sizeUnit / 4}px solid ${theme.colorSplit};
padding: ${theme.sizeUnit * 4}px;
margin-top: 0;
&.no-content-padding .ant-modal-body {
padding: 0;
}
.btn {
font-size: 12px;
}
.btn + .btn {
margin-left: ${theme.sizeUnit * 2}px;
}
}
&.no-content-padding .ant-modal-body {
${({ draggable, theme }) =>
draggable &&
`
.ant-modal-header {
padding: 0;
}
${draggable &&
css`
.ant-modal-header {
padding: 0;
.draggable-trigger {
.draggable-trigger {
cursor: move;
padding: ${theme.sizeUnit * 4}px;
width: 100%;
}
}
`};
${({ resizable, hideFooter }) =>
resizable &&
`
.resizable {
pointer-events: all;
.resizable-wrapper {
height: 100%;
}
`}
${resizable &&
css`
.resizable {
pointer-events: all;
.ant-modal-content {
height: 100%;
.resizable-wrapper {
height: 100%;
}
.ant-modal-content {
height: 100%;
.ant-modal-body {
height: ${hideFooter
? `calc(100% - ${MODAL_HEADER_HEIGHT}px)`
: `calc(100% - ${MODAL_HEADER_HEIGHT}px - ${MODAL_FOOTER_HEIGHT}px)`};
.ant-modal-body {
/* 100% - header height - footer height */
height: ${
hideFooter
? `calc(100% - ${MODAL_HEADER_HEIGHT}px);`
: `calc(100% - ${MODAL_HEADER_HEIGHT}px - ${MODAL_FOOTER_HEIGHT}px);`
}
}
}
`}
}
`}
`;
@@ -223,14 +214,13 @@ const CustomModal = ({
resizable = false,
resizableConfig = defaultResizableConfig(hideFooter),
draggableConfig,
destroyOnHidden,
destroyOnClose,
openerRef,
...rest
}: ModalProps) => {
const draggableRef = useRef<HTMLDivElement>(null);
const [bounds, setBounds] = useState<DraggableBounds>();
const [dragDisabled, setDragDisabled] = useState<boolean>(true);
const theme = useTheme();
const handleOnHide = () => {
openerRef?.current?.focus();
@@ -238,16 +228,13 @@ const CustomModal = ({
};
let FooterComponent;
// This safely avoids injecting "closeModal" into native elements like <div> or <span>
if (isValidElement(footer) && typeof footer.type === 'function')
if (isValidElement(footer)) {
// If a footer component is provided inject a closeModal function
// so the footer can provide a "close" button if desired
FooterComponent = cloneElement(footer, {
closeModal: handleOnHide,
} as Partial<unknown>);
else FooterComponent = footer;
}
const modalFooter = isNil(FooterComponent)
? [
<Button
@@ -322,13 +309,9 @@ const CustomModal = ({
open={show}
title={<ModalTitle />}
closeIcon={
<Icons.CloseOutlined
iconColor={theme.colorText}
iconSize="l"
data-test="close-modal-btn"
className="close"
aria-hidden="true"
/>
<span className="close" aria-hidden="true">
×
</span>
}
footer={!hideFooter ? modalFooter : null}
hideFooter={hideFooter}
@@ -358,7 +341,7 @@ const CustomModal = ({
mask={shouldShowMask}
draggable={draggable}
resizable={resizable}
destroyOnHidden={destroyOnHidden}
destroyOnClose={destroyOnClose}
{...rest}
>
{children}

View File

@@ -34,7 +34,7 @@ export interface ModalProps {
show: boolean;
name?: string;
title: ReactNode;
width?: string | number;
width?: string;
maxWidth?: string;
responsive?: boolean;
hideFooter?: boolean;
@@ -47,7 +47,7 @@ export interface ModalProps {
resizableConfig?: ResizableProps;
draggable?: boolean;
draggableConfig?: DraggableProps;
destroyOnHidden?: boolean;
destroyOnClose?: boolean;
maskClosable?: boolean;
zIndex?: number;
bodyStyle?: CSSProperties;

View File

@@ -39,7 +39,7 @@ export interface ModalTriggerProps {
resizableConfig?: any;
draggable?: boolean;
draggableConfig?: any;
destroyOnHidden?: boolean;
destroyOnClose?: boolean;
}
export interface ModalTriggerRef {
@@ -63,7 +63,7 @@ export const ModalTrigger = forwardRef(
tooltip,
modalFooter,
triggerNode,
destroyOnHidden = true,
destroyOnClose = true,
modalBody,
draggableConfig = {},
resizableConfig = {},
@@ -120,7 +120,7 @@ export const ModalTrigger = forwardRef(
resizableConfig={resizableConfig}
draggable={draggable}
draggableConfig={draggableConfig}
destroyOnHidden={destroyOnHidden}
destroyOnClose={destroyOnClose}
>
{modalBody}
</Modal>

View File

@@ -34,7 +34,7 @@ export const menuTriggerStyles = (theme: SupersetTheme) => css`
width: ${theme.sizeUnit * 8}px;
height: ${theme.sizeUnit * 8}px;
padding: 0;
border: 1px solid ${theme.colorPrimary};
border: 1px solid ${theme.colors.primary.dark2};
&.ant-btn > span.anticon {
line-height: 0;
@@ -151,7 +151,7 @@ export const PageHeaderWithActions = ({
{showMenuDropdown && (
<Dropdown
trigger={['click']}
popupRender={() => additionalActionsMenu}
dropdownRender={() => additionalActionsMenu}
{...menuDropdownProps}
>
<Button
@@ -163,7 +163,7 @@ export const PageHeaderWithActions = ({
data-test="actions-trigger"
>
<Icons.EllipsisOutlined
iconColor={theme.colorPrimary}
iconColor={theme.colors.primary.dark2}
iconSize="l"
/>
</Button>

View File

@@ -45,7 +45,7 @@ interface HandleSelectProps {
}
const menuItemStyles = (theme: any) => css`
&.ant-menu-item {
&.antd5-menu-item {
height: auto;
line-height: 1.4;

View File

@@ -17,7 +17,7 @@
* under the License.
*/
import {
Radio as AntRadio,
Radio as Antd5Radio,
type CheckboxOptionType,
type RadioGroupProps,
} from 'antd';
@@ -40,19 +40,19 @@ const RadioGroup = ({
...props
}: RadioGroupWrapperProps) => {
const content = options.map((option: CheckboxOptionType) => (
<AntRadio key={option.value} value={option.value}>
<Antd5Radio key={option.value} value={option.value}>
{option.label}
</AntRadio>
</Antd5Radio>
));
return (
<AntRadio.Group {...props}>
<Antd5Radio.Group {...props}>
{spaceConfig ? <Space {...spaceConfig}>{content}</Space> : content}
</AntRadio.Group>
</Antd5Radio.Group>
);
};
export const Radio = Object.assign(AntRadio, {
export const Radio = Object.assign(Antd5Radio, {
GroupWrapper: RadioGroup,
Button: AntRadio.Button,
Button: Antd5Radio.Button,
});
export type {
RadioChangeEvent,

View File

@@ -129,7 +129,7 @@ const AsyncSelect = forwardRef(
onError,
onChange,
onClear,
onOpenChange,
onDropdownVisibleChange,
onDeselect,
onSearch,
onSelect,
@@ -441,12 +441,12 @@ const AsyncSelect = forwardRef(
}
}
if (onOpenChange) {
onOpenChange(isDropdownVisible);
if (onDropdownVisibleChange) {
onDropdownVisibleChange(isDropdownVisible);
}
};
const popupRender = (
const dropdownRender = (
originNode: ReactElement & { ref?: RefObject<HTMLElement> },
) =>
dropDownRenderHelper(
@@ -605,7 +605,7 @@ const AsyncSelect = forwardRef(
}
data-test={ariaLabel || name}
autoClearSearchValue={autoClearSearchValue}
popupRender={popupRender}
dropdownRender={dropdownRender}
filterOption={handleFilterOption}
filterSort={sortComparatorWithSearch}
getPopupContainer={
@@ -618,7 +618,7 @@ const AsyncSelect = forwardRef(
notFoundContent={isLoading ? t('Loading...') : notFoundContent}
onBlur={handleOnBlur}
onDeselect={handleOnDeselect}
onOpenChange={handleOnDropdownVisibleChange}
onDropdownVisibleChange={handleOnDropdownVisibleChange}
// @ts-ignore
onPaste={onPaste}
onPopupScroll={handlePagination}

View File

@@ -17,7 +17,6 @@
* under the License.
*/
import { StoryObj } from '@storybook/react';
import { noop } from 'lodash';
import { SelectOptionsType, SelectProps } from './types';
import { Select } from '.';
@@ -94,26 +93,23 @@ export const InteractiveSelect: StoryObj = {
options,
optionsCount,
...args
}: SelectProps & { header: string; optionsCount: number }) => {
noop(header);
return (
<div
style={{
width: DEFAULT_WIDTH,
}}
>
<Select
{...args}
options={
Array.isArray(options)
? generateOptions(options, optionsCount)
: options
}
mode="multiple"
/>
</div>
);
},
}: SelectProps & { header: string; optionsCount: number }) => (
<div
style={{
width: DEFAULT_WIDTH,
}}
>
<Select
{...args}
options={
Array.isArray(options)
? generateOptions(options, optionsCount)
: options
}
mode="multiple"
/>
</div>
),
args: {
autoFocus: true,
allowNewOptions: false,

View File

@@ -104,7 +104,7 @@ const Select = forwardRef(
onBlur,
onChange,
onClear,
onOpenChange,
onDropdownVisibleChange,
onDeselect,
onSearch,
onSelect,
@@ -398,8 +398,8 @@ const Select = forwardRef(
if (!isDropdownVisible) {
setSelectOptions(initialOptionsSorted);
}
if (onOpenChange) {
onOpenChange(isDropdownVisible);
if (onDropdownVisibleChange) {
onDropdownVisibleChange(isDropdownVisible);
}
};
@@ -492,7 +492,7 @@ const Select = forwardRef(
],
);
const popupRender = (
const dropdownRender = (
originNode: ReactElement & { ref?: RefObject<HTMLElement> },
) =>
dropDownRenderHelper(
@@ -694,7 +694,7 @@ const Select = forwardRef(
}
data-test={ariaLabel || name}
autoClearSearchValue={autoClearSearchValue}
popupRender={popupRender}
dropdownRender={dropdownRender}
filterOption={handleFilterOption}
filterSort={sortComparatorWithSearch}
getPopupContainer={
@@ -708,7 +708,7 @@ const Select = forwardRef(
notFoundContent={isLoading ? t('Loading...') : notFoundContent}
onBlur={handleOnBlur}
onDeselect={handleOnDeselect}
onOpenChange={handleOnDropdownVisibleChange}
onDropdownVisibleChange={handleOnDropdownVisibleChange}
// @ts-ignore
onPaste={onPaste}
onPopupScroll={undefined}

View File

@@ -45,7 +45,7 @@ export const StyledSelect = styled(Select, {
})<{ headerPosition?: string; oneLine?: boolean }>`
${({ theme, headerPosition, oneLine }) => `
.ant-select-item-option-active:not(.ant-select-item-option-disabled) {
outline: 2px solid ${theme.colorPrimary};
outline: 2px solid ${theme.colors.primary.base};
outline-offset: -2px;
}
flex: ${headerPosition === 'left' ? 1 : 0};

View File

@@ -62,7 +62,7 @@ export type AntdExposedProps = Pick<
| 'onBlur'
| 'onPopupScroll'
| 'onSearch'
| 'onOpenChange'
| 'onDropdownVisibleChange'
| 'optionRender'
| 'placeholder'
| 'showArrow'
@@ -95,7 +95,7 @@ export interface BaseSelectProps extends AntdExposedProps {
/**
* Renders the dropdown
*/
popupRender?: (
dropdownRender?: (
menu: ReactElement<any, string | JSXElementConstructor<any>>,
) => ReactElement<any, string | JSXElementConstructor<any>>;
/**

View File

@@ -19,28 +19,28 @@
import { Tooltip } from 'antd';
import { Dropdown, Icons } from '@superset-ui/core/components';
import { t } from '@superset-ui/core';
import { ThemeAlgorithm, ThemeMode } from '../../theme/types';
import { ThemeMode } from '../../theme/types';
export interface ThemeSelectProps {
setThemeMode: (newMode: ThemeMode) => void;
changeThemeMode: (newMode: ThemeMode) => void;
tooltipTitle?: string;
themeMode: ThemeMode;
}
const ThemeSelect: React.FC<ThemeSelectProps> = ({
setThemeMode,
changeThemeMode,
tooltipTitle = 'Select theme',
themeMode,
}) => {
const handleSelect = (mode: ThemeMode) => {
setThemeMode(mode);
changeThemeMode(mode);
};
const themeIconMap: Record<ThemeAlgorithm | ThemeMode, React.ReactNode> = {
[ThemeAlgorithm.DEFAULT]: <Icons.SunOutlined />,
[ThemeAlgorithm.DARK]: <Icons.MoonOutlined />,
const themeIconMap: Record<ThemeMode, React.ReactNode> = {
[ThemeMode.LIGHT]: <Icons.SunOutlined />,
[ThemeMode.DARK]: <Icons.MoonOutlined />,
[ThemeMode.SYSTEM]: <Icons.FormatPainterOutlined />,
[ThemeAlgorithm.COMPACT]: <Icons.CompressOutlined />,
[ThemeMode.COMPACT]: <Icons.CompressOutlined />,
};
return (
@@ -49,9 +49,9 @@ const ThemeSelect: React.FC<ThemeSelectProps> = ({
menu={{
items: [
{
key: ThemeMode.DEFAULT,
key: ThemeMode.LIGHT,
label: t('Light'),
onClick: () => handleSelect(ThemeMode.DEFAULT),
onClick: () => handleSelect(ThemeMode.LIGHT),
icon: <Icons.SunOutlined />,
},
{

View File

@@ -27,6 +27,8 @@ const DEFAULT_TIMEZONE = {
value: 'Africa/Abidjan', // timezones are deduped by the first alphabetical value
};
const MIN_SELECT_WIDTH = '400px';
const offsetsToName = {
'-300-240': ['Eastern Standard Time', 'Eastern Daylight Time'],
'-360-300': ['Central Standard Time', 'Central Daylight Time'],
@@ -46,11 +48,13 @@ const offsetsToName = {
export type TimezoneSelectorProps = {
onTimezoneChange: (value: string) => void;
timezone?: string | null;
minWidth?: string;
};
export default function TimezoneSelector({
onTimezoneChange,
timezone,
minWidth = MIN_SELECT_WIDTH, // smallest size for current values
...rest
}: TimezoneSelectorProps) {
const { TIMEZONE_OPTIONS, TIMEZONE_OPTIONS_SORT_COMPARATOR, validTimezone } =
@@ -152,7 +156,6 @@ export default function TimezoneSelector({
value={validTimezone}
options={TIMEZONE_OPTIONS}
sortComparator={TIMEZONE_OPTIONS_SORT_COMPARATOR}
style={{ minWidth }}
{...rest}
/>
);

View File

@@ -1,47 +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 { ReactElement } from 'react';
import { UnsavedChangesModal, type UnsavedChangesModalProps } from '.';
export default {
title: 'Components/UnsavedChangesModal',
component: UnsavedChangesModal,
};
export const InteractiveUnsavedChangesModal = (
props: UnsavedChangesModalProps,
): ReactElement => (
<UnsavedChangesModal {...props}>
If you don't save, changes will be lost.
</UnsavedChangesModal>
);
InteractiveUnsavedChangesModal.args = {
showModal: true,
onHide: () => {},
handleSave: () => {},
onConfirmNavigation: () => {},
title: 'Unsaved Changes',
};
InteractiveUnsavedChangesModal.argTypes = {
onHide: { action: 'onHide' },
handleSave: { action: 'handleSave' },
onConfirmNavigation: { action: 'onConfirmNavigation' },
};

View File

@@ -1,96 +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 { render, screen, userEvent } from '@superset-ui/core/spec';
import { UnsavedChangesModal } from '.';
test('should render nothing if showModal is false', () => {
const { queryByRole } = render(
<UnsavedChangesModal
showModal={false}
onHide={() => {}}
handleSave={() => {}}
onConfirmNavigation={() => {}}
/>,
);
expect(queryByRole('dialog')).not.toBeInTheDocument();
});
test('should render the UnsavedChangesModal component if showModal is true', async () => {
const { queryByRole } = render(
<UnsavedChangesModal
showModal
onHide={() => {}}
handleSave={() => {}}
onConfirmNavigation={() => {}}
/>,
);
expect(queryByRole('dialog')).toBeInTheDocument();
});
test('should only call onConfirmNavigation when clicking the Discard button', async () => {
const mockOnHide = jest.fn();
const mockHandleSave = jest.fn();
const mockOnConfirmNavigation = jest.fn();
render(
<UnsavedChangesModal
showModal
onHide={mockOnHide}
handleSave={mockHandleSave}
onConfirmNavigation={mockOnConfirmNavigation}
/>,
);
const discardButton: HTMLElement = await screen.findByRole('button', {
name: /discard/i,
});
userEvent.click(discardButton);
expect(mockOnConfirmNavigation).toHaveBeenCalled();
expect(mockHandleSave).not.toHaveBeenCalled();
expect(mockOnHide).not.toHaveBeenCalled();
});
test('should only call handleSave when clicking the Save button', async () => {
const mockOnHide = jest.fn();
const mockHandleSave = jest.fn();
const mockOnConfirmNavigation = jest.fn();
render(
<UnsavedChangesModal
showModal
onHide={mockOnHide}
handleSave={mockHandleSave}
onConfirmNavigation={mockOnConfirmNavigation}
/>,
);
const saveButton: HTMLElement = await screen.findByRole('button', {
name: /save/i,
});
userEvent.click(saveButton);
expect(mockHandleSave).toHaveBeenCalled();
expect(mockOnHide).not.toHaveBeenCalled();
expect(mockOnConfirmNavigation).not.toHaveBeenCalled();
});

View File

@@ -1,129 +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 { t, styled, css } from '@superset-ui/core';
import { Icons, Modal, Typography } from '@superset-ui/core/components';
import { Button } from '@superset-ui/core/components/Button';
import type { FC, ReactElement } from 'react';
const StyledModalTitle = styled(Typography.Title)`
&& {
font-weight: 600;
margin: 0;
}
`;
const StyledModalBody = styled(Typography.Text)`
${({ theme }) => css`
padding: 0 ${theme.sizeUnit * 2}px;
&& {
margin: 0;
}
`}
`;
const StyledDiscardBtn = styled(Button)`
${({ theme }) => css`
min-width: ${theme.sizeUnit * 22}px;
height: ${theme.sizeUnit * 8}px;
`}
`;
const StyledSaveBtn = styled(Button)`
${({ theme }) => css`
min-width: ${theme.sizeUnit * 17}px;
height: ${theme.sizeUnit * 8}px;
span > :first-of-type {
margin-right: 0;
}
`}
`;
const StyledWarningIcon = styled(Icons.WarningOutlined)`
${({ theme }) => css`
color: ${theme.colorWarning};
margin-right: ${theme.sizeUnit * 4}px;
`}
`;
export type UnsavedChangesModalProps = {
showModal: boolean;
onHide: () => void;
handleSave: () => void;
onConfirmNavigation: () => void;
title?: string;
body?: string;
};
export const UnsavedChangesModal: FC<UnsavedChangesModalProps> = ({
showModal,
onHide,
handleSave,
onConfirmNavigation,
title = 'Unsaved Changes',
body = "If you don't save, changes will be lost.",
}: UnsavedChangesModalProps): ReactElement => (
<Modal
centered
responsive
onHide={onHide}
show={showModal}
width="444px"
title={
<div
css={css`
align-items: center;
display: flex;
`}
>
<StyledWarningIcon iconSize="xl" />
<StyledModalTitle type="secondary" level={5}>
{title}
</StyledModalTitle>
</div>
}
footer={
<div
css={css`
display: flex;
justify-content: flex-end;
width: 100%;
`}
>
<StyledDiscardBtn
htmlType="button"
buttonSize="small"
onClick={onConfirmNavigation}
>
{t('Discard')}
</StyledDiscardBtn>
<StyledSaveBtn
htmlType="button"
buttonSize="small"
buttonStyle="primary"
onClick={handleSave}
>
{t('Save')}
</StyledSaveBtn>
</div>
}
>
<StyledModalBody type="secondary">{body}</StyledModalBody>
</Modal>
);

View File

@@ -163,6 +163,5 @@ export * from './Steps';
export * from './Table';
export * from './TableView';
export * from './Tag';
export * from './UnsavedChangesModal';
export * from './constants';
export * from './Result';

View File

@@ -21,8 +21,6 @@ import { ExtensibleFunction } from '../models';
import { getNumberFormatter, NumberFormats } from '../number-format';
import { Currency } from '../query';
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
interface CurrencyFormatterConfig {
d3Format?: string;
currency: Currency;

View File

@@ -40,7 +40,7 @@ export const buildCustomFormatters = (
const actualCurrencyFormat = currencyFormat?.symbol
? currencyFormat
: savedCurrencyFormats[metric];
return actualCurrencyFormat?.symbol
return actualCurrencyFormat
? {
...acc,
[metric]: new CurrencyFormatter({

View File

@@ -20,8 +20,6 @@ import { ExtensibleFunction } from '../models';
import { isRequired } from '../utils';
import { NumberFormatFunction } from './types';
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
export const PREVIEW_VALUE = 12345.432;
export interface NumberFormatterConfig {

View File

@@ -58,6 +58,17 @@ export const GlobalStyles = () => {
display: none !important;
}
.ant-dropdown,
.ant-dropdown,
.ant-select-dropdown,
.ant-modal-wrap,
.ant-modal-mask,
.ant-picker-dropdown,
.ant-popover,
.ant-popover {
z-index: ${theme.zIndexPopupBase} !important;
}
.no-wrap {
white-space: nowrap;
}

View File

@@ -18,7 +18,7 @@
*/
import { theme as antdThemeImport } from 'antd';
import { Theme } from './Theme';
import { AnyThemeConfig, ThemeAlgorithm } from './types';
import { AnyThemeConfig } from './types';
// Mock emotion's cache to avoid actual DOM operations
jest.mock('@emotion/cache', () => ({
@@ -44,7 +44,7 @@ describe('Theme', () => {
const parsedJson = JSON.parse(jsonString);
expect(parsedJson.token?.colorPrimary).toBe('#ff0000');
expect(parsedJson.algorithm).toBe(ThemeAlgorithm.DARK);
expect(parsedJson.algorithm).toBe('dark');
});
});
@@ -91,7 +91,7 @@ describe('Theme', () => {
// Verify dark mode by using the serialized config from the public method
const serialized = theme.toSerializedConfig();
expect(serialized.algorithm).toBe(ThemeAlgorithm.DARK);
expect(serialized.algorithm).toBe('dark');
});
});
@@ -137,7 +137,7 @@ describe('Theme', () => {
// Verify the algorithm was updated
const serialized = theme.toSerializedConfig();
expect(serialized.algorithm).toBe(ThemeAlgorithm.DARK);
expect(serialized.algorithm).toBe('dark');
});
});
@@ -150,7 +150,7 @@ describe('Theme', () => {
// Verify dark algorithm is used
const serialized = theme.toSerializedConfig();
expect(serialized.algorithm).toBe(ThemeAlgorithm.DARK);
expect(serialized.algorithm).toBe('dark');
});
it('switches to default algorithm when toggling dark mode off', () => {
@@ -164,7 +164,7 @@ describe('Theme', () => {
// Verify default algorithm is used
const serialized = theme.toSerializedConfig();
expect(serialized.algorithm).toBe(ThemeAlgorithm.DEFAULT);
expect(serialized.algorithm).toBe('default');
});
it('preserves other algorithms when toggling dark mode', () => {
@@ -181,11 +181,10 @@ describe('Theme', () => {
// Verify default algorithm replaces dark but compact is preserved
const serialized = theme.toSerializedConfig();
expect(Array.isArray(serialized.algorithm)).toBe(true);
expect(serialized.algorithm).toContain(ThemeAlgorithm.DEFAULT);
expect(serialized.algorithm).toContain(ThemeAlgorithm.COMPACT);
expect(serialized.algorithm).not.toContain(ThemeAlgorithm.DARK);
expect(serialized.algorithm).toContain('default');
expect(serialized.algorithm).toContain('compact');
expect(serialized.algorithm).not.toContain('dark');
});
});
@@ -219,7 +218,7 @@ describe('Theme', () => {
const serialized = theme.toSerializedConfig();
expect(serialized.token?.colorPrimary).toBe('#ff0000');
expect(serialized.algorithm).toBe(ThemeAlgorithm.DARK);
expect(serialized.algorithm).toBe('dark');
});
});
});

View File

@@ -22,20 +22,12 @@ import React from 'react';
import { theme as antdThemeImport, ConfigProvider } from 'antd';
import tinycolor from 'tinycolor2';
// @fontsource/* v5.1+ doesn't play nice with eslint-import plugin v2.31+
/* eslint-disable import/extensions */
import '@fontsource/inter/200.css';
/* eslint-disable import/extensions */
import '@fontsource/inter/400.css';
/* eslint-disable import/extensions */
import '@fontsource/inter/500.css';
/* eslint-disable import/extensions */
import '@fontsource/inter/600.css';
/* eslint-disable import/extensions */
import '@fontsource/fira-code/400.css';
/* eslint-disable import/extensions */
import '@fontsource/fira-code/500.css';
/* eslint-disable import/extensions */
import '@fontsource/fira-code/600.css';
import {
@@ -43,7 +35,6 @@ import {
CacheProvider as EmotionCacheProvider,
} from '@emotion/react';
import createCache from '@emotion/cache';
import { noop } from 'lodash';
import { GlobalStyles } from './GlobalStyles';
import {
@@ -89,6 +80,7 @@ export class Theme {
// Forcing some default tokens
fontFamily: `'Inter', Helvetica, Arial`,
fontFamilyCode: `'Fira Code', 'Courier New', monospace`,
fontFeatureSettings: '"tnum" 1',
// Extra tokens
transitionTiming: 0.3,
@@ -294,7 +286,6 @@ export class Theme {
antdConfig: AntdThemeConfig,
emotionCache: any,
): void {
noop(theme, antdConfig, emotionCache);
// Overridden at runtime by SupersetThemeProvider using setThemeState
}

View File

@@ -17,7 +17,7 @@
* under the License.
*/
/* eslint-disable theme-colors/no-literal-colors */
import { type SerializableThemeConfig, ThemeAlgorithm } from './types';
import { SerializableThemeConfig } from './types';
const exampleThemes: Record<string, SerializableThemeConfig> = {
superset: {
@@ -27,11 +27,11 @@ const exampleThemes: Record<string, SerializableThemeConfig> = {
},
supersetDark: {
token: {},
algorithm: ThemeAlgorithm.DARK,
algorithm: 'dark',
},
supersetCompact: {
token: {},
algorithm: ThemeAlgorithm.COMPACT,
algorithm: 'compact',
},
funky: {
token: {
@@ -43,7 +43,7 @@ const exampleThemes: Record<string, SerializableThemeConfig> = {
borderRadius: 12,
fontFamily: 'Comic Sans MS, cursive',
},
algorithm: ThemeAlgorithm.DEFAULT,
algorithm: 'default',
},
funkyDark: {
token: {
@@ -55,7 +55,7 @@ const exampleThemes: Record<string, SerializableThemeConfig> = {
borderRadius: 12,
fontFamily: 'Comic Sans MS, cursive',
},
algorithm: ThemeAlgorithm.DARK,
algorithm: 'dark',
},
};
export default exampleThemes;

View File

@@ -16,17 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/
import emotionStyled, { CreateStyled } from '@emotion/styled';
import emotionStyled from '@emotion/styled';
import { useTheme as useThemeBasic } from '@emotion/react';
// import { theme as antdThemeImport } from 'antd';
import { Theme } from './Theme';
import {
type SupersetTheme,
type SerializableThemeConfig,
type AnyThemeConfig,
type ThemeStorage,
type ThemeControllerOptions,
type ThemeContextType,
ThemeAlgorithm,
import type {
SupersetTheme,
SerializableThemeConfig,
AnyThemeConfig,
ThemeStorage,
ThemeControllerOptions,
ThemeContextType,
} from './types';
export {
@@ -56,12 +56,10 @@ export function useTheme() {
return theme;
}
const styled: CreateStyled = emotionStyled;
const styled = emotionStyled;
// launching in in dark mode for now while iterating
const themeObject: Theme = Theme.fromConfig({
algorithm: ThemeAlgorithm.DEFAULT,
});
const themeObject = Theme.fromConfig({ algorithm: 'default' });
const { theme } = themeObject;
const supersetTheme = theme;

View File

@@ -33,41 +33,6 @@ import { Theme } from '.';
export type AntdTokens = ReturnType<typeof antdThemeImport.getDesignToken>;
export type AntdThemeConfig = ThemeConfig;
/**
* Theme algorithms supported by Antd.
* They can be used individually or in combination.
* - DEFAULT: Default light theme
* - DARK: Dark theme
* - COMPACT: Compact theme (smaller spacing)
*/
export enum ThemeAlgorithm {
DEFAULT = 'default',
DARK = 'dark',
COMPACT = 'compact',
}
/**
* Represents the current theme mode of the app.
* It can be one of the following:
* - DEFAULT: Light theme
* - DARK: Dark theme
* - SYSTEM: System theme (auto-detects based on system settings)
*/
export enum ThemeMode {
DEFAULT = 'default',
DARK = 'dark',
SYSTEM = 'system',
}
/**
* All valid algorithm values that can be used in theme config.
*/
export type ThemeAlgorithmOption =
| ThemeAlgorithm.DEFAULT
| ThemeAlgorithm.DARK
| ThemeAlgorithm.COMPACT
| ThemeAlgorithm[];
/**
* A serializable version of Ant Design's ThemeConfig
* Compatible with theme editor exports
@@ -75,7 +40,11 @@ export type ThemeAlgorithmOption =
export type SerializableThemeConfig = {
token?: Record<string, any>;
components?: Record<string, any>;
algorithm?: ThemeAlgorithmOption;
algorithm?:
| 'default'
| 'dark'
| 'compact'
| ('default' | 'dark' | 'compact')[];
hashed?: boolean;
inherit?: boolean;
};
@@ -389,6 +358,13 @@ export type AllowedAntdTokenKeys = Extract<
keyof AntdTokens
>;
export enum ThemeMode {
LIGHT = 'light',
DARK = 'dark',
SYSTEM = 'system',
COMPACT = 'compact',
}
export type SharedAntdTokens = Pick<AntdTokens, AllowedAntdTokenKeys>;
/** The final shape for our custom theme object, combining old theme + shared antd + superset specifics. */
@@ -403,7 +379,7 @@ export interface ThemeStorage {
}
export interface ThemeControllerOptions {
themeObject?: Theme;
themeObject: Theme;
storage?: ThemeStorage;
storageKey?: string;
modeStorageKey?: string;
@@ -417,6 +393,6 @@ export interface ThemeContextType {
theme: Theme;
themeMode: ThemeMode;
setTheme: (config: AnyThemeConfig) => void;
setThemeMode: (newMode: ThemeMode) => void;
changeThemeMode: (newMode: ThemeMode) => void;
resetTheme: () => void;
}

View File

@@ -28,10 +28,9 @@ import {
genDeprecatedColorVariations,
} from './utils';
import {
type AnyThemeConfig,
type SerializableThemeConfig,
type AntdThemeConfig,
ThemeAlgorithm,
AnyThemeConfig,
SerializableThemeConfig,
AntdThemeConfig,
} from './types';
// Mock tinycolor2 for consistent testing
@@ -51,25 +50,22 @@ describe('Theme utilities', () => {
const config: AnyThemeConfig = {
token: { colorPrimary: '#ff0000' },
};
expect(isSerializableConfig(config)).toBe(true);
});
it('returns true when algorithm is a string', () => {
const config: AnyThemeConfig = {
token: { colorPrimary: '#ff0000' },
algorithm: ThemeAlgorithm.DARK,
algorithm: 'dark',
};
expect(isSerializableConfig(config)).toBe(true);
});
it('returns true when algorithm is an array of strings', () => {
const config: AnyThemeConfig = {
token: { colorPrimary: '#ff0000' },
algorithm: [ThemeAlgorithm.DARK, ThemeAlgorithm.COMPACT],
algorithm: ['dark', 'compact'],
};
expect(isSerializableConfig(config)).toBe(true);
});
@@ -78,19 +74,15 @@ describe('Theme utilities', () => {
token: { colorPrimary: '#ff0000' },
algorithm: antdThemeImport.darkAlgorithm,
};
expect(isSerializableConfig(config)).toBe(false);
});
it('returns false when algorithm is an array containing a function', () => {
const config: AnyThemeConfig = {
token: { colorPrimary: '#ff0000' },
algorithm: [
antdThemeImport.darkAlgorithm,
antdThemeImport.compactAlgorithm,
],
// @ts-ignore
algorithm: [antdThemeImport.darkAlgorithm, 'compact'],
};
expect(isSerializableConfig(config)).toBe(false);
});
});
@@ -99,22 +91,18 @@ describe('Theme utilities', () => {
it('converts string algorithm to function reference', () => {
const config: SerializableThemeConfig = {
token: { colorPrimary: '#ff0000' },
algorithm: ThemeAlgorithm.DARK,
algorithm: 'dark',
};
const result = deserializeThemeConfig(config);
expect(result.algorithm).toBe(antdThemeImport.darkAlgorithm);
});
it('converts array of string algorithms to function references', () => {
const config: SerializableThemeConfig = {
token: { colorPrimary: '#ff0000' },
algorithm: [ThemeAlgorithm.DARK, ThemeAlgorithm.COMPACT],
algorithm: ['dark', 'compact'],
};
const result = deserializeThemeConfig(config);
expect(Array.isArray(result.algorithm)).toBe(true);
expect(result.algorithm).toContain(antdThemeImport.darkAlgorithm);
expect(result.algorithm).toContain(antdThemeImport.compactAlgorithm);
@@ -123,12 +111,10 @@ describe('Theme utilities', () => {
it('preserves other configuration properties', () => {
const config: SerializableThemeConfig = {
token: { colorPrimary: '#ff0000' },
algorithm: ThemeAlgorithm.DARK,
algorithm: 'dark',
hashed: true,
};
const result = deserializeThemeConfig(config);
expect(result.token).toEqual({ colorPrimary: '#ff0000' });
expect(result.hashed).toBe(true);
});
@@ -137,31 +123,25 @@ describe('Theme utilities', () => {
const config: SerializableThemeConfig = {
token: { colorPrimary: '#ff0000' },
};
const result = deserializeThemeConfig(config);
expect(result.algorithm).toBe(antdThemeImport.defaultAlgorithm);
expect(result.algorithm).toBeUndefined();
});
it('converts default algorithm string to function reference', () => {
const config: SerializableThemeConfig = {
token: { colorPrimary: '#ff0000' },
algorithm: ThemeAlgorithm.DEFAULT,
algorithm: 'default',
};
const result = deserializeThemeConfig(config);
expect(result.algorithm).toBe(antdThemeImport.defaultAlgorithm);
});
it('converts compact algorithm string to function reference', () => {
const config: SerializableThemeConfig = {
token: { colorPrimary: '#ff0000' },
algorithm: ThemeAlgorithm.COMPACT,
algorithm: 'compact',
};
const result = deserializeThemeConfig(config);
expect(result.algorithm).toBe(antdThemeImport.compactAlgorithm);
});
});
@@ -172,10 +152,8 @@ describe('Theme utilities', () => {
token: { colorPrimary: '#ff0000' },
algorithm: antdThemeImport.darkAlgorithm,
};
const result = serializeThemeConfig(config);
expect(result.algorithm).toBe(ThemeAlgorithm.DARK);
expect(result.algorithm).toBe('dark');
});
it('converts array of function algorithms to strings', () => {
@@ -186,12 +164,10 @@ describe('Theme utilities', () => {
antdThemeImport.compactAlgorithm,
],
};
const result = serializeThemeConfig(config);
expect(Array.isArray(result.algorithm)).toBe(true);
expect(result.algorithm).toContain(ThemeAlgorithm.DARK);
expect(result.algorithm).toContain(ThemeAlgorithm.COMPACT);
expect(result.algorithm).toContain('dark');
expect(result.algorithm).toContain('compact');
});
it('preserves other configuration properties', () => {
@@ -200,9 +176,7 @@ describe('Theme utilities', () => {
algorithm: antdThemeImport.darkAlgorithm,
hashed: true,
};
const result = serializeThemeConfig(config);
expect(result.token).toEqual({ colorPrimary: '#ff0000' });
expect(result.hashed).toBe(true);
});
@@ -211,9 +185,7 @@ describe('Theme utilities', () => {
const config: AntdThemeConfig = {
token: { colorPrimary: '#ff0000' },
};
const result = serializeThemeConfig(config);
expect(result.algorithm).toBeUndefined();
});
@@ -224,10 +196,8 @@ describe('Theme utilities', () => {
// @ts-ignore
algorithm: unknownAlgorithm,
};
const result = serializeThemeConfig(config);
expect(result.algorithm).toBe(ThemeAlgorithm.DEFAULT);
expect(result.algorithm).toBe('default');
});
it('converts default algorithm function to string', () => {
@@ -235,10 +205,8 @@ describe('Theme utilities', () => {
token: { colorPrimary: '#ff0000' },
algorithm: antdThemeImport.defaultAlgorithm,
};
const result = serializeThemeConfig(config);
expect(result.algorithm).toBe(ThemeAlgorithm.DEFAULT);
expect(result.algorithm).toBe('default');
});
it('converts compact algorithm function to string', () => {
@@ -246,10 +214,8 @@ describe('Theme utilities', () => {
token: { colorPrimary: '#ff0000' },
algorithm: antdThemeImport.compactAlgorithm,
};
const result = serializeThemeConfig(config);
expect(result.algorithm).toBe(ThemeAlgorithm.COMPACT);
expect(result.algorithm).toBe('compact');
});
it('defaults each unknown algorithm in array to "default"', () => {
@@ -259,14 +225,9 @@ describe('Theme utilities', () => {
// @ts-ignore
algorithm: [antdThemeImport.darkAlgorithm, unknownAlgorithm],
};
const result = serializeThemeConfig(config);
expect(Array.isArray(result.algorithm)).toBe(true);
expect(result.algorithm).toEqual([
ThemeAlgorithm.DARK,
ThemeAlgorithm.DEFAULT,
]);
expect(result.algorithm).toEqual(['dark', 'default']);
});
it('handles mixed known and unknown algorithms in array', () => {
@@ -283,15 +244,13 @@ describe('Theme utilities', () => {
unknownAlgorithm2,
],
};
const result = serializeThemeConfig(config);
expect(Array.isArray(result.algorithm)).toBe(true);
expect(result.algorithm).toEqual([
ThemeAlgorithm.DARK,
ThemeAlgorithm.DEFAULT,
ThemeAlgorithm.COMPACT,
ThemeAlgorithm.DEFAULT,
'dark',
'default',
'compact',
'default',
]);
});
});
@@ -302,20 +261,16 @@ describe('Theme utilities', () => {
token: { colorPrimary: '#ff0000' },
algorithm: antdThemeImport.darkAlgorithm,
};
const result = normalizeThemeConfig(config);
expect(result).toBe(config);
});
it('deserializes serializable configs', () => {
const config: SerializableThemeConfig = {
token: { colorPrimary: '#ff0000' },
algorithm: ThemeAlgorithm.DARK,
algorithm: 'dark',
};
const result = normalizeThemeConfig(config);
expect(result.algorithm).toBe(antdThemeImport.darkAlgorithm);
});
});
@@ -323,18 +278,14 @@ describe('Theme utilities', () => {
describe('getAntdConfig', () => {
it('returns config with default algorithm for light mode', () => {
const seed = { colorPrimary: '#ff0000' };
const result = getAntdConfig(seed, false);
expect(result.token).toBe(seed);
expect(result.algorithm).toBe(antdThemeImport.defaultAlgorithm);
});
it('returns config with dark algorithm for dark mode', () => {
const seed = { colorPrimary: '#ff0000' };
const result = getAntdConfig(seed, true);
expect(result.token).toBe(seed);
expect(result.algorithm).toBe(antdThemeImport.darkAlgorithm);
});
@@ -350,9 +301,7 @@ describe('Theme utilities', () => {
colorInfo: '#info',
otherToken: 'ignore-me',
};
const result = getSystemColors(tokens);
expect(result).toEqual({
colorPrimary: '#primary',
colorError: '#error',
@@ -366,7 +315,6 @@ describe('Theme utilities', () => {
describe('genDeprecatedColorVariations', () => {
it('generates color variations for light mode', () => {
const result = genDeprecatedColorVariations('#base-color', false);
expect(result.base).toBe('#base-color');
expect(result.light1).toBe('#mixed-color');
expect(result.dark1).toBe('#mixed-color');
@@ -374,7 +322,6 @@ describe('Theme utilities', () => {
it('generates color variations for dark mode', () => {
const result = genDeprecatedColorVariations('#base-color', true);
expect(result.base).toBe('#base-color');
expect(result.light1).toBe('#mixed-color');
expect(result.dark1).toBe('#mixed-color');
@@ -390,9 +337,7 @@ describe('Theme utilities', () => {
colorSuccess: '#success',
colorInfo: '#info',
};
const result = getDeprecatedColors(systemColors, false);
expect(result.primary.base).toBe('#primary');
expect(result.error.base).toBe('#error');
expect(result.warning.base).toBe('#warning');

View File

@@ -19,14 +19,13 @@
import { theme as antdThemeImport } from 'antd';
import tinycolor from 'tinycolor2';
import {
type AntdThemeConfig,
type AnyThemeConfig,
type SerializableThemeConfig,
type DeprecatedColorVariations,
type DeprecatedThemeColors,
type SystemColors,
type SupersetTheme,
ThemeAlgorithm,
AntdThemeConfig,
AnyThemeConfig,
SerializableThemeConfig,
DeprecatedColorVariations,
DeprecatedThemeColors,
SystemColors,
SupersetTheme,
} from './types';
/**
@@ -39,8 +38,9 @@ export function isSerializableConfig(
if (algorithm === undefined) return true;
if (Array.isArray(algorithm))
if (Array.isArray(algorithm)) {
return (algorithm as unknown[]).every(alg => typeof alg === 'string');
}
return typeof algorithm === 'string';
}
@@ -60,21 +60,9 @@ export function deserializeThemeConfig(
let resolvedAlgorithm;
if (Array.isArray(algorithm)) {
const validAlgorithms = algorithm
.map((alg: ThemeAlgorithm) => algorithmMap[alg])
.filter(Boolean);
// If we have valid algorithms, use them; otherwise fallback to default
if (validAlgorithms.length > 0) {
resolvedAlgorithm =
validAlgorithms.length === 1 ? validAlgorithms[0] : validAlgorithms;
} else {
resolvedAlgorithm = antdThemeImport.defaultAlgorithm;
}
} else if (algorithm && algorithmMap[algorithm]) {
resolvedAlgorithm = algorithm.map(alg => algorithmMap[alg]);
} else if (algorithm) {
resolvedAlgorithm = algorithmMap[algorithm];
} else {
resolvedAlgorithm = antdThemeImport.defaultAlgorithm;
}
return {
@@ -95,21 +83,19 @@ export function serializeThemeConfig(
if (Array.isArray(algorithm)) {
serializedAlgorithm = algorithm.map(alg => {
if (alg === antdThemeImport.defaultAlgorithm)
return ThemeAlgorithm.DEFAULT;
if (alg === antdThemeImport.darkAlgorithm) return ThemeAlgorithm.DARK;
if (alg === antdThemeImport.compactAlgorithm)
return ThemeAlgorithm.COMPACT;
return ThemeAlgorithm.DEFAULT; // Fallback
}) as ThemeAlgorithm[];
if (alg === antdThemeImport.defaultAlgorithm) return 'default';
if (alg === antdThemeImport.darkAlgorithm) return 'dark';
if (alg === antdThemeImport.compactAlgorithm) return 'compact';
return 'default'; // Fallback
}) as ('default' | 'dark' | 'compact')[];
} else if (algorithm) {
if (algorithm === antdThemeImport.defaultAlgorithm)
serializedAlgorithm = ThemeAlgorithm.DEFAULT;
serializedAlgorithm = 'default';
else if (algorithm === antdThemeImport.darkAlgorithm)
serializedAlgorithm = ThemeAlgorithm.DARK;
serializedAlgorithm = 'dark';
else if (algorithm === antdThemeImport.compactAlgorithm)
serializedAlgorithm = ThemeAlgorithm.COMPACT;
else serializedAlgorithm = ThemeAlgorithm.DEFAULT; // Fallback
serializedAlgorithm = 'compact';
else serializedAlgorithm = 'default'; // Fallback
}
return {
@@ -123,8 +109,9 @@ export function serializeThemeConfig(
* This automatically detects and converts serializable configs
*/
export function normalizeThemeConfig(config: AnyThemeConfig): AntdThemeConfig {
if (isSerializableConfig(config)) return deserializeThemeConfig(config);
if (isSerializableConfig(config)) {
return deserializeThemeConfig(config);
}
return config as AntdThemeConfig;
}
@@ -177,7 +164,7 @@ export function getDeprecatedColors(
systemColors: SystemColors,
isDark: boolean,
): DeprecatedThemeColors {
const sc: SystemColors = systemColors;
const sc = systemColors;
return {
primary: genDeprecatedColorVariations(sc.colorPrimary, isDark),
error: genDeprecatedColorVariations(sc.colorError, isDark),

View File

@@ -21,8 +21,6 @@ import { isRequired } from '../utils';
import { TimeFormatFunction } from './types';
import stringifyTimeInput from './utils/stringifyTimeInput';
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
export const PREVIEW_TIME = new Date(Date.UTC(2017, 1, 14, 11, 22, 33));
// Use type augmentation to indicate that

View File

@@ -19,8 +19,6 @@
import { ExtensibleFunction } from '../models';
import { TimeRangeFormatFunction } from './types';
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
// Use type augmentation to indicate that
// an instance of TimeFormatter is also a function
interface TimeRangeFormatter {

View File

@@ -86,33 +86,20 @@ export default class Translator {
}
translate(input: string, ...args: unknown[]): string {
try {
return this.i18n.translate(input).fetch(...args);
} catch (err) {
logging.warn(`Translation failed for key "${input}" with args:`, args);
return input;
}
return this.i18n.translate(input).fetch(...args);
}
translateWithNumber(key: string, ...args: unknown[]): string {
try {
const [plural, num, ...rest] = args;
if (typeof plural === 'number') {
return this.i18n
.translate(key)
.ifPlural(plural, key)
.fetch(plural, num, ...rest);
}
const [plural, num, ...rest] = args;
if (typeof plural === 'number') {
return this.i18n
.translate(key)
.ifPlural(num as number, plural as string)
.fetch(...rest);
} catch (err) {
logging.warn(
`Plural translation failed for key "${key}" with args:`,
args,
);
.ifPlural(plural, key)
.fetch(plural, num, ...args);
}
return key;
return this.i18n
.translate(key)
.ifPlural(num as number, plural as string)
.fetch(...rest);
}
}

View File

@@ -45,7 +45,6 @@ export enum FeatureFlag {
EnableTemplateProcessing = 'ENABLE_TEMPLATE_PROCESSING',
EscapeMarkdownHtml = 'ESCAPE_MARKDOWN_HTML',
EstimateQueryCost = 'ESTIMATE_QUERY_COST',
FilterBarClosedByDefault = 'FILTERBAR_CLOSED_BY_DEFAULT',
GlobalAsyncQueries = 'GLOBAL_ASYNC_QUERIES',
ListviewsDefaultCardView = 'LISTVIEWS_DEFAULT_CARD_VIEW',
ScheduledQueries = 'SCHEDULED_QUERIES',
@@ -61,8 +60,6 @@ export enum FeatureFlag {
SlackEnableAvatars = 'SLACK_ENABLE_AVATARS',
EnableDashboardScreenshotEndpoints = 'ENABLE_DASHBOARD_SCREENSHOT_ENDPOINTS',
EnableDashboardDownloadWebDriverScreenshot = 'ENABLE_DASHBOARD_DOWNLOAD_WEBDRIVER_SCREENSHOT',
TableV2TimeComparisonEnabled = 'TABLE_V2_TIME_COMPARISON_ENABLED',
AgGridTableEnabled = 'AG_GRID_TABLE_ENABLED',
}
export type ScheduleQueriesProps = {

View File

@@ -35,13 +35,6 @@ const xssFilter = new FilterXSS({
'width',
'muted',
],
table: ['width', 'border', 'align', 'valign', 'style'],
tr: ['rowspan', 'align', 'valign', 'style'],
td: ['width', 'rowspan', 'colspan', 'align', 'valign', 'style'],
th: ['width', 'rowspan', 'colspan', 'align', 'valign', 'style'],
tbody: ['align', 'valign', 'style'],
thead: ['align', 'valign', 'style'],
tfoot: ['align', 'valign', 'style'],
},
stripIgnoreTag: true,
css: false,

View File

@@ -51,8 +51,8 @@ export const TestComponent = ({
style={{
width,
height,
backgroundColor: theme.colorPrimaryBg,
color: theme.colorTextSecondary,
backgroundColor: theme.colors.primary.light5,
color: theme.colors.grayscale.light3,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
@@ -66,7 +66,7 @@ export const TestComponent = ({
{[width, height].join('x')}
</div>
<div className="formData" style={{ padding: 10 }}>
<code style={{ color: theme.colorTextSecondary }}>
<code style={{ color: theme.colors.primary.light2 }}>
{JSON.stringify(formData)}
</code>
</div>

View File

@@ -19,7 +19,6 @@
import {
buildCustomFormatters,
Currency,
CurrencyFormatter,
getCustomFormatter,
getNumberFormatter,
@@ -117,19 +116,6 @@ test('buildCustomFormatters uses dataset d3 format if not provided in control pa
);
});
test('buildCustomFormatters returns NumberFormatter for a d3format with currency set to {}', () => {
const customFormatters: Record<string, ValueFormatter> =
buildCustomFormatters(
['count'],
{ count: {} as Currency },
{ count: ',.2%' },
undefined,
undefined,
);
expect(customFormatters.count).toBeInstanceOf(NumberFormatter);
});
test('getCustomFormatter', () => {
const customFormatters = {
sum__num: new CurrencyFormatter({

View File

@@ -17,8 +17,6 @@
* under the License.
*/
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
import { ExtensibleFunction } from '@superset-ui/core';
describe('ExtensibleFunction', () => {

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