mirror of
https://github.com/apache/superset.git
synced 2026-04-30 05:24:31 +00:00
Compare commits
80 Commits
chore/remo
...
fix/dropdo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf6e779200 | ||
|
|
ce6501c36c | ||
|
|
6ea6b01f4f | ||
|
|
c1376c05a9 | ||
|
|
0d681338aa | ||
|
|
6c88fcacfa | ||
|
|
e16656c6cf | ||
|
|
07c8e7f303 | ||
|
|
b2468d3752 | ||
|
|
7934665ac1 | ||
|
|
9366868f8f | ||
|
|
ae61000a12 | ||
|
|
7174695be7 | ||
|
|
4ee3a0fc07 | ||
|
|
f6c5219e89 | ||
|
|
72d39bea85 | ||
|
|
e9030b7fac | ||
|
|
f672b143db | ||
|
|
9f42ccecec | ||
|
|
5af17c7976 | ||
|
|
18d89f25ce | ||
|
|
73c4240ba4 | ||
|
|
1903b919d6 | ||
|
|
44177b4e35 | ||
|
|
e1ed5003a8 | ||
|
|
e6853894ab | ||
|
|
05fc5bb424 | ||
|
|
c373498543 | ||
|
|
fb3e129d62 | ||
|
|
003c232192 | ||
|
|
a51bbd46dc | ||
|
|
e77cfc93ed | ||
|
|
ef290b28e2 | ||
|
|
dd18b2eb54 | ||
|
|
d7a8c1934a | ||
|
|
af7a62ab3f | ||
|
|
69d2da9c61 | ||
|
|
67bc910eb5 | ||
|
|
a89f9bcb98 | ||
|
|
b302071723 | ||
|
|
e45330c2fd | ||
|
|
bd8d3ffb2d | ||
|
|
5e3a7ba106 | ||
|
|
c1a3de719a | ||
|
|
33deb028a6 | ||
|
|
919daabe54 | ||
|
|
0f2769ca3e | ||
|
|
a4a67296af | ||
|
|
b4000a025d | ||
|
|
a9761932bc | ||
|
|
29806780dc | ||
|
|
191337e08d | ||
|
|
a222dab781 | ||
|
|
230b25dd72 | ||
|
|
151d7d76da | ||
|
|
4f19bc4c5f | ||
|
|
11607dde04 | ||
|
|
e1bdb94efc | ||
|
|
6535fdd556 | ||
|
|
5fb89b865d | ||
|
|
6948e73ec7 | ||
|
|
c4cf03f899 | ||
|
|
d3de16c5f5 | ||
|
|
78fb09695b | ||
|
|
06818008c2 | ||
|
|
52ba4fd0cb | ||
|
|
4f2fa41f4e | ||
|
|
bf7ec853fa | ||
|
|
9fe3f634ec | ||
|
|
899e9294b2 | ||
|
|
dc9b459b27 | ||
|
|
7d3881f1da | ||
|
|
e5f9a6bf4b | ||
|
|
5cff657812 | ||
|
|
16387b0815 | ||
|
|
0857611a4e | ||
|
|
51ea2c297d | ||
|
|
fbd062165e | ||
|
|
55625c911f | ||
|
|
fca64de8e9 |
2
.github/workflows/embedded-sdk-release.yml
vendored
2
.github/workflows/embedded-sdk-release.yml
vendored
@@ -31,7 +31,7 @@ jobs:
|
||||
working-directory: superset-embedded-sdk
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||
with:
|
||||
node-version-file: './superset-embedded-sdk/.nvmrc'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
2
.github/workflows/embedded-sdk-test.yml
vendored
2
.github/workflows/embedded-sdk-test.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
||||
working-directory: superset-embedded-sdk
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||
with:
|
||||
node-version-file: './superset-embedded-sdk/.nvmrc'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
|
||||
2
.github/workflows/pre-commit.yml
vendored
2
.github/workflows/pre-commit.yml
vendored
@@ -42,7 +42,7 @@ jobs:
|
||||
echo "HOMEBREW_REPOSITORY=$HOMEBREW_REPOSITORY" >>"${GITHUB_ENV}"
|
||||
brew install norwoodj/tap/helm-docs
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
|
||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -44,7 +44,7 @@ jobs:
|
||||
|
||||
- name: Install Node.js
|
||||
if: env.HAS_TAGS
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||
with:
|
||||
node-version-file: './superset-frontend/.nvmrc'
|
||||
|
||||
|
||||
2
.github/workflows/superset-docs-deploy.yml
vendored
2
.github/workflows/superset-docs-deploy.yml
vendored
@@ -46,7 +46,7 @@ jobs:
|
||||
persist-credentials: false
|
||||
submodules: recursive
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||
with:
|
||||
node-version-file: './docs/.nvmrc'
|
||||
- name: Setup Python
|
||||
|
||||
4
.github/workflows/superset-docs-verify.yml
vendored
4
.github/workflows/superset-docs-verify.yml
vendored
@@ -72,7 +72,7 @@ jobs:
|
||||
persist-credentials: false
|
||||
submodules: recursive
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||
with:
|
||||
node-version-file: './docs/.nvmrc'
|
||||
- name: yarn install
|
||||
@@ -104,7 +104,7 @@ jobs:
|
||||
persist-credentials: false
|
||||
submodules: recursive
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||
with:
|
||||
node-version-file: './docs/.nvmrc'
|
||||
- name: yarn install
|
||||
|
||||
4
.github/workflows/superset-e2e.yml
vendored
4
.github/workflows/superset-e2e.yml
vendored
@@ -109,7 +109,7 @@ jobs:
|
||||
run: testdata
|
||||
- name: Setup Node.js
|
||||
if: steps.check.outputs.python || steps.check.outputs.frontend
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||
with:
|
||||
node-version-file: './superset-frontend/.nvmrc'
|
||||
- name: Install npm dependencies
|
||||
@@ -226,7 +226,7 @@ jobs:
|
||||
run: playwright_testdata
|
||||
- name: Setup Node.js
|
||||
if: steps.check.outputs.python || steps.check.outputs.frontend
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||
with:
|
||||
node-version-file: './superset-frontend/.nvmrc'
|
||||
- name: Install npm dependencies
|
||||
|
||||
2
.github/workflows/superset-playwright.yml
vendored
2
.github/workflows/superset-playwright.yml
vendored
@@ -100,7 +100,7 @@ jobs:
|
||||
run: playwright_testdata
|
||||
- name: Setup Node.js
|
||||
if: steps.check.outputs.python || steps.check.outputs.frontend
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||
with:
|
||||
node-version-file: './superset-frontend/.nvmrc'
|
||||
- name: Install npm dependencies
|
||||
|
||||
2
.github/workflows/superset-translations.yml
vendored
2
.github/workflows/superset-translations.yml
vendored
@@ -31,7 +31,7 @@ jobs:
|
||||
|
||||
- name: Setup Node.js
|
||||
if: steps.check.outputs.frontend
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||
with:
|
||||
node-version-file: './superset-frontend/.nvmrc'
|
||||
- name: Install dependencies
|
||||
|
||||
4
.github/workflows/tag-release.yml
vendored
4
.github/workflows/tag-release.yml
vendored
@@ -62,7 +62,7 @@ jobs:
|
||||
build: "true"
|
||||
|
||||
- name: Use Node.js 20
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
@@ -117,7 +117,7 @@ jobs:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Use Node.js 20
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
|
||||
2
.github/workflows/tech-debt.yml
vendored
2
.github/workflows/tech-debt.yml
vendored
@@ -35,7 +35,7 @@ jobs:
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||
with:
|
||||
node-version-file: './superset-frontend/.nvmrc'
|
||||
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -62,6 +62,7 @@ rat-results.txt
|
||||
superset/app/
|
||||
superset-websocket/config.json
|
||||
.direnv
|
||||
*.log
|
||||
|
||||
# Node.js, webpack artifacts, storybook
|
||||
*.entry.js
|
||||
|
||||
162
docs/admin_docs/configuration/aws-iam.mdx
Normal file
162
docs/admin_docs/configuration/aws-iam.mdx
Normal file
@@ -0,0 +1,162 @@
|
||||
{/*
|
||||
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.
|
||||
*/}
|
||||
|
||||
---
|
||||
title: AWS IAM Authentication
|
||||
sidebar_label: AWS IAM Authentication
|
||||
sidebar_position: 15
|
||||
---
|
||||
|
||||
# AWS IAM Authentication for AWS Databases
|
||||
|
||||
Superset supports IAM-based authentication for **Amazon Aurora** (PostgreSQL and MySQL) and **Amazon Redshift**. IAM auth eliminates the need for database passwords — Superset generates a short-lived auth token using temporary AWS credentials instead.
|
||||
|
||||
Cross-account IAM role assumption via STS `AssumeRole` is supported, allowing a Superset deployment in one AWS account to connect to databases in a different account.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Enable the `AWS_DATABASE_IAM_AUTH` feature flag in `superset_config.py`. IAM authentication is gated behind this flag; if it is disabled, connections using `aws_iam` fail with *"AWS IAM database authentication is not enabled."*
|
||||
```python
|
||||
FEATURE_FLAGS = {
|
||||
"AWS_DATABASE_IAM_AUTH": True,
|
||||
}
|
||||
```
|
||||
- `boto3` must be installed in your Superset environment:
|
||||
```bash
|
||||
pip install boto3
|
||||
```
|
||||
- The Superset server's IAM role (or static credentials) must have permission to call `sts:AssumeRole` (for cross-account) or the same-account permissions for the target service:
|
||||
- **Aurora (RDS)**: `rds-db:connect`
|
||||
- **Redshift provisioned**: `redshift:GetClusterCredentials`
|
||||
- **Redshift Serverless**: `redshift-serverless:GetCredentials` and `redshift-serverless:GetWorkgroup`
|
||||
- SSL must be enabled on the Aurora / Redshift endpoint (required for IAM token auth).
|
||||
|
||||
## Configuration
|
||||
|
||||
IAM authentication is configured via the **encrypted_extra** field of the database connection. Access this field in the **Advanced** → **Security** section of the database connection form, under **Secure Extra**.
|
||||
|
||||
### Aurora PostgreSQL or Aurora MySQL
|
||||
|
||||
```json
|
||||
{
|
||||
"aws_iam": {
|
||||
"enabled": true,
|
||||
"role_arn": "arn:aws:iam::222222222222:role/SupersetDatabaseAccess",
|
||||
"external_id": "superset-prod-12345",
|
||||
"region": "us-east-1",
|
||||
"db_username": "superset_iam_user",
|
||||
"session_duration": 3600
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Required | Description |
|
||||
|-------|----------|-------------|
|
||||
| `enabled` | Yes | Set to `true` to activate IAM auth |
|
||||
| `role_arn` | No | ARN of the cross-account IAM role to assume via STS. Omit for same-account auth |
|
||||
| `external_id` | No | External ID for the STS `AssumeRole` call, if required by the target role's trust policy |
|
||||
| `region` | Yes | AWS region of the database cluster |
|
||||
| `db_username` | Yes | The database username associated with the IAM identity |
|
||||
| `session_duration` | No | STS session duration in seconds (default: `3600`) |
|
||||
|
||||
### Redshift (Serverless)
|
||||
|
||||
```json
|
||||
{
|
||||
"aws_iam": {
|
||||
"enabled": true,
|
||||
"role_arn": "arn:aws:iam::222222222222:role/SupersetRedshiftAccess",
|
||||
"region": "us-east-1",
|
||||
"workgroup_name": "my-workgroup",
|
||||
"db_name": "dev"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Redshift (Provisioned Cluster)
|
||||
|
||||
```json
|
||||
{
|
||||
"aws_iam": {
|
||||
"enabled": true,
|
||||
"role_arn": "arn:aws:iam::222222222222:role/SupersetRedshiftAccess",
|
||||
"region": "us-east-1",
|
||||
"cluster_identifier": "my-cluster",
|
||||
"db_username": "superset_iam_user",
|
||||
"db_name": "dev"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Cross-Account IAM Setup
|
||||
|
||||
To connect to a database in Account B from a Superset deployment in Account A:
|
||||
|
||||
**1. In Account B — create a database-access role:**
|
||||
|
||||
```json
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": ["rds-db:connect"],
|
||||
"Resource": "arn:aws:rds-db:us-east-1:222222222222:dbuser/db-XXXXXXXXXXXX/superset_iam_user"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Trust policy** (allows Account A's Superset role to assume it):
|
||||
|
||||
```json
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Principal": {
|
||||
"AWS": "arn:aws:iam::111111111111:role/SupersetInstanceRole"
|
||||
},
|
||||
"Action": "sts:AssumeRole",
|
||||
"Condition": {
|
||||
"StringEquals": {
|
||||
"sts:ExternalId": "superset-prod-12345"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**2. In Account A — grant Superset's role permission to assume the Account B role:**
|
||||
|
||||
```json
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": "sts:AssumeRole",
|
||||
"Resource": "arn:aws:iam::222222222222:role/SupersetDatabaseAccess"
|
||||
}
|
||||
```
|
||||
|
||||
**3. Configure the database connection in Superset** using the `role_arn` and `external_id` from the trust policy (as shown in the configuration example above).
|
||||
|
||||
## Credential Caching
|
||||
|
||||
STS credentials are cached in memory keyed by `(role_arn, region, external_id)` with a 10-minute TTL. This reduces the number of STS API calls when multiple queries are executed with the same connection. Tokens are refreshed automatically before expiry.
|
||||
@@ -109,6 +109,14 @@ SECRET_KEY = 'YOUR_OWN_RANDOM_GENERATED_SECRET_KEY'
|
||||
|
||||
You can generate a strong secure key with `openssl rand -base64 42`.
|
||||
|
||||
Alternatively, you can set the secret key using `SUPERSET_SECRET_KEY` environment variable:
|
||||
|
||||
On a Unix-based system, such as Linux or macOS, you can do so by running the following command in your terminal:
|
||||
|
||||
```bash
|
||||
export SUPERSET_SECRET_KEY=$(openssl rand -base64 42)
|
||||
```
|
||||
|
||||
:::caution Use a strong secret key
|
||||
This key will be used for securely signing session cookies and encrypting sensitive information stored in Superset's application metadata database.
|
||||
Your deployment must use a complex, unique key.
|
||||
|
||||
@@ -10,6 +10,10 @@ version: 1
|
||||
The superset cli allows you to import and export datasources from and to YAML. Datasources include
|
||||
databases. The data is expected to be organized in the following hierarchy:
|
||||
|
||||
:::info
|
||||
Superset's ZIP-based import/export also covers **dashboards**, **charts**, and **saved queries**, exercised through the UI and REST API. The [Dashboard Import Overwrite Behavior](#dashboard-import-overwrite-behavior) and [UUIDs in API Responses](#uuids-in-api-responses) sections below document the behavior shared across all asset types.
|
||||
:::
|
||||
|
||||
```text
|
||||
├──databases
|
||||
| ├──database_1
|
||||
@@ -75,6 +79,29 @@ The optional username flag **-u** sets the user used for the datasource import.
|
||||
superset import_datasources -p <path / filename> -u 'admin'
|
||||
```
|
||||
|
||||
## Dashboard Import Overwrite Behavior
|
||||
|
||||
When importing a dashboard ZIP with the **overwrite** option enabled, any existing charts that are part of the dashboard are **replaced** rather than duplicated. This applies to:
|
||||
|
||||
- Charts whose UUID matches a chart already present in the target instance
|
||||
- The full chart configuration (query, visualization type, columns, metrics) is replaced by the imported version
|
||||
|
||||
If you import without the overwrite flag, existing charts with conflicting UUIDs are left unchanged and the import skips those objects. Use overwrite when you want to push a fully updated dashboard (including chart definitions) from a development or staging environment to production.
|
||||
|
||||
## UUIDs in API Responses
|
||||
|
||||
The REST API POST endpoints for **datasets**, **charts**, and **dashboards** include the auto-generated `uuid` field in the response body:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 42,
|
||||
"uuid": "b8a8d5c3-1234-4abc-8def-0123456789ab",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
UUIDs remain stable across import/export cycles and can be used for cross-environment workflows — for example, recording a UUID when creating a chart in development and using it to identify the matching chart after importing into production.
|
||||
|
||||
## Legacy Importing Datasources
|
||||
|
||||
### From older versions of Superset to current version
|
||||
|
||||
@@ -501,6 +501,7 @@ All MCP settings go in `superset_config.py`. Defaults are defined in `superset/m
|
||||
| `MCP_SERVICE_URL` | `None` | Public base URL for MCP-generated links (set this when behind a reverse proxy) |
|
||||
| `MCP_DEBUG` | `False` | Enable debug logging |
|
||||
| `MCP_DEV_USERNAME` | -- | Superset username for development mode (no auth) |
|
||||
| `MCP_PARSE_REQUEST_ENABLED` | `True` | Pre-parse MCP tool inputs from JSON strings into objects. Set to `False` for clients (Claude Desktop, LangChain) that do not double-serialize arguments — this produces cleaner tool schemas for those clients |
|
||||
|
||||
### Authentication
|
||||
|
||||
@@ -664,6 +665,32 @@ MCP_CSRF_CONFIG = {
|
||||
|
||||
---
|
||||
|
||||
## Audit Events
|
||||
|
||||
All MCP tool calls are logged to Superset's event logger, the same system used by the web UI (viewable at **Settings → Action Log**). Each event captures:
|
||||
|
||||
- **Action**: `mcp.<tool_name>.<phase>` (e.g., `mcp.list_databases.query`)
|
||||
- **User**: the resolved Superset username from the JWT or dev config
|
||||
- **Timestamp**: when the operation ran
|
||||
|
||||
This means MCP activity is auditable alongside normal user activity. No additional configuration is required — logging is on by default whenever the event logger is enabled in your Superset deployment.
|
||||
|
||||
## Tool Pagination
|
||||
|
||||
MCP list tools (`list_datasets`, `list_charts`, `list_dashboards`, `list_databases`) use **offset pagination** via `page` (1-based) and `page_size` parameters. Responses include `page`, `page_size`, `total_count`, `total_pages`, `has_previous`, and `has_next`. To iterate through all results:
|
||||
|
||||
```python
|
||||
# Example: fetch all charts across pages
|
||||
all_charts = []
|
||||
page = 1
|
||||
while True:
|
||||
result = mcp.list_charts(page=page, page_size=50)
|
||||
all_charts.extend(result["charts"])
|
||||
if not result.get("has_next"):
|
||||
break
|
||||
page += 1
|
||||
```
|
||||
|
||||
## Security Best Practices
|
||||
|
||||
- **Use TLS** for all production MCP endpoints -- place the server behind a reverse proxy with HTTPS
|
||||
|
||||
@@ -63,6 +63,12 @@ by clicking the **Connect** button in the bottom right corner of the modal windo
|
||||
|
||||
Congratulations, you've just added a new data source in Superset!
|
||||
|
||||
### Sharing a Database Connection
|
||||
|
||||
When adding a new database, you can share the connection with other Superset users. Shared connections appear in other users' database lists, making it easier to collaborate on the same data without requiring each user to configure the same connection separately.
|
||||
|
||||
To share a connection, enable the **Share connection with other users** option in the **Advanced** tab of the database connection modal before saving. You can change sharing settings later by editing the database connection.
|
||||
|
||||
### Registering a new table
|
||||
|
||||
Now that you’ve configured a data source, you can select specific tables (called **Datasets** in Superset)
|
||||
@@ -80,6 +86,22 @@ we register the **cleaned_sales_data** table from the **examples** database.
|
||||
|
||||
To finish, click the **Add** button in the bottom right corner. You should now see your dataset in the list of datasets.
|
||||
|
||||
### Organizing Datasets into Folders
|
||||
|
||||
The Datasets list view supports **folders** for organizing datasets into groups. To create and manage folders:
|
||||
|
||||
1. In the **Datasets** list, click the **Folders** panel on the left sidebar.
|
||||
2. Click **+ New Folder** to create a top-level folder, or drag an existing folder to nest it.
|
||||
3. Drag dataset rows onto a folder to move them in, or right-click a dataset and select **Move to folder**.
|
||||
|
||||
Folders are per-user organizational aids — they do not affect dataset access permissions or how other users see the datasets.
|
||||
|
||||
### Uploading Files via the OS File Manager (PWA)
|
||||
|
||||
When Superset is installed as a **Progressive Web App (PWA)** from your browser, your operating system will offer Superset as an option when opening CSV, Excel (`.xls`/`.xlsx`), and Parquet files. Double-clicking or right-clicking a supported file and selecting "Open with Superset" navigates directly to the upload workflow for that file.
|
||||
|
||||
To install Superset as a PWA, look for the install icon in your browser's address bar (Chrome, Edge) when visiting your Superset instance over HTTPS. PWA installation requires HTTPS and a valid manifest — your admin needs to confirm the app manifest is served correctly.
|
||||
|
||||
### Customizing column properties
|
||||
|
||||
Now that you've registered your dataset, you can configure column properties
|
||||
@@ -234,6 +256,64 @@ For example, when running the local development build, the following will disabl
|
||||
Top Nav and remove the Filter Bar:
|
||||
`http://localhost:8088/superset/dashboard/my-dashboard/?standalone=1&show_filters=0`
|
||||
|
||||
### AG Grid Interactive Table
|
||||
|
||||
The **AG Grid Interactive Table** chart type is Superset's fully-featured data grid, suitable for large paginated datasets where the standard Table chart is not enough.
|
||||
|
||||
#### Server-Side Column Filters
|
||||
|
||||
AG Grid supports server-side column filters that query the full dataset — not just the loaded page. Filters are applied before data is sent to the browser, so results are correct even across millions of rows.
|
||||
|
||||
**Available filter types:**
|
||||
|
||||
| Column type | Filter options |
|
||||
|---|---|
|
||||
| Text | Contains, equals, starts with, ends with |
|
||||
| Number | Equals, not equal, less than, greater than, between |
|
||||
| Date | Before, after, between, blank |
|
||||
| Set | Select from a list of distinct values |
|
||||
|
||||
**AND / OR logic:** Each column supports combining multiple conditions with AND or OR. Filters from different columns are always combined with AND.
|
||||
|
||||
**Interaction with pagination:** Server-side filters run as WHERE clauses in the underlying SQL query, so pagination always operates over the already-filtered result set.
|
||||
|
||||
#### Time Shift (Time Comparison)
|
||||
|
||||
AG Grid Interactive Table supports **Time Shift** (time comparison), matching the behavior of the standard Table chart. In the **Advanced Analytics** → **Time Comparison** section of the chart configuration, enter a shift expression (e.g., `1 year ago`, `minus 7 days`) to add comparison columns showing values from the offset period. Dashboard-level time range overrides apply to both the base and comparison periods.
|
||||
|
||||
### Dynamic Currency Formatting
|
||||
|
||||
Chart metric values can display currencies dynamically rather than using a fixed currency code. To enable:
|
||||
|
||||
1. Open the dataset editor for your dataset (**Datasets → Edit**).
|
||||
2. In the **Advanced** tab, set **Currency Code Column** to the name of a column in your dataset that contains ISO 4217 currency codes (e.g., `USD`, `EUR`, `GBP`).
|
||||
3. In the Explore chart configuration, open the metric's **Number format** section and select **Auto-detect** for currency.
|
||||
|
||||
When Auto-detect is active, each row uses the currency code from the designated column, so a single chart can display values in multiple currencies — each formatted correctly for its currency.
|
||||
|
||||
### ECharts Option Editor
|
||||
|
||||
For ECharts-based chart types (line, bar, area, scatter, pie, and others), Explore includes an advanced **ECharts Option Editor** that accepts raw JSON overrides for the underlying ECharts configuration.
|
||||
|
||||
Access it via the **Customize** tab → **ECharts Options** section at the bottom of the panel. The JSON you enter is deep-merged on top of Superset's generated ECharts config, so you can override specific options without rewriting the entire config.
|
||||
|
||||
**Example:** override the legend position and add a custom title:
|
||||
|
||||
```json
|
||||
{
|
||||
"legend": { "orient": "vertical", "right": "5%", "top": "middle" },
|
||||
"title": { "text": "My Custom Title", "left": "center" }
|
||||
}
|
||||
```
|
||||
|
||||
:::caution
|
||||
ECharts option overrides bypass Superset's validation layer. Invalid option keys are silently ignored by ECharts. Overrides that conflict with Superset-generated options (e.g., `series`) may produce unexpected results.
|
||||
:::
|
||||
|
||||
### Table Chart: Exporting Filtered Data
|
||||
|
||||
When the **Search Box** is visible in a Table chart, the **Download** action exports only the rows currently visible after the search filter is applied — not the full underlying dataset. This matches the visual output and is intentional. To export the full dataset regardless of search state, use the **Download as CSV** option from the chart's three-dot menu in the dashboard or from the Explore chart toolbar before applying a search filter.
|
||||
|
||||
:::resources
|
||||
- [Dashboard Customization](https://docs.preset.io/docs/dashboard-customization) - Advanced dashboard styling and layout options
|
||||
- [Blog: BI Dashboard Best Practices](https://preset.io/blog/bi-dashboard-best-practices/)
|
||||
|
||||
130
docs/docs/using-superset/embedding.mdx
Normal file
130
docs/docs/using-superset/embedding.mdx
Normal file
@@ -0,0 +1,130 @@
|
||||
{/*
|
||||
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.
|
||||
*/}
|
||||
|
||||
---
|
||||
title: Embedding Superset
|
||||
sidebar_position: 6
|
||||
---
|
||||
|
||||
# Embedding Superset
|
||||
|
||||
Superset dashboards can be embedded directly in host applications using the `@superset-ui/embedded-sdk` package.
|
||||
|
||||
:::info Prerequisites
|
||||
- The `EMBEDDED_SUPERSET` feature flag must be enabled.
|
||||
- The embedding domain and allowed origins must be configured by an admin.
|
||||
:::
|
||||
|
||||
## Quick Start
|
||||
|
||||
Install the SDK:
|
||||
|
||||
```bash
|
||||
npm install @superset-ui/embedded-sdk
|
||||
```
|
||||
|
||||
Embed a dashboard:
|
||||
|
||||
```javascript
|
||||
import { embedDashboard } from '@superset-ui/embedded-sdk';
|
||||
|
||||
embedDashboard({
|
||||
id: 'dashboard-uuid-here', // from Dashboard → Embed
|
||||
supersetDomain: 'https://superset.example.com',
|
||||
mountPoint: document.getElementById('superset-container'),
|
||||
fetchGuestToken: () => fetchTokenFromYourBackend(),
|
||||
dashboardUiConfig: {
|
||||
hideTitle: true,
|
||||
filters: { expanded: false },
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
`fetchGuestToken` must return a **guest token** obtained from your server by calling Superset's `/api/v1/security/guest_token/` endpoint with a service account. Do not call this endpoint from client-side code.
|
||||
|
||||
---
|
||||
|
||||
## Callbacks
|
||||
|
||||
### `resolvePermalinkUrl`
|
||||
|
||||
When a user copies a permalink from an embedded dashboard, Superset generates a URL on its own domain. In an embedded context this URL is usually not meaningful to the host application's users — the dashboard is rendered inside the host app, not at the Superset URL.
|
||||
|
||||
The `resolvePermalinkUrl` callback lets the host app intercept permalink generation and return a URL on the host domain instead:
|
||||
|
||||
```javascript
|
||||
embedDashboard({
|
||||
id: 'my-dashboard-uuid',
|
||||
supersetDomain: 'https://superset.example.com',
|
||||
mountPoint: document.getElementById('superset-container'),
|
||||
fetchGuestToken: () => fetchGuestToken(),
|
||||
/**
|
||||
* Called when Superset generates a permalink.
|
||||
* @param {Object} args - { key: string } — the permalink key
|
||||
* @returns {string | null} - your host URL, or null to use Superset's default
|
||||
*/
|
||||
resolvePermalinkUrl: ({ key }) => {
|
||||
return `https://myapp.example.com/dashboard?permalink=${key}`;
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
If the callback returns `null` or is not provided, Superset uses its own permalink URL as a fallback.
|
||||
|
||||
---
|
||||
|
||||
## Feature Flags for Embedded Mode
|
||||
|
||||
### `DISABLE_EMBEDDED_SUPERSET_LOGOUT`
|
||||
|
||||
Hides the logout button when Superset is embedded in a host application. This is useful when the host application manages the session lifecycle and you do not want users to accidentally log out of the embedded Superset session:
|
||||
|
||||
```python
|
||||
# superset_config.py
|
||||
FEATURE_FLAGS = {
|
||||
"EMBEDDED_SUPERSET": True,
|
||||
"DISABLE_EMBEDDED_SUPERSET_LOGOUT": True,
|
||||
}
|
||||
```
|
||||
|
||||
When enabled, the **Logout** menu item is removed from the user avatar dropdown in the embedded view. The session can still be invalidated server-side by revoking the guest token.
|
||||
|
||||
### `EMBEDDED_SUPERSET`
|
||||
|
||||
Must be `True` to enable the embedded SDK and the guest token endpoint. Without this flag, `embedDashboard` will fail to load.
|
||||
|
||||
---
|
||||
|
||||
## URL Parameters
|
||||
|
||||
The following URL parameters can be passed through the `urlParams` option in `dashboardUiConfig` or appended to the embedded iframe URL:
|
||||
|
||||
| Parameter | Values | Effect |
|
||||
|-----------|--------|--------|
|
||||
| `standalone` | `0`, `1`, `2`, `3` | `0`: normal; `1`: hide nav; `2`: hide nav + title; `3`: hide nav + title + tabs |
|
||||
| `show_filters` | `0`, `1` | Show or hide the native filter bar |
|
||||
| `expand_filters` | `0`, `1` | Start with filter bar expanded or collapsed |
|
||||
|
||||
---
|
||||
|
||||
## Security Notes
|
||||
|
||||
- **Guest tokens expire** — their lifetime is controlled by the `GUEST_TOKEN_JWT_EXP_SECONDS` config (default: 5 minutes). Refresh tokens before they expire using a token refresh mechanism in your host app.
|
||||
- **Row-level security** — pass `rls` rules in the guest token request to restrict which rows are visible to the embedded user.
|
||||
- **Allowed domains** — restrict which host origins can embed a dashboard by setting **Allowed Domains** per-dashboard in the *Embed* settings modal. Superset checks the request's `Referer` header against this list before serving the embedded view; an empty list allows any origin, so configure this explicitly for production.
|
||||
@@ -329,6 +329,27 @@ various options in this section, refer to the
|
||||
Lastly, save your chart as Tutorial Resample and add it to the Tutorial Dashboard. Go to the
|
||||
tutorial dashboard to see the four charts side by side and compare the different outputs.
|
||||
|
||||
### SQL Lab Tips
|
||||
|
||||
**Schema and table browser**: The left-side table browser uses a collapsible treeview — click a schema to expand its tables, and click a table to see its columns and sample data inline. This makes navigating large schemas much faster than the previous flat list.
|
||||
|
||||
**Find in editor**: Press **Ctrl+F** (or **Cmd+F** on Mac) to open the Monaco find/replace widget inside the SQL editor without leaving the editor.
|
||||
|
||||
**Resizable panels**: The dividers between the SQL editor, schema browser, and results pane are draggable. Adjust them to match your workflow and screen size.
|
||||
|
||||
**Dialect-aware Format SQL**: The **Format SQL** button applies the SQL dialect of the currently selected database — Trino, Presto, MySQL, PostgreSQL, etc. — rather than a generic formatter. Switch to a different database in the toolbar and re-format to get dialect-specific output. Jinja template syntax (`{{ }}`, `{% %}`) is preserved during formatting and will not cause format errors.
|
||||
|
||||
### Time Range Natural Language Expressions
|
||||
|
||||
The **Custom** time range picker accepts natural language expressions alongside specific dates:
|
||||
|
||||
- **Relative**: `Last 7 days`, `Last month`, `Last quarter`, `Last year`
|
||||
- **Anchored**: `previous calendar week`, `previous calendar month`
|
||||
- **"First of" expressions**: `first day of this week`, `first day of this month`, `first day of this quarter`, `first day of this year`, `first week of this year`
|
||||
- **Offsets**: `30 days ago`, `1 year ago`, `next week`
|
||||
|
||||
These expressions are evaluated at query time, so saved charts always display data relative to the current date.
|
||||
|
||||
:::resources
|
||||
- [Chart Walkthroughs](https://docs.preset.io/docs/chart-walkthroughs) - Detailed guides for most chart types
|
||||
- [Blog: Why Apache ECharts is the Future of Apache Superset](https://preset.io/blog/2021-4-1-why-echarts/)
|
||||
|
||||
@@ -56,8 +56,8 @@ Ask your AI assistant to browse what's available in your Superset instance:
|
||||
Describe the visualization you want and AI creates it for you:
|
||||
|
||||
- **Create charts from natural language** -- describe what you want to see and AI picks the right chart type, metrics, and dimensions
|
||||
- **Preview before saving** -- AI generates a preview so you can review before committing
|
||||
- **Modify existing charts** -- update filters, change chart types, add metrics
|
||||
- **Preview before saving** -- `generate_chart` defaults to `save_chart=False`, showing the chart in Explore before it's committed. Ask AI to save once you're satisfied.
|
||||
- **Modify existing charts** -- `update_chart` also supports preview mode so you can review changes before saving
|
||||
- **Get Explore links** -- open any chart in Superset's Explore view for further refinement
|
||||
|
||||
**Example prompts:**
|
||||
@@ -195,27 +195,59 @@ Ask your admin for the MCP server URL and any authentication tokens you need.
|
||||
|
||||
## Available Tools Reference
|
||||
|
||||
### Exploration & Discovery
|
||||
|
||||
| Tool | Description |
|
||||
|------|-------------|
|
||||
| `health_check` | Verify the MCP server is running and connected |
|
||||
| `get_instance_info` | Get instance statistics (dataset, chart, dashboard counts) |
|
||||
| `get_schema` | Discover available charts, datasets, and dashboards with schema info |
|
||||
|
||||
### Datasets
|
||||
|
||||
| Tool | Description |
|
||||
|------|-------------|
|
||||
| `list_datasets` | List datasets with filtering and search |
|
||||
| `get_dataset_info` | Get dataset metadata (columns, metrics, filters) |
|
||||
| `create_virtual_dataset` | Create a virtual dataset from a SQL query |
|
||||
|
||||
### Charts
|
||||
|
||||
| Tool | Description |
|
||||
|------|-------------|
|
||||
| `list_charts` | List charts with filtering and search |
|
||||
| `get_chart_info` | Get chart metadata and configuration |
|
||||
| `get_chart_data` | Retrieve chart data (JSON, CSV, or Excel) |
|
||||
| `get_chart_preview` | Generate a chart preview (URL, ASCII, table, or Vega-Lite) |
|
||||
| `generate_chart` | Create a new chart from a specification |
|
||||
| `update_chart` | Modify an existing chart's configuration |
|
||||
| `get_chart_type_schema` | Get the configuration schema for a chart type |
|
||||
| `generate_chart` | Create a new chart from a specification (defaults to preview mode — review before saving) |
|
||||
| `update_chart` | Modify an existing chart's configuration (pass `generate_preview=False` to persist immediately instead of returning a preview URL) |
|
||||
| `update_chart_preview` | Update a cached chart preview without saving |
|
||||
| `generate_explore_link` | Generate an Explore URL for interactive visualization |
|
||||
|
||||
### Dashboards
|
||||
|
||||
| Tool | Description |
|
||||
|------|-------------|
|
||||
| `list_dashboards` | List dashboards with filtering and search |
|
||||
| `get_dashboard_info` | Get dashboard metadata and layout |
|
||||
| `generate_dashboard` | Create a new dashboard with specified charts |
|
||||
| `add_chart_to_existing_dashboard` | Add a chart to an existing dashboard |
|
||||
|
||||
### SQL
|
||||
|
||||
| Tool | Description |
|
||||
|------|-------------|
|
||||
| `execute_sql` | Run a SQL query with RBAC enforcement |
|
||||
| `save_sql_query` | Persist a SQL query to SQL Lab's saved queries |
|
||||
| `open_sql_lab_with_context` | Open SQL Lab with a pre-populated query |
|
||||
| `generate_explore_link` | Generate an Explore URL for interactive visualization |
|
||||
|
||||
### Databases
|
||||
|
||||
| Tool | Description |
|
||||
|------|-------------|
|
||||
| `list_databases` | List configured database connections |
|
||||
| `get_database_info` | Get details about a specific database connection |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -67,10 +67,10 @@
|
||||
"@storybook/preview-api": "^8.6.18",
|
||||
"@storybook/theming": "^8.6.15",
|
||||
"@superset-ui/core": "^0.20.4",
|
||||
"@swc/core": "^1.15.24",
|
||||
"antd": "^6.3.5",
|
||||
"baseline-browser-mapping": "^2.10.19",
|
||||
"caniuse-lite": "^1.0.30001788",
|
||||
"@swc/core": "^1.15.30",
|
||||
"antd": "^6.3.6",
|
||||
"baseline-browser-mapping": "^2.10.20",
|
||||
"caniuse-lite": "^1.0.30001790",
|
||||
"docusaurus-plugin-openapi-docs": "^5.0.1",
|
||||
"docusaurus-theme-openapi-docs": "^5.0.1",
|
||||
"js-yaml": "^4.1.1",
|
||||
@@ -98,15 +98,15 @@
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/react": "^19.1.8",
|
||||
"@typescript-eslint/eslint-plugin": "^8.52.0",
|
||||
"@typescript-eslint/parser": "^8.56.1",
|
||||
"@typescript-eslint/parser": "^8.59.0",
|
||||
"eslint": "^9.39.2",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-prettier": "^5.5.5",
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
"globals": "^17.4.0",
|
||||
"globals": "^17.5.0",
|
||||
"prettier": "^3.8.3",
|
||||
"typescript": "~5.9.3",
|
||||
"typescript-eslint": "^8.58.2",
|
||||
"typescript": "~6.0.3",
|
||||
"typescript-eslint": "^8.59.0",
|
||||
"webpack": "^5.106.2"
|
||||
},
|
||||
"browserslist": {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"extends": "@docusaurus/tsconfig",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"ignoreDeprecations": "6.0",
|
||||
"skipLibCheck": true,
|
||||
"noImplicitAny": false,
|
||||
"strict": false,
|
||||
|
||||
@@ -109,6 +109,14 @@ SECRET_KEY = 'YOUR_OWN_RANDOM_GENERATED_SECRET_KEY'
|
||||
|
||||
You can generate a strong secure key with `openssl rand -base64 42`.
|
||||
|
||||
Alternatively, you can set the secret key using `SUPERSET_SECRET_KEY` environment variable:
|
||||
|
||||
On a Unix-based system, such as Linux or macOS, you can do so by running the following command in your terminal:
|
||||
|
||||
```bash
|
||||
export SUPERSET_SECRET_KEY=$(openssl rand -base64 42)
|
||||
```
|
||||
|
||||
:::caution Use a strong secret key
|
||||
This key will be used for securely signing session cookies and encrypting sensitive information stored in Superset's application metadata database.
|
||||
Your deployment must use a complex, unique key.
|
||||
|
||||
332
docs/yarn.lock
332
docs/yarn.lock
@@ -2995,14 +2995,14 @@
|
||||
"@rc-component/util" "^1.6.2"
|
||||
clsx "^2.1.1"
|
||||
|
||||
"@rc-component/image@~1.8.0":
|
||||
version "1.8.0"
|
||||
resolved "https://registry.yarnpkg.com/@rc-component/image/-/image-1.8.0.tgz#1bfbb13a72782df05c075be45aed94222aee7a88"
|
||||
integrity sha512-Dr41bFevLB5NgVaJhEUmNvbEf+ynAhim6W98ZW2xvCsdFISc2TYP4ZvCVdie3eaZdum2kieVcvpNHu+UrzAAHA==
|
||||
"@rc-component/image@~1.9.0":
|
||||
version "1.9.0"
|
||||
resolved "https://registry.yarnpkg.com/@rc-component/image/-/image-1.9.0.tgz#110785d735d20336afcdbac84e8fbfd059a7a44e"
|
||||
integrity sha512-khF7w7xkBH5B1bsBcI1FSUZdkyd1aqpl2eYyILCqCzzQH3XdfehGUaZTnptyaJJfs09/R5hv9jXWyazOMFIClQ==
|
||||
dependencies:
|
||||
"@rc-component/motion" "^1.0.0"
|
||||
"@rc-component/portal" "^2.1.2"
|
||||
"@rc-component/util" "^1.10.0"
|
||||
"@rc-component/util" "^1.10.1"
|
||||
clsx "^2.1.1"
|
||||
|
||||
"@rc-component/input-number@~1.6.2":
|
||||
@@ -3279,10 +3279,10 @@
|
||||
"@rc-component/util" "^1.3.0"
|
||||
clsx "^2.1.1"
|
||||
|
||||
"@rc-component/util@^1.1.0", "@rc-component/util@^1.10.0", "@rc-component/util@^1.2.0", "@rc-component/util@^1.2.1", "@rc-component/util@^1.3.0", "@rc-component/util@^1.4.0", "@rc-component/util@^1.6.2", "@rc-component/util@^1.7.0", "@rc-component/util@^1.8.1", "@rc-component/util@^1.9.0":
|
||||
version "1.10.0"
|
||||
resolved "https://registry.yarnpkg.com/@rc-component/util/-/util-1.10.0.tgz#faeebbe0510f998b6d5cee9da9176b6d613cac2c"
|
||||
integrity sha512-aY9GLBuiUdpyfIUpAWSYer4Tu3mVaZCo5A0q9NtXcazT3MRiI3/WNHCR+DUn5VAtR6iRRf0ynCqQUcHli5UdYw==
|
||||
"@rc-component/util@^1.1.0", "@rc-component/util@^1.10.1", "@rc-component/util@^1.2.0", "@rc-component/util@^1.2.1", "@rc-component/util@^1.3.0", "@rc-component/util@^1.4.0", "@rc-component/util@^1.6.2", "@rc-component/util@^1.7.0", "@rc-component/util@^1.8.1", "@rc-component/util@^1.9.0":
|
||||
version "1.10.1"
|
||||
resolved "https://registry.yarnpkg.com/@rc-component/util/-/util-1.10.1.tgz#213c84c77e8b2001095530d3b0dc47c49c34ffe3"
|
||||
integrity sha512-q++9S6rUa5Idb/xIBNz6jtvumw5+O5YV5V0g4iK9mn9jWs4oGJheE3ZN1kAnE723AXyaD8v95yeOASmdk8Jnng==
|
||||
dependencies:
|
||||
is-mobile "^5.0.0"
|
||||
react-is "^18.2.0"
|
||||
@@ -4239,86 +4239,86 @@
|
||||
dependencies:
|
||||
apg-lite "^1.0.4"
|
||||
|
||||
"@swc/core-darwin-arm64@1.15.24":
|
||||
version "1.15.24"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.15.24.tgz#e812659bb23c5a078c05c8b18aad25e9d3a12e39"
|
||||
integrity sha512-uM5ZGfFXjtvtJ+fe448PVBEbn/CSxS3UAyLj3O9xOqKIWy3S6hPTXSPbszxkSsGDYKi+YFhzAsR4r/eXLxEQ0g==
|
||||
"@swc/core-darwin-arm64@1.15.30":
|
||||
version "1.15.30"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.15.30.tgz#23447f1c30c9155fe35602de4392b4ecfa0a54cc"
|
||||
integrity sha512-VvpP+vq08HmGYewMWvrdsxh9s2lthz/808zXm8Yu5kaqeR8Yia2b0eYXleHQ3VAjoStUDk6LzTheBW9KXYQdMA==
|
||||
|
||||
"@swc/core-darwin-x64@1.15.24":
|
||||
version "1.15.24"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.15.24.tgz#99e38bdb00a6975d54471f77c345b4ee9bbb4502"
|
||||
integrity sha512-fMIb/Zfn929pw25VMBhV7Ji2Dl+lCWtUPNdYJQYOke+00E5fcQ9ynxtP8+qhUo/HZc+mYQb1gJxwHM9vty+lXg==
|
||||
"@swc/core-darwin-x64@1.15.30":
|
||||
version "1.15.30"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.15.30.tgz#16e6e35fff5b07c712d8af44783da59ac64ad5cf"
|
||||
integrity sha512-WiJA0hiZI3nwQAO6mu5RqigtWGDtth4Hiq6rbZxAaQyhIcqKIg5IoMRc1Y071lrNJn29eEDMC86Rq58xgUxlDg==
|
||||
|
||||
"@swc/core-linux-arm-gnueabihf@1.15.24":
|
||||
version "1.15.24"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.15.24.tgz#3555ef64268825e4975409b7ed3e9f614e2f9759"
|
||||
integrity sha512-vOkjsyjjxnoYx3hMEWcGxQrMgnNrRm6WAegBXrN8foHtDAR+zpdhpGF5a4lj1bNPgXAvmysjui8cM1ov/Clkaw==
|
||||
"@swc/core-linux-arm-gnueabihf@1.15.30":
|
||||
version "1.15.30"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.15.30.tgz#abce7de734301109a7df23c22f6b6d233e3b9de9"
|
||||
integrity sha512-YANuFUo48kIT6plJgCD0keae9HFXfjxsbvsgevqc0hr/07X/p7sAWTFOGYEc2SXcASaK7UvuQqzlbW8pr7R79g==
|
||||
|
||||
"@swc/core-linux-arm64-gnu@1.15.24":
|
||||
version "1.15.24"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.15.24.tgz#15677103362e56826bb8bc4e15090228f81ef448"
|
||||
integrity sha512-h/oNu+upkXJ6Cicnq7YGVj9PkdfarLCdQa8l/FlHYvfv8CEiMaeeTnpLU7gSBH/rGxosM6Qkfa/J9mThGF9CLA==
|
||||
"@swc/core-linux-arm64-gnu@1.15.30":
|
||||
version "1.15.30"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.15.30.tgz#9a4e418cdbbfe64506dd12469a553c07e1924fef"
|
||||
integrity sha512-VndG8jaR4ugY6u+iVOT0Q+d2fZd7sLgjPgN8W/Le+3EbZKl+cRfFxV7Eoz4gfLqhmneZPdcIzf9T3LkgkmqNLg==
|
||||
|
||||
"@swc/core-linux-arm64-musl@1.15.24":
|
||||
version "1.15.24"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.15.24.tgz#d1655edac4d0101b9c21193770fb8642ced7ef37"
|
||||
integrity sha512-ZpF/pRe1guk6sKzQI9D1jAORtjTdNlyeXn9GDz8ophof/w2WhojRblvSDJaGe7rJjcPN8AaOkhwdRUh7q8oYIg==
|
||||
"@swc/core-linux-arm64-musl@1.15.30":
|
||||
version "1.15.30"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.15.30.tgz#4cd68ccb2af71c3ec539b15aa15c8fd304833d26"
|
||||
integrity sha512-1SYGs2l0Yyyi0pR/P/NKz/x0kqxkoiw+BXeJjLUdecSk/KasncWlJrc6hOvFSgKHOBrzgM5jwuluKtlT8dnrcA==
|
||||
|
||||
"@swc/core-linux-ppc64-gnu@1.15.24":
|
||||
version "1.15.24"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-ppc64-gnu/-/core-linux-ppc64-gnu-1.15.24.tgz#65dc9265686cc24a63d5d8a41a01efe432993181"
|
||||
integrity sha512-QZEsZfisHTSJlmyChgDFNmKPb3W6Lhbfo/O76HhIngfEdnQNmukS38/VSe1feho+xkV5A5hETyCbx3sALBZKAQ==
|
||||
"@swc/core-linux-ppc64-gnu@1.15.30":
|
||||
version "1.15.30"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-ppc64-gnu/-/core-linux-ppc64-gnu-1.15.30.tgz#561997d3c5f392db7e3473cb4bbc43e6d6b1160c"
|
||||
integrity sha512-TXREtiXeRhbfDFbmhnkIsXpKfzbfT73YkV2ZF6w0sfxgjC5zI2ZAbaCOq25qxvegofj2K93DtOpm9RLaBgqR2g==
|
||||
|
||||
"@swc/core-linux-s390x-gnu@1.15.24":
|
||||
version "1.15.24"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-s390x-gnu/-/core-linux-s390x-gnu-1.15.24.tgz#89c575dbfa39fde1d83033bf4d13e1bf93c93f45"
|
||||
integrity sha512-DLdJKVsJgglqQrJBuoUYNmzm3leI7kUZhLbZGHv42onfKsGf6JDS3+bzCUQfte/XOqDjh/tmmn1DR/CF/tCJFw==
|
||||
"@swc/core-linux-s390x-gnu@1.15.30":
|
||||
version "1.15.30"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-s390x-gnu/-/core-linux-s390x-gnu-1.15.30.tgz#d6f1d5dceca794909305584cb69f80dd91820410"
|
||||
integrity sha512-DCR2YYeyd6DQE4OuDhImouuNcjXEiEdnn1Y0DyGteugPEDvVuvYk8Xddi+4o2SgWH6jiW8/I+3emZvbep1NC+g==
|
||||
|
||||
"@swc/core-linux-x64-gnu@1.15.24":
|
||||
version "1.15.24"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.15.24.tgz#5275c0b24b01b26fdb7a1b5da6bd062d94f9581f"
|
||||
integrity sha512-IpLYfposPA/XLxYOKpRfeccl1p5dDa3+okZDHHTchBkXEaVCnq5MADPmIWwIYj1tudt7hORsEHccG5no6IUQRw==
|
||||
"@swc/core-linux-x64-gnu@1.15.30":
|
||||
version "1.15.30"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.15.30.tgz#c3e91c60f265a62cec60145f0d2d931feb1cf41a"
|
||||
integrity sha512-5Pizw3NgfOJ5BJOBK8TIRa59xFW2avESTOBDPTAYwZYa1JNDs+KMF9lUfjJiJLM5HiMs/wPheA9eiT0q9m2AoA==
|
||||
|
||||
"@swc/core-linux-x64-musl@1.15.24":
|
||||
version "1.15.24"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.15.24.tgz#e65e6f0d7215ded63c0711c2284fe13127772209"
|
||||
integrity sha512-JHy3fMSc0t/EPWgo74+OK5TGr51aElnzqfUPaiRf2qJ/BfX5CUCfMiWVBuhI7qmVMBnk1jTRnL/xZnOSHDPLYg==
|
||||
"@swc/core-linux-x64-musl@1.15.30":
|
||||
version "1.15.30"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.15.30.tgz#3fd112e617a951438f73930b514adf19375067fb"
|
||||
integrity sha512-qyqydP/wyH8alcIP4a2hnGSjHLJjm9H7yDFup+CPy9oTahFgLLwnNcv5UHXqO2Qs3AIND+cls5f/Bb6hqpxdgA==
|
||||
|
||||
"@swc/core-win32-arm64-msvc@1.15.24":
|
||||
version "1.15.24"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.15.24.tgz#12dff91f148bc4e2e48d7990f175f108199f6f0d"
|
||||
integrity sha512-Txj+qUH1z2bUd1P3JvwByfjKFti3cptlAxhWgmunBUUxy/IW3CXLZ6l6Gk4liANadKkU71nIU1X30Z5vpMT3BA==
|
||||
"@swc/core-win32-arm64-msvc@1.15.30":
|
||||
version "1.15.30"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.15.30.tgz#d005dce92e4ec1b0a7898667c9cf5e5215e4631c"
|
||||
integrity sha512-CaQENgDHVGOg1mSF5sQVgvfFHG9kjMor2rkLMLeLOkfZYNj13ppnJ9+lfaBZLZUMMbnlGQnavCJb8PVBUOso7Q==
|
||||
|
||||
"@swc/core-win32-ia32-msvc@1.15.24":
|
||||
version "1.15.24"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.15.24.tgz#eb3747533a3c078bfee5d857b086774647506a4a"
|
||||
integrity sha512-15D/nl3XwrhFpMv+MADFOiVwv3FvH9j8c6Rf8EXBT3Q5LoMh8YnDnSgPYqw1JzPnksvsBX6QPXLiPqmcR/Z4qQ==
|
||||
"@swc/core-win32-ia32-msvc@1.15.30":
|
||||
version "1.15.30"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.15.30.tgz#67ebfaa22266835a3d82776014c2f428346062bd"
|
||||
integrity sha512-30VdLeGk6fugiUs/kUdJ/pAg7z/zpvVbR11RH60jZ0Z42WIeIniYx0rLEWN7h/pKJ3CopqsQ3RsogCAkRKiA2g==
|
||||
|
||||
"@swc/core-win32-x64-msvc@1.15.24":
|
||||
version "1.15.24"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.15.24.tgz#a0ad3bb9b8755093efe656299aa167138a589708"
|
||||
integrity sha512-PR0PlTlPra2JbaDphrOAzm6s0v9rA0F17YzB+XbWD95B4g2cWcZY9LAeTa4xll70VLw9Jr7xBrlohqlQmelMFQ==
|
||||
"@swc/core-win32-x64-msvc@1.15.30":
|
||||
version "1.15.30"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.15.30.tgz#cb602b53f9cdcdfb580cecdb02b536339d4b004b"
|
||||
integrity sha512-4iObHPR+Q4oDY110EF5SF5eIaaVJNpMdG9C0q3Q92BsJ5y467uHz7sYQhP60WYlLFsLQ1el2YrIPUItUAQGOKg==
|
||||
|
||||
"@swc/core@^1.15.24", "@swc/core@^1.7.39":
|
||||
version "1.15.24"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.15.24.tgz#258dd1f74c662d9a2535fcfa2aa8ff30fd23883d"
|
||||
integrity sha512-5Hj8aNasue7yusUt8LGCUe/AjM7RMAce8ZoyDyiFwx7Al+GbYKL+yE7g4sJk8vEr1dKIkTRARkNIJENc4CjkBQ==
|
||||
"@swc/core@^1.15.30", "@swc/core@^1.7.39":
|
||||
version "1.15.30"
|
||||
resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.15.30.tgz#2f77d5ed3b0df964aac8aaa251dc43ed822100cc"
|
||||
integrity sha512-R8VQbQY1BZcbIF2p3gjlTCwAQzx1A194ugWfwld5y+WgVVWqVKm7eURGGOVbQVubgKWzidP2agomBbg96rZilQ==
|
||||
dependencies:
|
||||
"@swc/counter" "^0.1.3"
|
||||
"@swc/types" "^0.1.26"
|
||||
optionalDependencies:
|
||||
"@swc/core-darwin-arm64" "1.15.24"
|
||||
"@swc/core-darwin-x64" "1.15.24"
|
||||
"@swc/core-linux-arm-gnueabihf" "1.15.24"
|
||||
"@swc/core-linux-arm64-gnu" "1.15.24"
|
||||
"@swc/core-linux-arm64-musl" "1.15.24"
|
||||
"@swc/core-linux-ppc64-gnu" "1.15.24"
|
||||
"@swc/core-linux-s390x-gnu" "1.15.24"
|
||||
"@swc/core-linux-x64-gnu" "1.15.24"
|
||||
"@swc/core-linux-x64-musl" "1.15.24"
|
||||
"@swc/core-win32-arm64-msvc" "1.15.24"
|
||||
"@swc/core-win32-ia32-msvc" "1.15.24"
|
||||
"@swc/core-win32-x64-msvc" "1.15.24"
|
||||
"@swc/core-darwin-arm64" "1.15.30"
|
||||
"@swc/core-darwin-x64" "1.15.30"
|
||||
"@swc/core-linux-arm-gnueabihf" "1.15.30"
|
||||
"@swc/core-linux-arm64-gnu" "1.15.30"
|
||||
"@swc/core-linux-arm64-musl" "1.15.30"
|
||||
"@swc/core-linux-ppc64-gnu" "1.15.30"
|
||||
"@swc/core-linux-s390x-gnu" "1.15.30"
|
||||
"@swc/core-linux-x64-gnu" "1.15.30"
|
||||
"@swc/core-linux-x64-musl" "1.15.30"
|
||||
"@swc/core-win32-arm64-msvc" "1.15.30"
|
||||
"@swc/core-win32-ia32-msvc" "1.15.30"
|
||||
"@swc/core-win32-x64-msvc" "1.15.30"
|
||||
|
||||
"@swc/counter@^0.1.3":
|
||||
version "0.1.3"
|
||||
@@ -5040,100 +5040,100 @@
|
||||
dependencies:
|
||||
"@types/yargs-parser" "*"
|
||||
|
||||
"@typescript-eslint/eslint-plugin@8.58.2", "@typescript-eslint/eslint-plugin@^8.52.0":
|
||||
version "8.58.2"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.58.2.tgz#a6882a6a328e1259cff259fdb03184245ef06191"
|
||||
integrity sha512-aC2qc5thQahutKjP+cl8cgN9DWe3ZUqVko30CMSZHnFEHyhOYoZSzkGtAI2mcwZ38xeImDucI4dnqsHiOYuuCw==
|
||||
"@typescript-eslint/eslint-plugin@8.59.0", "@typescript-eslint/eslint-plugin@^8.52.0":
|
||||
version "8.59.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.59.0.tgz#fcbe76b693ce2412410cf4d48aefd617d345f2d9"
|
||||
integrity sha512-HyAZtpdkgZwpq8Sz3FSUvCR4c+ScbuWa9AksK2Jweub7w4M3yTz4O11AqVJzLYjy/B9ZWPyc81I+mOdJU/bDQw==
|
||||
dependencies:
|
||||
"@eslint-community/regexpp" "^4.12.2"
|
||||
"@typescript-eslint/scope-manager" "8.58.2"
|
||||
"@typescript-eslint/type-utils" "8.58.2"
|
||||
"@typescript-eslint/utils" "8.58.2"
|
||||
"@typescript-eslint/visitor-keys" "8.58.2"
|
||||
"@typescript-eslint/scope-manager" "8.59.0"
|
||||
"@typescript-eslint/type-utils" "8.59.0"
|
||||
"@typescript-eslint/utils" "8.59.0"
|
||||
"@typescript-eslint/visitor-keys" "8.59.0"
|
||||
ignore "^7.0.5"
|
||||
natural-compare "^1.4.0"
|
||||
ts-api-utils "^2.5.0"
|
||||
|
||||
"@typescript-eslint/parser@8.58.2", "@typescript-eslint/parser@^8.56.1":
|
||||
version "8.58.2"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.58.2.tgz#b267545e4bd515d896fe1f3a5b6f334fa6aa0026"
|
||||
integrity sha512-/Zb/xaIDfxeJnvishjGdcR4jmr7S+bda8PKNhRGdljDM+elXhlvN0FyPSsMnLmJUrVG9aPO6dof80wjMawsASg==
|
||||
"@typescript-eslint/parser@8.59.0", "@typescript-eslint/parser@^8.59.0":
|
||||
version "8.59.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.59.0.tgz#57a138280b3ceaf07904fbd62c433d5cc1ee1573"
|
||||
integrity sha512-TI1XGwKbDpo9tRW8UDIXCOeLk55qe9ZFGs8MTKU6/M08HWTw52DD/IYhfQtOEhEdPhLMT26Ka/x7p70nd3dzDg==
|
||||
dependencies:
|
||||
"@typescript-eslint/scope-manager" "8.58.2"
|
||||
"@typescript-eslint/types" "8.58.2"
|
||||
"@typescript-eslint/typescript-estree" "8.58.2"
|
||||
"@typescript-eslint/visitor-keys" "8.58.2"
|
||||
"@typescript-eslint/scope-manager" "8.59.0"
|
||||
"@typescript-eslint/types" "8.59.0"
|
||||
"@typescript-eslint/typescript-estree" "8.59.0"
|
||||
"@typescript-eslint/visitor-keys" "8.59.0"
|
||||
debug "^4.4.3"
|
||||
|
||||
"@typescript-eslint/project-service@8.58.2":
|
||||
version "8.58.2"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/project-service/-/project-service-8.58.2.tgz#8c980249100e21b87baba0ca10880fdf893e0a8e"
|
||||
integrity sha512-Cq6UfpZZk15+r87BkIh5rDpi38W4b+Sjnb8wQCPPDDweS/LRCFjCyViEbzHk5Ck3f2QDfgmlxqSa7S7clDtlfg==
|
||||
"@typescript-eslint/project-service@8.59.0":
|
||||
version "8.59.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/project-service/-/project-service-8.59.0.tgz#914bf62069d870faa0389ffd725774a200f511bf"
|
||||
integrity sha512-Lw5ITrR5s5TbC19YSvlr63ZfLaJoU6vtKTHyB0GQOpX0W7d5/Ir6vUahWi/8Sps/nOukZQ0IB3SmlxZnjaKVnw==
|
||||
dependencies:
|
||||
"@typescript-eslint/tsconfig-utils" "^8.58.2"
|
||||
"@typescript-eslint/types" "^8.58.2"
|
||||
"@typescript-eslint/tsconfig-utils" "^8.59.0"
|
||||
"@typescript-eslint/types" "^8.59.0"
|
||||
debug "^4.4.3"
|
||||
|
||||
"@typescript-eslint/scope-manager@8.58.2":
|
||||
version "8.58.2"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.58.2.tgz#aa73784d78f117940e83f71705af07ba695cd60c"
|
||||
integrity sha512-SgmyvDPexWETQek+qzZnrG6844IaO02UVyOLhI4wpo82dpZJY9+6YZCKAMFzXb7qhx37mFK1QcPQ18tud+vo6Q==
|
||||
"@typescript-eslint/scope-manager@8.59.0":
|
||||
version "8.59.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.59.0.tgz#f71be268bd31da1c160815c689e4dde7c9bc9e8e"
|
||||
integrity sha512-UzR16Ut8IpA3Mc4DbgAShlPPkVm8xXMWafXxB0BocaVRHs8ZGakAxGRskF7FId3sdk9lgGD73GSFaWmWFDE4dg==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "8.58.2"
|
||||
"@typescript-eslint/visitor-keys" "8.58.2"
|
||||
"@typescript-eslint/types" "8.59.0"
|
||||
"@typescript-eslint/visitor-keys" "8.59.0"
|
||||
|
||||
"@typescript-eslint/tsconfig-utils@8.58.2", "@typescript-eslint/tsconfig-utils@^8.58.2":
|
||||
version "8.58.2"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.58.2.tgz#fa13f96432c9348bf87f6f44826def585fad7bca"
|
||||
integrity sha512-3SR+RukipDvkkKp/d0jP0dyzuls3DbGmwDpVEc5wqk5f38KFThakqAAO0XMirWAE+kT00oTauTbzMFGPoAzB0A==
|
||||
"@typescript-eslint/tsconfig-utils@8.59.0", "@typescript-eslint/tsconfig-utils@^8.59.0":
|
||||
version "8.59.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.59.0.tgz#1276077f5ad77e384446ea28a2474e8f8be1af41"
|
||||
integrity sha512-91Sbl3s4Kb3SybliIY6muFBmHVv+pYXfybC4Oolp3dvk8BvIE3wOPc+403CWIT7mJNkfQRGtdqghzs2+Z91Tqg==
|
||||
|
||||
"@typescript-eslint/type-utils@8.58.2":
|
||||
version "8.58.2"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.58.2.tgz#024eb1dd597f8a34cb22d8d9ab32da857bc9a817"
|
||||
integrity sha512-Z7EloNR/B389FvabdGeTo2XMs4W9TjtPiO9DAsmT0yom0bwlPyRjkJ1uCdW1DvrrrYP50AJZ9Xc3sByZA9+dcg==
|
||||
"@typescript-eslint/type-utils@8.59.0":
|
||||
version "8.59.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.59.0.tgz#2834ea3b179cedfc9244dcd4f74105a27751a439"
|
||||
integrity sha512-3TRiZaQSltGqGeNrJzzr1+8YcEobKH9rHnqIp/1psfKFmhRQDNMGP5hBufanYTGznwShzVLs3Mz+gDN7HkWfXg==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "8.58.2"
|
||||
"@typescript-eslint/typescript-estree" "8.58.2"
|
||||
"@typescript-eslint/utils" "8.58.2"
|
||||
"@typescript-eslint/types" "8.59.0"
|
||||
"@typescript-eslint/typescript-estree" "8.59.0"
|
||||
"@typescript-eslint/utils" "8.59.0"
|
||||
debug "^4.4.3"
|
||||
ts-api-utils "^2.5.0"
|
||||
|
||||
"@typescript-eslint/types@8.58.2", "@typescript-eslint/types@^8.58.2":
|
||||
version "8.58.2"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.58.2.tgz#3ab8051de0f19a46ddefb0749d0f7d82974bd57c"
|
||||
integrity sha512-9TukXyATBQf/Jq9AMQXfvurk+G5R2MwfqQGDR2GzGz28HvY/lXNKGhkY+6IOubwcquikWk5cjlgPvD2uAA7htQ==
|
||||
"@typescript-eslint/types@8.59.0", "@typescript-eslint/types@^8.59.0":
|
||||
version "8.59.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.59.0.tgz#cfcc643c6e879016479775850d86d84c14492738"
|
||||
integrity sha512-nLzdsT1gdOgFxxxwrlNVUBzSNBEEHJ86bblmk4QAS6stfig7rcJzWKqCyxFy3YRRHXDWEkb2NralA1nOYkkm/A==
|
||||
|
||||
"@typescript-eslint/typescript-estree@8.58.2":
|
||||
version "8.58.2"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.58.2.tgz#b1beb1f959385b341cc76f0aebbf028e23dfdb8b"
|
||||
integrity sha512-ELGuoofuhhoCvNbQjFFiobFcGgcDCEm0ThWdmO4Z0UzLqPXS3KFvnEZ+SHewwOYHjM09tkzOWXNTv9u6Gqtyuw==
|
||||
"@typescript-eslint/typescript-estree@8.59.0":
|
||||
version "8.59.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.59.0.tgz#feba58a70ab6ea7ac53a2f3ae900db28ce3454c2"
|
||||
integrity sha512-O9Re9P1BmBLFJyikRbQpLku/QA3/AueZNO9WePLBwQrvkixTmDe8u76B6CYUAITRl/rHawggEqUGn5QIkVRLMw==
|
||||
dependencies:
|
||||
"@typescript-eslint/project-service" "8.58.2"
|
||||
"@typescript-eslint/tsconfig-utils" "8.58.2"
|
||||
"@typescript-eslint/types" "8.58.2"
|
||||
"@typescript-eslint/visitor-keys" "8.58.2"
|
||||
"@typescript-eslint/project-service" "8.59.0"
|
||||
"@typescript-eslint/tsconfig-utils" "8.59.0"
|
||||
"@typescript-eslint/types" "8.59.0"
|
||||
"@typescript-eslint/visitor-keys" "8.59.0"
|
||||
debug "^4.4.3"
|
||||
minimatch "^10.2.2"
|
||||
semver "^7.7.3"
|
||||
tinyglobby "^0.2.15"
|
||||
ts-api-utils "^2.5.0"
|
||||
|
||||
"@typescript-eslint/utils@8.58.2":
|
||||
version "8.58.2"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.58.2.tgz#27165554a02d1ff57d98262fa92060498dabc8b3"
|
||||
integrity sha512-QZfjHNEzPY8+l0+fIXMvuQ2sJlplB4zgDZvA+NmvZsZv3EQwOcc1DuIU1VJUTWZ/RKouBMhDyNaBMx4sWvrzRA==
|
||||
"@typescript-eslint/utils@8.59.0":
|
||||
version "8.59.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.59.0.tgz#f50df9bd6967881ef64fba62230111153179ead5"
|
||||
integrity sha512-I1R/K7V07XsMJ12Oaxg/O9GfrysGTmCRhvZJBv0RE0NcULMzjqVpR5kRRQjHsz3J/bElU7HwCO7zkqL+MSUz+g==
|
||||
dependencies:
|
||||
"@eslint-community/eslint-utils" "^4.9.1"
|
||||
"@typescript-eslint/scope-manager" "8.58.2"
|
||||
"@typescript-eslint/types" "8.58.2"
|
||||
"@typescript-eslint/typescript-estree" "8.58.2"
|
||||
"@typescript-eslint/scope-manager" "8.59.0"
|
||||
"@typescript-eslint/types" "8.59.0"
|
||||
"@typescript-eslint/typescript-estree" "8.59.0"
|
||||
|
||||
"@typescript-eslint/visitor-keys@8.58.2":
|
||||
version "8.58.2"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.58.2.tgz#9ed699eaa9b5720b6b6b6f9c16e6c7d4cd32b276"
|
||||
integrity sha512-f1WO2Lx8a9t8DARmcWAUPJbu0G20bJlj8L4z72K00TMeJAoyLr/tHhI/pzYBLrR4dXWkcxO1cWYZEOX8DKHTqA==
|
||||
"@typescript-eslint/visitor-keys@8.59.0":
|
||||
version "8.59.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.59.0.tgz#2e80de30e7e944ed4bd47d751e37dcb04db03795"
|
||||
integrity sha512-/uejZt4dSere1bx12WLlPfv8GktzcaDtuJ7s42/HEZ5zGj9oxRaD4bj7qwSunXkf+pbAhFt2zjpHYUiT5lHf0Q==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "8.58.2"
|
||||
"@typescript-eslint/types" "8.59.0"
|
||||
eslint-visitor-keys "^5.0.0"
|
||||
|
||||
"@ungap/structured-clone@^1.0.0":
|
||||
@@ -5482,10 +5482,10 @@ ansis@^3.2.0:
|
||||
resolved "https://registry.yarnpkg.com/ansis/-/ansis-3.17.0.tgz#fa8d9c2a93fe7d1177e0c17f9eeb562a58a832d7"
|
||||
integrity sha512-0qWUglt9JEqLFr3w1I1pbrChn1grhaiAR2ocX1PP/flRmxgtwTzPFFFnfIlD6aMOLQZgSuCRlidD70lvx8yhzg==
|
||||
|
||||
antd@^6.3.5:
|
||||
version "6.3.5"
|
||||
resolved "https://registry.yarnpkg.com/antd/-/antd-6.3.5.tgz#3f231e25306c4213925d6476ef9c2ec21cf53b7e"
|
||||
integrity sha512-8BPz9lpZWQm42PTx7yL4KxWAotVuqINiKcoYRcLtdd5BFmAcAZicVyFTnBJyRDlzGZFZeRW3foGu6jXYFnej6Q==
|
||||
antd@^6.3.6:
|
||||
version "6.3.6"
|
||||
resolved "https://registry.yarnpkg.com/antd/-/antd-6.3.6.tgz#e892b851cf45d62201d889fe9cac36f4d2412e5f"
|
||||
integrity sha512-zdCYjusrTUn4gNxEg4PH8MWlfuXYbKfuGOkjgZ0Rg6DpWbIVmG/MwvsZ5yvG6z3Y6UI/gzYpaQ82iTt4KdbeaA==
|
||||
dependencies:
|
||||
"@ant-design/colors" "^8.0.1"
|
||||
"@ant-design/cssinjs" "^2.1.2"
|
||||
@@ -5502,7 +5502,7 @@ antd@^6.3.5:
|
||||
"@rc-component/drawer" "~1.4.2"
|
||||
"@rc-component/dropdown" "~1.0.2"
|
||||
"@rc-component/form" "~1.8.0"
|
||||
"@rc-component/image" "~1.8.0"
|
||||
"@rc-component/image" "~1.9.0"
|
||||
"@rc-component/input" "~1.1.2"
|
||||
"@rc-component/input-number" "~1.6.2"
|
||||
"@rc-component/mentions" "~1.6.0"
|
||||
@@ -5530,7 +5530,7 @@ antd@^6.3.5:
|
||||
"@rc-component/tree-select" "~1.8.0"
|
||||
"@rc-component/trigger" "^3.9.0"
|
||||
"@rc-component/upload" "~1.1.0"
|
||||
"@rc-component/util" "^1.10.0"
|
||||
"@rc-component/util" "^1.10.1"
|
||||
clsx "^2.1.1"
|
||||
dayjs "^1.11.11"
|
||||
scroll-into-view-if-needed "^3.1.0"
|
||||
@@ -5794,10 +5794,10 @@ base64-js@^1.3.1, base64-js@^1.5.1:
|
||||
resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz"
|
||||
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
|
||||
|
||||
baseline-browser-mapping@^2.10.19, baseline-browser-mapping@^2.9.0, baseline-browser-mapping@^2.9.19:
|
||||
version "2.10.19"
|
||||
resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.10.19.tgz#7697721c22f94f66195d0c34299b1a91e3299493"
|
||||
integrity sha512-qCkNLi2sfBOn8XhZQ0FXsT1Ki/Yo5P90hrkRamVFRS7/KV9hpfA4HkoWNU152+8w0zPjnxo5psx5NL3PSGgv5g==
|
||||
baseline-browser-mapping@^2.10.20, baseline-browser-mapping@^2.9.0, baseline-browser-mapping@^2.9.19:
|
||||
version "2.10.20"
|
||||
resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.10.20.tgz#7c99b86d43ae9be3810cac515f4675802e1f6b87"
|
||||
integrity sha512-1AaXxEPfXT+GvTBJFuy4yXVHWJBXa4OdbIebGN/wX5DlsIkU0+wzGnd2lOzokSk51d5LUmqjgBLRLlypLUqInQ==
|
||||
|
||||
batch@0.6.1:
|
||||
version "0.6.1"
|
||||
@@ -6035,10 +6035,10 @@ caniuse-api@^3.0.0:
|
||||
lodash.memoize "^4.1.2"
|
||||
lodash.uniq "^4.5.0"
|
||||
|
||||
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001702, caniuse-lite@^1.0.30001759, caniuse-lite@^1.0.30001788:
|
||||
version "1.0.30001788"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001788.tgz#31e97d1bfec332b3f2d7eea7781460c97629b3bf"
|
||||
integrity sha512-6q8HFp+lOQtcf7wBK+uEenxymVWkGKkjFpCvw5W25cmMwEDU45p1xQFBQv8JDlMMry7eNxyBaR+qxgmTUZkIRQ==
|
||||
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001702, caniuse-lite@^1.0.30001759, caniuse-lite@^1.0.30001790:
|
||||
version "1.0.30001790"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001790.tgz#04660c7de15f445d86dd10ac88a8936ac0698e45"
|
||||
integrity sha512-bOoxfJPyYo+ds6W0YfptaCWbFnJYjh2Y1Eow5lRv+vI2u8ganPZqNm1JwNh0t2ELQCqIWg4B3dWEusgAmsoyOw==
|
||||
|
||||
ccount@^2.0.0:
|
||||
version "2.0.1"
|
||||
@@ -8474,10 +8474,10 @@ globals@^15.14.0:
|
||||
resolved "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz"
|
||||
integrity sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==
|
||||
|
||||
globals@^17.4.0:
|
||||
version "17.4.0"
|
||||
resolved "https://registry.yarnpkg.com/globals/-/globals-17.4.0.tgz#33d7d297ed1536b388a0e2f4bcd0ff19c8ff91b5"
|
||||
integrity sha512-hjrNztw/VajQwOLsMNT1cbJiH2muO3OROCHnbehc8eY5JyD2gqz4AcMHPqgaOR59DjgUjYAYLeH699g/eWi2jw==
|
||||
globals@^17.5.0:
|
||||
version "17.5.0"
|
||||
resolved "https://registry.yarnpkg.com/globals/-/globals-17.5.0.tgz#a82c641d898f8dfbe0e81f66fdff7d0de43f88c6"
|
||||
integrity sha512-qoV+HK2yFl/366t2/Cb3+xxPUo5BuMynomoDmiaZBIdbs+0pYbjfZU+twLhGKp4uCZ/+NbtpVepH5bGCxRyy2g==
|
||||
|
||||
globalthis@^1.0.4:
|
||||
version "1.0.4"
|
||||
@@ -14720,20 +14720,20 @@ types-ramda@^0.30.1:
|
||||
dependencies:
|
||||
ts-toolbelt "^9.6.0"
|
||||
|
||||
typescript-eslint@^8.58.2:
|
||||
version "8.58.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-8.58.2.tgz#55f425fc668c2d5148f45587f2cd04532d715c6a"
|
||||
integrity sha512-V8iSng9mRbdZjl54VJ9NKr6ZB+dW0J3TzRXRGcSbLIej9jV86ZRtlYeTKDR/QLxXykocJ5icNzbsl2+5TzIvcQ==
|
||||
typescript-eslint@^8.59.0:
|
||||
version "8.59.0"
|
||||
resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-8.59.0.tgz#d1cc7c63559ce7116aeb66d35ec9dbe0063379fd"
|
||||
integrity sha512-BU3ONW9X+v90EcCH9ZS6LMackcVtxRLlI3XrYyqZIwVSHIk7Qf7bFw1z0M9Q0IUxhTMZCf8piY9hTYaNEIASrw==
|
||||
dependencies:
|
||||
"@typescript-eslint/eslint-plugin" "8.58.2"
|
||||
"@typescript-eslint/parser" "8.58.2"
|
||||
"@typescript-eslint/typescript-estree" "8.58.2"
|
||||
"@typescript-eslint/utils" "8.58.2"
|
||||
"@typescript-eslint/eslint-plugin" "8.59.0"
|
||||
"@typescript-eslint/parser" "8.59.0"
|
||||
"@typescript-eslint/typescript-estree" "8.59.0"
|
||||
"@typescript-eslint/utils" "8.59.0"
|
||||
|
||||
typescript@~5.9.3:
|
||||
version "5.9.3"
|
||||
resolved "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz"
|
||||
integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==
|
||||
typescript@~6.0.3:
|
||||
version "6.0.3"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-6.0.3.tgz#90251dc007916e972786cb94d74d15b185577d21"
|
||||
integrity sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==
|
||||
|
||||
ufo@^1.5.4:
|
||||
version "1.6.1"
|
||||
|
||||
@@ -89,7 +89,7 @@ dependencies = [
|
||||
"python-dateutil",
|
||||
"python-dotenv", # optional dependencies for Flask but required for Superset, see https://flask.palletsprojects.com/en/stable/installation/#optional-dependencies
|
||||
"pygeohash",
|
||||
"pyarrow>=16.1.0, <19", # before upgrading pyarrow, check that all db dependencies support this, see e.g. https://github.com/apache/superset/pull/34693
|
||||
"pyarrow>=16.1.0, <21", # before upgrading pyarrow, check that all db dependencies support this, see e.g. https://github.com/apache/superset/pull/34693
|
||||
"pyyaml>=6.0.0, <7.0.0",
|
||||
"PyJWT>=2.4.0, <3.0",
|
||||
"redis>=5.0.0, <6.0",
|
||||
@@ -183,6 +183,7 @@ risingwave = ["sqlalchemy-risingwave"]
|
||||
shillelagh = ["shillelagh[all]>=1.4.3, <2"]
|
||||
singlestore = ["sqlalchemy-singlestoredb>=1.1.1, <2"]
|
||||
snowflake = ["snowflake-sqlalchemy>=1.2.4, <2"]
|
||||
sqlite = ["syntaqlite>=0.1.0"]
|
||||
spark = [
|
||||
"pyhive[hive]>=0.6.5;python_version<'3.11'",
|
||||
"pyhive[hive_pure_sasl]>=0.7",
|
||||
@@ -226,6 +227,7 @@ development = [
|
||||
"ruff",
|
||||
"sqloxide",
|
||||
"statsd",
|
||||
"syntaqlite>=0.1.0",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
@@ -238,7 +240,7 @@ combine_as_imports = true
|
||||
include_trailing_comma = true
|
||||
line_length = 88
|
||||
known_first_party = "superset, apache-superset-core, apache-superset-extensions-cli"
|
||||
known_third_party = "alembic, apispec, backoff, celery, click, colorama, cron_descriptor, croniter, cryptography, dateutil, deprecation, flask, flask_appbuilder, flask_babel, flask_caching, flask_compress, flask_jwt_extended, flask_login, flask_migrate, flask_sqlalchemy, flask_talisman, flask_testing, flask_wtf, freezegun, geohash, geopy, holidays, humanize, isodate, jinja2, jwt, markdown, markupsafe, marshmallow, marshmallow-union, msgpack, nh3, numpy, pandas, parameterized, parsedatetime, pgsanity, polyline, prison, progress, pyarrow, sqlalchemy_bigquery, pyhive, pyparsing, pytest, pytest_mock, pytz, redis, requests, selenium, setuptools, shillelagh, simplejson, slack, sqlalchemy, sqlalchemy_utils, typing_extensions, urllib3, werkzeug, wtforms, wtforms_json, yaml"
|
||||
known_third_party = "alembic, apispec, backoff, celery, click, colorama, cron_descriptor, croniter, cryptography, dateutil, deprecation, flask, flask_appbuilder, flask_babel, flask_caching, flask_compress, flask_jwt_extended, flask_login, flask_migrate, flask_sqlalchemy, flask_talisman, flask_testing, flask_wtf, freezegun, geohash, geopy, holidays, humanize, isodate, jinja2, jwt, markdown, markupsafe, marshmallow, marshmallow-union, msgpack, nh3, numpy, pandas, parameterized, parsedatetime, pgsanity, polyline, prison, progress, pyarrow, sqlalchemy_bigquery, pyhive, pyparsing, pytest, pytest_mock, pytz, redis, requests, selenium, setuptools, shillelagh, simplejson, slack, sqlalchemy, sqlalchemy_utils, syntaqlite, typing_extensions, urllib3, werkzeug, wtforms, wtforms_json, yaml"
|
||||
multi_line_output = 3
|
||||
order_by_type = false
|
||||
|
||||
|
||||
@@ -25,6 +25,16 @@ filelock>=3.20.3,<4.0.0
|
||||
# Security: decompression bomb fix (required by aiohttp 3.13.3)
|
||||
brotli>=1.2.0,<2.0.0
|
||||
numexpr>=2.9.0
|
||||
# Security: CVE-2026-34073 (MEDIUM) - Improper Certificate Validation
|
||||
cryptography>=46.0.7,<47.0.0
|
||||
# Security: Snyk - XSS vulnerability in Mako templates
|
||||
mako>=1.3.11,<2.0.0
|
||||
# Security: CVE-2024-52338 (CRITICAL) - Deserialization of untrusted data in IPC/Parquet readers
|
||||
pyarrow>=20.0.0,<21.0.0
|
||||
# Security: CVE-2026-27459 - pyopenssl certificate validation
|
||||
pyopenssl>=26.0.0,<27.0.0
|
||||
# Security: CVE-2026-25645 (MEDIUM) - Insecure Temporary File
|
||||
requests>=2.33.0,<3.0.0
|
||||
|
||||
# 5.0.0 has a sensitive deprecation used in other libs
|
||||
# -> https://github.com/aio-libs/async-timeout/blob/master/CHANGES.rst#500-2024-10-31
|
||||
|
||||
@@ -86,8 +86,9 @@ cron-descriptor==1.4.5
|
||||
# via apache-superset (pyproject.toml)
|
||||
croniter==6.0.0
|
||||
# via apache-superset (pyproject.toml)
|
||||
cryptography==46.0.6
|
||||
cryptography==46.0.7
|
||||
# via
|
||||
# -r requirements/base.in
|
||||
# apache-superset (pyproject.toml)
|
||||
# paramiko
|
||||
# pyopenssl
|
||||
@@ -205,8 +206,9 @@ kombu==5.5.3
|
||||
# via celery
|
||||
limits==5.1.0
|
||||
# via flask-limiter
|
||||
mako==1.3.10
|
||||
mako==1.3.11
|
||||
# via
|
||||
# -r requirements/base.in
|
||||
# apache-superset (pyproject.toml)
|
||||
# alembic
|
||||
markdown==3.8.1
|
||||
@@ -291,8 +293,10 @@ prison==0.2.1
|
||||
# via flask-appbuilder
|
||||
prompt-toolkit==3.0.51
|
||||
# via click-repl
|
||||
pyarrow==16.1.0
|
||||
# via apache-superset (pyproject.toml)
|
||||
pyarrow==20.0.0
|
||||
# via
|
||||
# -r requirements/base.in
|
||||
# apache-superset (pyproject.toml)
|
||||
pyasn1==0.6.3
|
||||
# via
|
||||
# pyasn1-modules
|
||||
@@ -319,8 +323,10 @@ pyjwt==2.12.0
|
||||
# redis
|
||||
pynacl==1.6.2
|
||||
# via paramiko
|
||||
pyopenssl==25.3.0
|
||||
# via shillelagh
|
||||
pyopenssl==26.0.0
|
||||
# via
|
||||
# -r requirements/base.in
|
||||
# shillelagh
|
||||
pyparsing==3.2.3
|
||||
# via apache-superset (pyproject.toml)
|
||||
pysocks==1.7.1
|
||||
@@ -353,8 +359,9 @@ referencing==0.36.2
|
||||
# via
|
||||
# jsonschema
|
||||
# jsonschema-specifications
|
||||
requests==2.32.4
|
||||
requests==2.33.0
|
||||
# via
|
||||
# -r requirements/base.in
|
||||
# requests-cache
|
||||
# shillelagh
|
||||
requests-cache==1.2.1
|
||||
|
||||
@@ -178,7 +178,7 @@ croniter==6.0.0
|
||||
# via
|
||||
# -c requirements/base-constraint.txt
|
||||
# apache-superset
|
||||
cryptography==46.0.6
|
||||
cryptography==46.0.7
|
||||
# via
|
||||
# -c requirements/base-constraint.txt
|
||||
# apache-superset
|
||||
@@ -503,7 +503,7 @@ limits==5.1.0
|
||||
# via
|
||||
# -c requirements/base-constraint.txt
|
||||
# flask-limiter
|
||||
mako==1.3.10
|
||||
mako==1.3.11
|
||||
# via
|
||||
# -c requirements/base-constraint.txt
|
||||
# alembic
|
||||
@@ -710,7 +710,7 @@ psycopg2-binary==2.9.9
|
||||
# via apache-superset
|
||||
py-key-value-aio==0.4.4
|
||||
# via fastmcp
|
||||
pyarrow==16.1.0
|
||||
pyarrow==20.0.0
|
||||
# via
|
||||
# -c requirements/base-constraint.txt
|
||||
# apache-superset
|
||||
@@ -778,7 +778,7 @@ pynacl==1.6.2
|
||||
# via
|
||||
# -c requirements/base-constraint.txt
|
||||
# paramiko
|
||||
pyopenssl==25.3.0
|
||||
pyopenssl==26.0.0
|
||||
# via
|
||||
# -c requirements/base-constraint.txt
|
||||
# shillelagh
|
||||
@@ -865,7 +865,7 @@ referencing==0.36.2
|
||||
# jsonschema
|
||||
# jsonschema-path
|
||||
# jsonschema-specifications
|
||||
requests==2.32.4
|
||||
requests==2.33.0
|
||||
# via
|
||||
# -c requirements/base-constraint.txt
|
||||
# docker
|
||||
@@ -992,6 +992,8 @@ starlette==0.49.1
|
||||
# via mcp
|
||||
statsd==4.0.1
|
||||
# via apache-superset
|
||||
syntaqlite==0.1.0
|
||||
# via apache-superset
|
||||
tabulate==0.9.0
|
||||
# via
|
||||
# -c requirements/base-constraint.txt
|
||||
|
||||
@@ -33,6 +33,33 @@
|
||||
// - No FontAwesome icons (use Icons component)
|
||||
// - No template variables in i18n (use parameterized messages)
|
||||
|
||||
// === Rules carried over from ESLint that oxlint does NOT implement ===
|
||||
// oxlint 1.58+ errors on unknown builtin rules, so these can no longer
|
||||
// be listed in this config. They were silently dropped in earlier
|
||||
// oxlint versions (not actually enforced). Documented here for future
|
||||
// maintainers — if/when oxlint adds them, re-enable in the relevant
|
||||
// plugin section above.
|
||||
// import: newline-after-import, no-extraneous-dependencies,
|
||||
// no-import-module-exports, no-relative-packages,
|
||||
// no-unresolved, no-useless-path-segments
|
||||
// react: default-props-match-prop-types, destructuring-assignment,
|
||||
// forbid-component-props, forbid-foreign-prop-types,
|
||||
// forbid-prop-types, function-component-definition,
|
||||
// jsx-no-bind, jsx-uses-vars, no-access-state-in-setstate,
|
||||
// no-deprecated, no-did-update-set-state, no-typos,
|
||||
// no-unstable-nested-components,
|
||||
// no-unused-class-component-methods, no-unused-prop-types,
|
||||
// no-unused-state, prefer-stateless-function, prop-types,
|
||||
// require-default-props, sort-comp, static-property-placement
|
||||
// (prefer-stateless-function / function-component-definition
|
||||
// are represented by react/prefer-function-component below)
|
||||
// jsx-a11y: interactive-supports-focus,
|
||||
// no-interactive-element-to-noninteractive-role,
|
||||
// no-noninteractive-element-interactions,
|
||||
// no-noninteractive-element-to-interactive-role
|
||||
// typescript: naming-convention
|
||||
// unicorn: prevent-abbreviations
|
||||
|
||||
// === Core ESLint rules ===
|
||||
// Error prevention
|
||||
"no-console": "warn",
|
||||
@@ -89,7 +116,6 @@
|
||||
"no-object-constructor": "error",
|
||||
|
||||
// === Import plugin rules ===
|
||||
"import/no-unresolved": "error",
|
||||
// TODO: Fix incorrect named imports in Storybook and other files
|
||||
"import/named": "warn",
|
||||
// TODO: Fix duplicate exports in shared-controls and other modules
|
||||
@@ -105,56 +131,24 @@
|
||||
"import/first": "error",
|
||||
// TODO: Consolidate duplicate imports in DatasetList and other files
|
||||
"import/no-duplicates": "warn",
|
||||
"import/newline-after-import": "error",
|
||||
"import/no-absolute-path": "error",
|
||||
"import/no-dynamic-require": "error",
|
||||
"import/no-webpack-loader-syntax": "error",
|
||||
"import/no-self-import": "error",
|
||||
"import/no-cycle": "off",
|
||||
"import/no-useless-path-segments": ["error", { "commonjs": true }],
|
||||
"import/prefer-default-export": "off",
|
||||
"import/no-relative-packages": "off",
|
||||
"import/no-import-module-exports": "off",
|
||||
"import/no-extraneous-dependencies": [
|
||||
"error",
|
||||
{
|
||||
"devDependencies": [
|
||||
"test/**",
|
||||
"tests/**",
|
||||
"spec/**",
|
||||
"**/__tests__/**",
|
||||
"**/__mocks__/**",
|
||||
"*.test.{js,jsx,ts,tsx}",
|
||||
"*.spec.{js,jsx,ts,tsx}",
|
||||
"**/*.test.{js,jsx,ts,tsx}",
|
||||
"**/*.spec.{js,jsx,ts,tsx}",
|
||||
"**/jest.config.js",
|
||||
"**/jest.setup.js",
|
||||
"**/webpack.config.js",
|
||||
"**/webpack.config.*.js",
|
||||
"**/.eslintrc.js"
|
||||
],
|
||||
"optionalDependencies": false
|
||||
}
|
||||
],
|
||||
|
||||
// === React plugin rules ===
|
||||
"react/prop-types": "off",
|
||||
"react/require-default-props": "off",
|
||||
"react/forbid-prop-types": "off",
|
||||
"react/forbid-component-props": "warn",
|
||||
"react/jsx-filename-extension": [
|
||||
"warn",
|
||||
{ "extensions": [".jsx", ".tsx"] }
|
||||
],
|
||||
"react/jsx-fragments": "error",
|
||||
"react/jsx-no-bind": "off",
|
||||
"react/jsx-props-no-spreading": "off",
|
||||
"react/jsx-boolean-value": ["error", "never", { "always": [] }],
|
||||
"react/jsx-no-duplicate-props": "error",
|
||||
"react/jsx-no-undef": "error",
|
||||
"react/jsx-pascal-case": ["error", { "allowAllCaps": true, "ignore": [] }],
|
||||
"react/jsx-uses-vars": "error",
|
||||
"react/jsx-no-target-blank": ["error", { "enforceDynamicLinks": "always" }],
|
||||
"react/jsx-no-comment-textnodes": "error",
|
||||
"react/jsx-no-useless-fragment": "off",
|
||||
@@ -165,40 +159,27 @@
|
||||
"react/no-array-index-key": "off",
|
||||
"react/no-children-prop": "error",
|
||||
"react/no-danger": "error",
|
||||
"react/forbid-foreign-prop-types": "error",
|
||||
"react/no-danger-with-children": "error",
|
||||
"react/no-deprecated": "error",
|
||||
"react/no-did-update-set-state": "error",
|
||||
"react/no-find-dom-node": "error",
|
||||
"react/no-is-mounted": "error",
|
||||
"react/no-render-return-value": "error",
|
||||
"react/no-string-refs": "off",
|
||||
"react/no-unescaped-entities": "off",
|
||||
"react/no-unknown-property": "off",
|
||||
"react/no-unused-prop-types": "off",
|
||||
"react/no-unused-state": "error",
|
||||
"react/no-will-update-set-state": "error",
|
||||
"react/prefer-es6-class": ["error", "always"],
|
||||
"react/prefer-stateless-function": [
|
||||
"error",
|
||||
{ "ignorePureComponents": true }
|
||||
],
|
||||
"react/require-render-return": "error",
|
||||
"react/self-closing-comp": "error",
|
||||
"react/void-dom-elements-no-children": "error",
|
||||
"react/no-access-state-in-setstate": "error",
|
||||
"react/no-redundant-should-component-update": "error",
|
||||
"react/no-this-in-sfc": "error",
|
||||
"react/no-typos": "error",
|
||||
"react/no-unstable-nested-components": "off",
|
||||
"react/no-unused-class-component-methods": "off",
|
||||
"react/destructuring-assignment": "off",
|
||||
"react/sort-comp": "off",
|
||||
"react/state-in-constructor": "off",
|
||||
"react/static-property-placement": "off",
|
||||
"react/react-in-jsx-scope": "off",
|
||||
"react/function-component-definition": "off",
|
||||
"react/default-props-match-prop-types": "off",
|
||||
// Successor to the ESLint-era `react/prefer-stateless-function` and
|
||||
// `react/function-component-definition` rules. Disabled because the
|
||||
// codebase still contains legacy class components; flip to "error"
|
||||
// once the class-to-function migration completes.
|
||||
"react/prefer-function-component": "off",
|
||||
"react/button-has-type": [
|
||||
"error",
|
||||
{ "button": true, "submit": true, "reset": false }
|
||||
@@ -223,7 +204,6 @@
|
||||
"jsx-a11y/html-has-lang": "error",
|
||||
"jsx-a11y/iframe-has-title": "error",
|
||||
"jsx-a11y/img-redundant-alt": "error",
|
||||
"jsx-a11y/interactive-supports-focus": "error",
|
||||
"jsx-a11y/label-has-associated-control": "error",
|
||||
"jsx-a11y/lang": "error",
|
||||
"jsx-a11y/media-has-caption": "error",
|
||||
@@ -231,9 +211,6 @@
|
||||
"jsx-a11y/no-access-key": "error",
|
||||
"jsx-a11y/no-autofocus": ["error", { "ignoreNonDOM": true }],
|
||||
"jsx-a11y/no-distracting-elements": "error",
|
||||
"jsx-a11y/no-interactive-element-to-noninteractive-role": "error",
|
||||
"jsx-a11y/no-noninteractive-element-interactions": "error",
|
||||
"jsx-a11y/no-noninteractive-element-to-interactive-role": "error",
|
||||
"jsx-a11y/no-noninteractive-tabindex": "error",
|
||||
"jsx-a11y/no-redundant-roles": "error",
|
||||
"jsx-a11y/no-static-element-interactions": "off",
|
||||
@@ -253,17 +230,6 @@
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||
"@typescript-eslint/no-unused-vars": "warn",
|
||||
"@typescript-eslint/prefer-optional-chain": "error",
|
||||
"@typescript-eslint/naming-convention": [
|
||||
"error",
|
||||
{
|
||||
"selector": "enum",
|
||||
"format": ["PascalCase"]
|
||||
},
|
||||
{
|
||||
"selector": "enumMember",
|
||||
"format": ["PascalCase"]
|
||||
}
|
||||
],
|
||||
|
||||
// === Unicorn rules (bonus coverage) ===
|
||||
"unicorn/no-new-array": "error",
|
||||
@@ -279,7 +245,6 @@
|
||||
"unicorn/prefer-negative-index": "error",
|
||||
"unicorn/prefer-math-trunc": "error",
|
||||
"unicorn/filename-case": "off",
|
||||
"unicorn/prevent-abbreviations": "off",
|
||||
"unicorn/no-null": "off",
|
||||
"unicorn/no-array-reduce": "off",
|
||||
"unicorn/no-array-for-each": "off",
|
||||
|
||||
1330
superset-frontend/package-lock.json
generated
1330
superset-frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -154,8 +154,8 @@
|
||||
"@visx/scale": "^3.5.0",
|
||||
"@visx/tooltip": "^3.0.0",
|
||||
"@visx/xychart": "^3.5.1",
|
||||
"ag-grid-community": "35.0.1",
|
||||
"ag-grid-react": "35.0.1",
|
||||
"ag-grid-community": "35.2.1",
|
||||
"ag-grid-react": "35.2.1",
|
||||
"antd": "^5.26.0",
|
||||
"chrono-node": "^2.9.0",
|
||||
"classnames": "^2.2.5",
|
||||
@@ -170,9 +170,9 @@
|
||||
"fs-extra": "^11.3.4",
|
||||
"fuse.js": "^7.3.0",
|
||||
"geolib": "^3.3.14",
|
||||
"geostyler": "^18.3.1",
|
||||
"geostyler": "^18.5.0",
|
||||
"geostyler-data": "^1.1.0",
|
||||
"geostyler-openlayers-parser": "^5.4.1",
|
||||
"geostyler-openlayers-parser": "^5.7.0",
|
||||
"geostyler-style": "11.0.2",
|
||||
"geostyler-wfs-parser": "^3.0.1",
|
||||
"google-auth-library": "^10.6.2",
|
||||
@@ -183,20 +183,20 @@
|
||||
"json-bigint": "^1.0.0",
|
||||
"json-stringify-pretty-compact": "^2.0.0",
|
||||
"lodash": "^4.18.1",
|
||||
"mapbox-gl": "^3.20.0",
|
||||
"markdown-to-jsx": "^9.7.15",
|
||||
"mapbox-gl": "^3.22.0",
|
||||
"markdown-to-jsx": "^9.7.16",
|
||||
"match-sorter": "^8.2.0",
|
||||
"memoize-one": "^5.2.1",
|
||||
"mousetrap": "^1.6.5",
|
||||
"mustache": "^4.2.0",
|
||||
"nanoid": "^5.1.7",
|
||||
"nanoid": "^5.1.9",
|
||||
"ol": "^10.8.0",
|
||||
"pretty-ms": "^9.3.0",
|
||||
"query-string": "9.3.1",
|
||||
"re-resizable": "^6.11.2",
|
||||
"react": "^17.0.2",
|
||||
"react-arborist": "^3.4.3",
|
||||
"react-checkbox-tree": "^1.8.0",
|
||||
"react-arborist": "^3.5.0",
|
||||
"react-checkbox-tree": "^2.0.1",
|
||||
"react-diff-viewer-continued": "^4.2.0",
|
||||
"react-dnd": "^11.1.3",
|
||||
"react-dnd-html5-backend": "^11.1.3",
|
||||
@@ -230,7 +230,7 @@
|
||||
"use-event-callback": "^0.1.0",
|
||||
"use-immer": "^0.11.0",
|
||||
"use-query-params": "^2.2.2",
|
||||
"uuid": "^13.0.0",
|
||||
"uuid": "^14.0.0",
|
||||
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
|
||||
"yargs": "^17.7.2"
|
||||
},
|
||||
@@ -258,19 +258,19 @@
|
||||
"@mihkeleidast/storybook-addon-source": "^1.0.1",
|
||||
"@playwright/test": "^1.59.1",
|
||||
"@pmmmwh/react-refresh-webpack-plugin": "^0.6.2",
|
||||
"@storybook/addon-actions": "^8.6.17",
|
||||
"@storybook/addon-controls": "^8.6.17",
|
||||
"@storybook/addon-essentials": "^8.6.17",
|
||||
"@storybook/addon-links": "^8.6.17",
|
||||
"@storybook/addon-mdx-gfm": "^8.6.17",
|
||||
"@storybook/components": "^8.6.17",
|
||||
"@storybook/preview-api": "^8.6.17",
|
||||
"@storybook/react": "^8.6.17",
|
||||
"@storybook/react-webpack5": "^8.6.17",
|
||||
"@storybook/test": "^8.6.15",
|
||||
"@storybook/addon-actions": "^8.6.18",
|
||||
"@storybook/addon-controls": "^8.6.18",
|
||||
"@storybook/addon-essentials": "^8.6.18",
|
||||
"@storybook/addon-links": "^8.6.18",
|
||||
"@storybook/addon-mdx-gfm": "^8.6.18",
|
||||
"@storybook/components": "^8.6.18",
|
||||
"@storybook/preview-api": "^8.6.18",
|
||||
"@storybook/react": "^8.6.18",
|
||||
"@storybook/react-webpack5": "^8.6.18",
|
||||
"@storybook/test": "^8.6.18",
|
||||
"@storybook/test-runner": "^0.17.0",
|
||||
"@svgr/webpack": "^8.1.0",
|
||||
"@swc/core": "^1.15.24",
|
||||
"@swc/core": "^1.15.30",
|
||||
"@swc/plugin-emotion": "^14.8.0",
|
||||
"@swc/plugin-transform-imports": "^12.5.0",
|
||||
"@testing-library/dom": "^8.20.1",
|
||||
@@ -281,6 +281,7 @@
|
||||
"@types/content-disposition": "^0.5.9",
|
||||
"@types/dom-to-image": "^2.6.7",
|
||||
"@types/jest": "^30.0.0",
|
||||
"@types/jquery": "^4.0.0",
|
||||
"@types/js-levenshtein": "^1.1.3",
|
||||
"@types/json-bigint": "^1.0.4",
|
||||
"@types/mousetrap": "^1.6.15",
|
||||
@@ -305,7 +306,7 @@
|
||||
"babel-plugin-dynamic-import-node": "^2.3.3",
|
||||
"babel-plugin-jsx-remove-data-test-id": "^3.0.0",
|
||||
"babel-plugin-lodash": "^3.3.4",
|
||||
"baseline-browser-mapping": "^2.10.16",
|
||||
"baseline-browser-mapping": "^2.10.21",
|
||||
"cheerio": "1.2.0",
|
||||
"concurrently": "^9.2.1",
|
||||
"copy-webpack-plugin": "^14.0.0",
|
||||
@@ -325,7 +326,7 @@
|
||||
"eslint-plugin-no-only-tests": "^3.3.0",
|
||||
"eslint-plugin-prettier": "^5.5.5",
|
||||
"eslint-plugin-react-prefer-function-component": "^5.0.0",
|
||||
"eslint-plugin-react-you-might-not-need-an-effect": "^0.9.2",
|
||||
"eslint-plugin-react-you-might-not-need-an-effect": "^0.9.3",
|
||||
"eslint-plugin-storybook": "^0.8.0",
|
||||
"eslint-plugin-testing-library": "^7.16.2",
|
||||
"eslint-plugin-theme-colors": "file:eslint-rules/eslint-plugin-theme-colors",
|
||||
@@ -345,9 +346,9 @@
|
||||
"lightningcss": "^1.32.0",
|
||||
"mini-css-extract-plugin": "^2.10.2",
|
||||
"open-cli": "^9.0.0",
|
||||
"oxlint": "^1.56.0",
|
||||
"oxlint": "^1.61.0",
|
||||
"po2json": "^0.4.5",
|
||||
"prettier": "3.8.2",
|
||||
"prettier": "3.8.3",
|
||||
"prettier-plugin-packagejson": "^3.0.2",
|
||||
"process": "^0.11.10",
|
||||
"react-refresh": "^0.18.0",
|
||||
@@ -356,7 +357,7 @@
|
||||
"source-map": "^0.7.6",
|
||||
"source-map-support": "^0.5.21",
|
||||
"speed-measure-webpack-plugin": "^1.6.0",
|
||||
"storybook": "8.6.17",
|
||||
"storybook": "8.6.18",
|
||||
"style-loader": "^4.0.0",
|
||||
"swc-loader": "^0.2.7",
|
||||
"terser-webpack-plugin": "^5.4.0",
|
||||
@@ -368,7 +369,7 @@
|
||||
"unzipper": "^0.12.3",
|
||||
"vm-browserify": "^1.1.2",
|
||||
"wait-on": "^9.0.5",
|
||||
"webpack": "^5.106.0",
|
||||
"webpack": "^5.106.2",
|
||||
"webpack-bundle-analyzer": "^5.3.0",
|
||||
"webpack-cli": "^6.0.1",
|
||||
"webpack-dev-server": "^5.2.3",
|
||||
|
||||
@@ -23,7 +23,7 @@ import { ControlPanelSectionConfig } from '../types';
|
||||
import { formatSelectOptions } from '../utils';
|
||||
|
||||
export const TITLE_MARGIN_OPTIONS: number[] = [
|
||||
0, 15, 30, 50, 75, 100, 125, 150, 200,
|
||||
0, 15, 30, 40, 50, 75, 100, 125, 150, 200,
|
||||
];
|
||||
export const TITLE_POSITION_OPTIONS: [string, string][] = [
|
||||
['Left', t('Left')],
|
||||
@@ -56,7 +56,7 @@ export const titleControls: ControlPanelSectionConfig = {
|
||||
clearable: true,
|
||||
label: t('X Axis Title Margin'),
|
||||
renderTrigger: true,
|
||||
default: TITLE_MARGIN_OPTIONS[0],
|
||||
default: TITLE_MARGIN_OPTIONS[3],
|
||||
choices: formatSelectOptions(TITLE_MARGIN_OPTIONS),
|
||||
},
|
||||
},
|
||||
@@ -82,7 +82,7 @@ export const titleControls: ControlPanelSectionConfig = {
|
||||
clearable: true,
|
||||
label: t('Y Axis Title Margin'),
|
||||
renderTrigger: true,
|
||||
default: TITLE_MARGIN_OPTIONS[0],
|
||||
default: TITLE_MARGIN_OPTIONS[4],
|
||||
choices: formatSelectOptions(TITLE_MARGIN_OPTIONS),
|
||||
},
|
||||
},
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
"@types/json-bigint": "^1.0.4",
|
||||
"@visx/responsive": "^3.12.0",
|
||||
"ace-builds": "^1.43.6",
|
||||
"ag-grid-community": "35.0.1",
|
||||
"ag-grid-react": "35.0.1",
|
||||
"ag-grid-community": "35.2.1",
|
||||
"ag-grid-react": "35.2.1",
|
||||
"brace": "^0.11.1",
|
||||
"classnames": "^2.5.1",
|
||||
"core-js": "^3.49.0",
|
||||
@@ -56,7 +56,7 @@
|
||||
"react-js-cron": "^5.2.0",
|
||||
"react-markdown": "^8.0.7",
|
||||
"react-resize-detector": "^7.1.2",
|
||||
"react-syntax-highlighter": "^16.1.0",
|
||||
"react-syntax-highlighter": "^16.1.1",
|
||||
"react-ultimate-pagination": "^1.3.2",
|
||||
"regenerator-runtime": "^0.14.1",
|
||||
"rehype-raw": "^7.0.0",
|
||||
@@ -74,7 +74,7 @@
|
||||
"@types/d3-scale": "^2.1.1",
|
||||
"@types/d3-time": "^3.0.4",
|
||||
"@types/d3-time-format": "^4.0.3",
|
||||
"@types/jquery": "^3.5.33",
|
||||
"@types/jquery": "^4.0.0",
|
||||
"@types/lodash": "^4.17.24",
|
||||
"@types/node": "^25.6.0",
|
||||
"@types/prop-types": "^15.7.15",
|
||||
@@ -85,7 +85,7 @@
|
||||
"fetch-mock": "^12.6.0",
|
||||
"jest-mock-console": "^2.0.0",
|
||||
"resize-observer-polyfill": "1.5.1",
|
||||
"timezone-mock": "1.4.0"
|
||||
"timezone-mock": "^1.4.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@emotion/cache": "^11.4.0",
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { PureComponent, ReactNode } from 'react';
|
||||
import { memo, ReactNode } from 'react';
|
||||
|
||||
import { isDefined } from '../utils';
|
||||
|
||||
@@ -29,7 +29,7 @@ type Props = {
|
||||
contentWidth?: number;
|
||||
contentHeight?: number;
|
||||
height: number;
|
||||
renderContent: ({
|
||||
renderContent?: ({
|
||||
height,
|
||||
width,
|
||||
}: {
|
||||
@@ -39,36 +39,35 @@ type Props = {
|
||||
width: number;
|
||||
};
|
||||
|
||||
export default class ChartFrame extends PureComponent<Props, {}> {
|
||||
static defaultProps = {
|
||||
renderContent() {},
|
||||
};
|
||||
function ChartFrame({
|
||||
contentWidth,
|
||||
contentHeight,
|
||||
width,
|
||||
height,
|
||||
renderContent = () => null,
|
||||
}: Props) {
|
||||
const overflowX = checkNumber(contentWidth) && contentWidth > width;
|
||||
const overflowY = checkNumber(contentHeight) && contentHeight > height;
|
||||
|
||||
render() {
|
||||
const { contentWidth, contentHeight, width, height, renderContent } =
|
||||
this.props;
|
||||
|
||||
const overflowX = checkNumber(contentWidth) && contentWidth > width;
|
||||
const overflowY = checkNumber(contentHeight) && contentHeight > height;
|
||||
|
||||
if (overflowX || overflowY) {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
height,
|
||||
overflowX: overflowX ? 'auto' : 'hidden',
|
||||
overflowY: overflowY ? 'auto' : 'hidden',
|
||||
width,
|
||||
}}
|
||||
>
|
||||
{renderContent({
|
||||
height: Math.max(contentHeight ?? 0, height),
|
||||
width: Math.max(contentWidth ?? 0, width),
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return renderContent({ height, width });
|
||||
if (overflowX || overflowY) {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
height,
|
||||
overflowX: overflowX ? 'auto' : 'hidden',
|
||||
overflowY: overflowY ? 'auto' : 'hidden',
|
||||
width,
|
||||
}}
|
||||
>
|
||||
{renderContent({
|
||||
height: Math.max(contentHeight ?? 0, height),
|
||||
width: Math.max(contentWidth ?? 0, width),
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return <>{renderContent({ height, width })}</>;
|
||||
}
|
||||
|
||||
export default memo(ChartFrame);
|
||||
|
||||
@@ -17,26 +17,19 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { CSSProperties, ReactNode, PureComponent } from 'react';
|
||||
import { CSSProperties, ReactNode, memo, useMemo } from 'react';
|
||||
import { ParentSize } from '@visx/responsive';
|
||||
|
||||
const defaultProps = {
|
||||
className: '',
|
||||
height: 'auto' as number | string,
|
||||
position: 'top',
|
||||
width: 'auto' as number | string,
|
||||
};
|
||||
|
||||
type Props = {
|
||||
className: string;
|
||||
className?: string;
|
||||
debounceTime?: number;
|
||||
width: number | string;
|
||||
height: number | string;
|
||||
width?: number | string;
|
||||
height?: number | string;
|
||||
legendJustifyContent?: 'center' | 'flex-start' | 'flex-end';
|
||||
position: 'top' | 'left' | 'bottom' | 'right';
|
||||
position?: 'top' | 'left' | 'bottom' | 'right';
|
||||
renderChart: (dim: { width: number; height: number }) => ReactNode;
|
||||
renderLegend?: (params: { direction: string }) => ReactNode;
|
||||
} & Readonly<typeof defaultProps>;
|
||||
};
|
||||
|
||||
const LEGEND_STYLE_BASE: CSSProperties = {
|
||||
display: 'flex',
|
||||
@@ -52,95 +45,101 @@ const CHART_STYLE_BASE: CSSProperties = {
|
||||
position: 'relative',
|
||||
};
|
||||
|
||||
class WithLegend extends PureComponent<Props, {}> {
|
||||
static defaultProps = defaultProps;
|
||||
|
||||
getContainerDirection(): CSSProperties['flexDirection'] {
|
||||
const { position } = this.props;
|
||||
|
||||
if (position === 'left') {
|
||||
return 'row';
|
||||
}
|
||||
if (position === 'right') {
|
||||
return 'row-reverse';
|
||||
}
|
||||
if (position === 'bottom') {
|
||||
return 'column-reverse';
|
||||
}
|
||||
|
||||
return 'column';
|
||||
function getContainerDirection(
|
||||
position: Props['position'],
|
||||
): CSSProperties['flexDirection'] {
|
||||
if (position === 'left') {
|
||||
return 'row';
|
||||
}
|
||||
if (position === 'right') {
|
||||
return 'row-reverse';
|
||||
}
|
||||
if (position === 'bottom') {
|
||||
return 'column-reverse';
|
||||
}
|
||||
|
||||
getLegendJustifyContent() {
|
||||
const { legendJustifyContent, position } = this.props;
|
||||
if (legendJustifyContent) {
|
||||
return legendJustifyContent;
|
||||
}
|
||||
|
||||
if (position === 'left' || position === 'right') {
|
||||
return 'flex-start';
|
||||
}
|
||||
|
||||
return 'flex-end';
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
className,
|
||||
debounceTime,
|
||||
width,
|
||||
height,
|
||||
position,
|
||||
renderChart,
|
||||
renderLegend,
|
||||
} = this.props;
|
||||
|
||||
const isHorizontal = position === 'left' || position === 'right';
|
||||
|
||||
const style: CSSProperties = {
|
||||
display: 'flex',
|
||||
flexDirection: this.getContainerDirection(),
|
||||
height,
|
||||
width,
|
||||
};
|
||||
|
||||
const chartStyle: CSSProperties = { ...CHART_STYLE_BASE };
|
||||
if (isHorizontal) {
|
||||
chartStyle.width = 0;
|
||||
} else {
|
||||
chartStyle.height = 0;
|
||||
}
|
||||
|
||||
const legendDirection = isHorizontal ? 'column' : 'row';
|
||||
const legendStyle: CSSProperties = {
|
||||
...LEGEND_STYLE_BASE,
|
||||
flexDirection: legendDirection,
|
||||
justifyContent: this.getLegendJustifyContent(),
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={`with-legend ${className}`} style={style}>
|
||||
{renderLegend && (
|
||||
<div className="legend-container" style={legendStyle}>
|
||||
{renderLegend({
|
||||
// Pass flexDirection for @vx/legend to arrange legend items
|
||||
direction: legendDirection,
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
<div className="main-container" style={chartStyle}>
|
||||
<ParentSize debounceTime={debounceTime}>
|
||||
{(parent: { width: number; height: number }) =>
|
||||
parent.width > 0 && parent.height > 0
|
||||
? // Only render when necessary
|
||||
renderChart(parent)
|
||||
: null
|
||||
}
|
||||
</ParentSize>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return 'column';
|
||||
}
|
||||
|
||||
export default WithLegend;
|
||||
function getLegendJustifyContent(
|
||||
legendJustifyContent: Props['legendJustifyContent'],
|
||||
position: Props['position'],
|
||||
) {
|
||||
if (legendJustifyContent) {
|
||||
return legendJustifyContent;
|
||||
}
|
||||
|
||||
if (position === 'left' || position === 'right') {
|
||||
return 'flex-start';
|
||||
}
|
||||
|
||||
return 'flex-end';
|
||||
}
|
||||
|
||||
function WithLegend({
|
||||
className = '',
|
||||
debounceTime,
|
||||
width = 'auto',
|
||||
height = 'auto',
|
||||
legendJustifyContent,
|
||||
position = 'top',
|
||||
renderChart,
|
||||
renderLegend,
|
||||
}: Props) {
|
||||
const isHorizontal = position === 'left' || position === 'right';
|
||||
|
||||
const style: CSSProperties = useMemo(
|
||||
() => ({
|
||||
display: 'flex',
|
||||
flexDirection: getContainerDirection(position),
|
||||
height,
|
||||
width,
|
||||
}),
|
||||
[position, height, width],
|
||||
);
|
||||
|
||||
const chartStyle: CSSProperties = useMemo(() => {
|
||||
const baseStyle = { ...CHART_STYLE_BASE };
|
||||
if (isHorizontal) {
|
||||
baseStyle.width = 0;
|
||||
} else {
|
||||
baseStyle.height = 0;
|
||||
}
|
||||
return baseStyle;
|
||||
}, [isHorizontal]);
|
||||
|
||||
const legendDirection = isHorizontal ? 'column' : 'row';
|
||||
const legendStyle: CSSProperties = useMemo(
|
||||
() => ({
|
||||
...LEGEND_STYLE_BASE,
|
||||
flexDirection: legendDirection,
|
||||
justifyContent: getLegendJustifyContent(legendJustifyContent, position),
|
||||
}),
|
||||
[legendDirection, legendJustifyContent, position],
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={`with-legend ${className}`} style={style}>
|
||||
{renderLegend && (
|
||||
<div className="legend-container" style={legendStyle}>
|
||||
{renderLegend({
|
||||
// Pass flexDirection for @vx/legend to arrange legend items
|
||||
direction: legendDirection,
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
<div className="main-container" style={chartStyle}>
|
||||
<ParentSize debounceTime={debounceTime}>
|
||||
{(parent: { width: number; height: number }) =>
|
||||
parent.width > 0 && parent.height > 0
|
||||
? // Only render when necessary
|
||||
renderChart(parent)
|
||||
: null
|
||||
}
|
||||
</ParentSize>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default memo(WithLegend);
|
||||
|
||||
@@ -17,31 +17,21 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { PureComponent, ReactNode } from 'react';
|
||||
|
||||
const defaultProps = {
|
||||
className: '',
|
||||
};
|
||||
import { memo, ReactNode } from 'react';
|
||||
|
||||
type Props = {
|
||||
className?: string;
|
||||
children: ReactNode;
|
||||
} & Readonly<typeof defaultProps>;
|
||||
};
|
||||
|
||||
const CONTAINER_STYLE = { padding: 8 };
|
||||
|
||||
class TooltipFrame extends PureComponent<Props, {}> {
|
||||
static defaultProps = defaultProps;
|
||||
|
||||
render() {
|
||||
const { className, children } = this.props;
|
||||
|
||||
return (
|
||||
<div className={className} style={CONTAINER_STYLE}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
function TooltipFrame({ className = '', children }: Props) {
|
||||
return (
|
||||
<div className={className} style={CONTAINER_STYLE}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default TooltipFrame;
|
||||
export default memo(TooltipFrame);
|
||||
|
||||
@@ -51,8 +51,16 @@ test('renders children with custom horizontal spacing', () => {
|
||||
expect(screen.getByTestId('container')).toHaveStyle('gap: 20px');
|
||||
});
|
||||
|
||||
test('does not render a dropdown button when not overflowing', () => {
|
||||
test('renders dropdown button when items exist even when not overflowing', () => {
|
||||
render(<DropdownContainer items={generateItems(3)} />);
|
||||
// Button should always be visible when items exist to prevent layout shifts
|
||||
expect(screen.getByText('More')).toBeInTheDocument();
|
||||
// Badge should show 0 when nothing is overflowing
|
||||
expect(screen.getByText('0')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('does not render a dropdown button when no items', () => {
|
||||
render(<DropdownContainer items={[]} />);
|
||||
expect(screen.queryByText('More')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import { t } from '@apache-superset/core/translation';
|
||||
import { usePrevious } from '@superset-ui/core';
|
||||
import { css, useTheme } from '@apache-superset/core/theme';
|
||||
import { useResizeDetector } from 'react-resize-detector';
|
||||
import { Badge, Icons, Button, Tooltip, Popover } from '..';
|
||||
import { Badge, Icons, Button, Popover } from '..';
|
||||
import { DropdownContainerProps, DropdownItem, DropdownRef } from './types';
|
||||
|
||||
const MAX_HEIGHT = 500;
|
||||
@@ -234,6 +234,10 @@ export const DropdownContainer = forwardRef(
|
||||
const overflowingCount =
|
||||
overflowingIndex !== -1 ? items.length - overflowingIndex : 0;
|
||||
|
||||
// Always show button when items exist to prevent layout shifts
|
||||
// and ensure consistent UI even when no items are overflowing
|
||||
const shouldShowButton = items.length > 0 || !!dropdownContent;
|
||||
|
||||
const popoverContent = useMemo(
|
||||
() =>
|
||||
dropdownContent || overflowingCount ? (
|
||||
@@ -293,6 +297,44 @@ export const DropdownContainer = forwardRef(
|
||||
};
|
||||
}, [popoverVisible]);
|
||||
|
||||
const triggerButton = (
|
||||
<Button
|
||||
buttonStyle="secondary"
|
||||
data-test="dropdown-container-btn"
|
||||
icon={dropdownTriggerIcon}
|
||||
disabled={!popoverContent}
|
||||
tooltip={dropdownTriggerTooltip}
|
||||
css={css`
|
||||
padding-left: ${theme.paddingXS}px;
|
||||
padding-right: ${theme.paddingXXS}px;
|
||||
gap: ${theme.sizeXXS}px;
|
||||
`}
|
||||
>
|
||||
{dropdownTriggerText}
|
||||
<Badge
|
||||
count={dropdownTriggerCount ?? overflowingCount}
|
||||
color={
|
||||
(dropdownTriggerCount ?? overflowingCount) > 0
|
||||
? theme.colorPrimary
|
||||
: theme.colorTextSecondary
|
||||
}
|
||||
showZero
|
||||
css={css`
|
||||
margin-left: ${theme.sizeUnit * 2}px;
|
||||
`}
|
||||
/>
|
||||
<Icons.DownOutlined
|
||||
iconSize="m"
|
||||
iconColor={theme.colorIcon}
|
||||
css={css`
|
||||
.anticon {
|
||||
display: flex;
|
||||
}
|
||||
`}
|
||||
/>
|
||||
</Button>
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
@@ -314,7 +356,7 @@ export const DropdownContainer = forwardRef(
|
||||
>
|
||||
{notOverflowedItems.map(item => item.element)}
|
||||
</div>
|
||||
{popoverContent && (
|
||||
{shouldShowButton && (
|
||||
<>
|
||||
<Global
|
||||
styles={css`
|
||||
@@ -339,57 +381,27 @@ export const DropdownContainer = forwardRef(
|
||||
`}
|
||||
/>
|
||||
|
||||
<Popover
|
||||
styles={{
|
||||
body: {
|
||||
maxHeight: `${MAX_HEIGHT}px`,
|
||||
overflow: showOverflow ? 'auto' : 'visible',
|
||||
},
|
||||
}}
|
||||
content={popoverContent}
|
||||
trigger="click"
|
||||
open={popoverVisible}
|
||||
onOpenChange={visible => setPopoverVisible(visible)}
|
||||
placement="bottom"
|
||||
forceRender={forceRender}
|
||||
fresh // This prop prevents caching and stale data for filter scoping.
|
||||
>
|
||||
<Tooltip title={dropdownTriggerTooltip}>
|
||||
<Button
|
||||
buttonStyle="secondary"
|
||||
data-test="dropdown-container-btn"
|
||||
icon={dropdownTriggerIcon}
|
||||
css={css`
|
||||
padding-left: ${theme.paddingXS}px;
|
||||
padding-right: ${theme.paddingXXS}px;
|
||||
gap: ${theme.sizeXXS}px;
|
||||
`}
|
||||
>
|
||||
{dropdownTriggerText}
|
||||
<Badge
|
||||
count={dropdownTriggerCount ?? overflowingCount}
|
||||
color={
|
||||
(dropdownTriggerCount ?? overflowingCount) > 0
|
||||
? theme.colorPrimary
|
||||
: theme.colorTextSecondary
|
||||
}
|
||||
showZero
|
||||
css={css`
|
||||
margin-left: ${theme.sizeUnit * 2}px;
|
||||
`}
|
||||
/>
|
||||
<Icons.DownOutlined
|
||||
iconSize="m"
|
||||
iconColor={theme.colorIcon}
|
||||
css={css`
|
||||
.anticon {
|
||||
display: flex;
|
||||
}
|
||||
`}
|
||||
/>
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</Popover>
|
||||
{popoverContent ? (
|
||||
<Popover
|
||||
styles={{
|
||||
body: {
|
||||
maxHeight: `${MAX_HEIGHT}px`,
|
||||
overflow: showOverflow ? 'auto' : 'visible',
|
||||
},
|
||||
}}
|
||||
content={popoverContent}
|
||||
trigger="click"
|
||||
open={popoverVisible}
|
||||
onOpenChange={visible => setPopoverVisible(visible)}
|
||||
placement="bottom"
|
||||
forceRender={forceRender}
|
||||
fresh // This prop prevents caching and stale data for filter scoping.
|
||||
>
|
||||
{triggerButton}
|
||||
</Popover>
|
||||
) : (
|
||||
triggerButton
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -90,6 +90,7 @@ import {
|
||||
InfoCircleFilled,
|
||||
InsertRowAboveOutlined,
|
||||
InsertRowBelowOutlined,
|
||||
LeftOutlined,
|
||||
LineChartOutlined,
|
||||
LineOutlined,
|
||||
LinkOutlined,
|
||||
@@ -246,6 +247,7 @@ const AntdIcons = {
|
||||
InfoCircleFilled,
|
||||
InsertRowAboveOutlined,
|
||||
InsertRowBelowOutlined,
|
||||
LeftOutlined,
|
||||
LineChartOutlined,
|
||||
LineOutlined,
|
||||
LinkOutlined,
|
||||
|
||||
@@ -81,6 +81,7 @@ export type Filter = {
|
||||
granularity?: string;
|
||||
time_grain_sqla?: string;
|
||||
time_range?: string;
|
||||
time_grains?: string[];
|
||||
requiredFirst?: boolean;
|
||||
tabsInScope?: string[];
|
||||
chartsInScope?: number[];
|
||||
|
||||
@@ -109,10 +109,10 @@ test('should handle custom range with relative dates (now)', () => {
|
||||
timeRangeFilter,
|
||||
shifts,
|
||||
startDate,
|
||||
['5 days ago'],
|
||||
['4 days ago'],
|
||||
);
|
||||
runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [
|
||||
'5 days ago',
|
||||
'4 days ago',
|
||||
]);
|
||||
runTimezoneTest(
|
||||
NOW_UTC_IN_PACIFIC,
|
||||
@@ -218,10 +218,10 @@ test('should handle null timeRangeFilter', () => {
|
||||
timeRangeFilter,
|
||||
shifts,
|
||||
startDate,
|
||||
['3 days ago'],
|
||||
['2 days ago'],
|
||||
);
|
||||
runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [
|
||||
'3 days ago',
|
||||
'2 days ago',
|
||||
]);
|
||||
runTimezoneTest(
|
||||
NOW_UTC_IN_PACIFIC,
|
||||
@@ -304,10 +304,10 @@ test('should handle custom range with DATEADD function and relative start date',
|
||||
timeRangeFilter,
|
||||
shifts,
|
||||
startDate,
|
||||
['3 days ago'],
|
||||
['2 days ago'],
|
||||
);
|
||||
runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [
|
||||
'3 days ago',
|
||||
'2 days ago',
|
||||
]);
|
||||
runTimezoneTest(
|
||||
NOW_UTC_IN_PACIFIC,
|
||||
@@ -362,10 +362,10 @@ test('should handle custom range with specific date and relative end date', () =
|
||||
timeRangeFilter,
|
||||
shifts,
|
||||
startDate,
|
||||
['8 days ago'],
|
||||
['9 days ago'],
|
||||
);
|
||||
runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [
|
||||
'8 days ago',
|
||||
'9 days ago',
|
||||
]);
|
||||
runTimezoneTest(
|
||||
NOW_UTC_IN_PACIFIC,
|
||||
@@ -390,10 +390,10 @@ test('should handle custom range with specific date and specific end date', () =
|
||||
timeRangeFilter,
|
||||
shifts,
|
||||
startDate,
|
||||
['1 days ago'],
|
||||
['2 days ago'],
|
||||
);
|
||||
runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [
|
||||
'1 days ago',
|
||||
'2 days ago',
|
||||
]);
|
||||
runTimezoneTest(
|
||||
NOW_UTC_IN_PACIFIC,
|
||||
@@ -474,7 +474,7 @@ test('should handle custom range with previous calendar week', () => {
|
||||
timeRangeFilter,
|
||||
shifts,
|
||||
startDate,
|
||||
['3 days ago'],
|
||||
['1 days ago'],
|
||||
);
|
||||
runTimezoneTest(
|
||||
'2024-06-05T00:06:00Z',
|
||||
@@ -482,7 +482,7 @@ test('should handle custom range with previous calendar week', () => {
|
||||
timeRangeFilter,
|
||||
shifts,
|
||||
startDate,
|
||||
['3 days ago'],
|
||||
['1 days ago'],
|
||||
);
|
||||
runTimezoneTest(
|
||||
'2024-06-04T16:06:00-08:00',
|
||||
@@ -507,7 +507,7 @@ test('should handle custom range with previous calendar month', () => {
|
||||
timeRangeFilter,
|
||||
shifts,
|
||||
startDate,
|
||||
['7 days ago'],
|
||||
['5 days ago'],
|
||||
);
|
||||
runTimezoneTest(
|
||||
'2024-06-05T00:06:00Z',
|
||||
@@ -515,7 +515,7 @@ test('should handle custom range with previous calendar month', () => {
|
||||
timeRangeFilter,
|
||||
shifts,
|
||||
startDate,
|
||||
['7 days ago'],
|
||||
['5 days ago'],
|
||||
);
|
||||
runTimezoneTest(
|
||||
'2024-06-04T16:06:00-08:00',
|
||||
@@ -541,7 +541,7 @@ test('should handle custom range with previous calendar year', () => {
|
||||
timeRangeFilter,
|
||||
shifts,
|
||||
startDate,
|
||||
['8 days ago'],
|
||||
['6 days ago'],
|
||||
);
|
||||
runTimezoneTest(
|
||||
'2024-06-05T00:06:00Z',
|
||||
@@ -549,7 +549,7 @@ test('should handle custom range with previous calendar year', () => {
|
||||
timeRangeFilter,
|
||||
shifts,
|
||||
startDate,
|
||||
['8 days ago'],
|
||||
['6 days ago'],
|
||||
);
|
||||
runTimezoneTest(
|
||||
'2024-06-04T16:06:00-08:00',
|
||||
@@ -760,10 +760,10 @@ test('should handle future custom shift with different format', () => {
|
||||
timeRangeFilter,
|
||||
shifts,
|
||||
startDate,
|
||||
['3 days after'],
|
||||
['4 days after'],
|
||||
);
|
||||
runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [
|
||||
'3 days after',
|
||||
'4 days after',
|
||||
]);
|
||||
runTimezoneTest(
|
||||
NOW_UTC_IN_PACIFIC,
|
||||
@@ -771,7 +771,7 @@ test('should handle future custom shift with different format', () => {
|
||||
timeRangeFilter,
|
||||
shifts,
|
||||
startDate,
|
||||
['4 days after'],
|
||||
['5 days after'],
|
||||
);
|
||||
});
|
||||
|
||||
@@ -850,10 +850,10 @@ test('should handle custom range with relative dates (hour)', () => {
|
||||
timeRangeFilter,
|
||||
shifts,
|
||||
startDate,
|
||||
['2 days ago'],
|
||||
['4 days ago'],
|
||||
);
|
||||
runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [
|
||||
'2 days ago',
|
||||
'4 days ago',
|
||||
]);
|
||||
runTimezoneTest(
|
||||
NOW_UTC_IN_PACIFIC,
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
import { parseDttmToDate } from '@superset-ui/core';
|
||||
import timezoneMock from 'timezone-mock';
|
||||
|
||||
// NOW will be set at midnight 2024-06-03 and transforme dfrom local timezone to UTC
|
||||
// NOW will be set at midnight 2024-06-03 and transformed from local timezone to UTC
|
||||
const NOW_IN_UTC = '2024-06-03T00:00:00Z';
|
||||
const NOW_UTC_IN_EUROPE = '2024-06-02T22:00:00Z'; // Same as 2024-06-03T00:00:00+02:00
|
||||
const NOW_UTC_IN_PACIFIC = '2024-06-03T08:00:00Z'; // Same as 2024-06-03T00:00:00-08:00
|
||||
@@ -69,9 +69,9 @@ test('should return the current date for "today"', () => {
|
||||
'today',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-06-01T22:00:00Z'),
|
||||
new Date('2024-06-02T22:00:00Z'),
|
||||
);
|
||||
runTimezoneTest('today', NOW_IN_UTC, 'UTC', new Date('2024-06-02T00:00:00Z'));
|
||||
runTimezoneTest('today', NOW_IN_UTC, 'UTC', new Date('2024-06-03T00:00:00Z'));
|
||||
runTimezoneTest(
|
||||
'today',
|
||||
NOW_UTC_IN_PACIFIC,
|
||||
@@ -125,13 +125,13 @@ test('should return yesterday date for "Last day"', () => {
|
||||
'Last day',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-05-31T22:00:00Z'),
|
||||
new Date('2024-06-01T22:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'Last day',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2024-06-01T00:00:00Z'),
|
||||
new Date('2024-06-02T00:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'Last day',
|
||||
@@ -147,13 +147,13 @@ test('should return the date one week ago for "Last week"', () => {
|
||||
'Last week',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-05-25T22:00:00Z'),
|
||||
new Date('2024-05-26T22:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'Last week',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2024-05-26T00:00:00Z'),
|
||||
new Date('2024-05-27T00:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'Last week',
|
||||
@@ -169,13 +169,13 @@ test('should return the date one month ago for "Last month"', () => {
|
||||
'Last month',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-05-01T22:00:00Z'),
|
||||
new Date('2024-05-02T22:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'Last month',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2024-05-02T00:00:00Z'),
|
||||
new Date('2024-05-03T00:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'Last month',
|
||||
@@ -191,13 +191,13 @@ test('should return the date three months ago for "Last quarter"', () => {
|
||||
'Last quarter',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-03-01T22:00:00Z'),
|
||||
new Date('2024-03-02T22:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'Last quarter',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2024-03-02T00:00:00Z'),
|
||||
new Date('2024-03-03T00:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'Last quarter',
|
||||
@@ -213,13 +213,13 @@ test('should return the date one year ago for "Last year"', () => {
|
||||
'Last year',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2023-06-01T22:00:00Z'),
|
||||
new Date('2023-06-02T22:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'Last year',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2023-06-02T00:00:00Z'),
|
||||
new Date('2023-06-03T00:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'Last year',
|
||||
@@ -235,19 +235,19 @@ test('should return the date for "previous calendar week"', () => {
|
||||
'previous calendar week',
|
||||
'2024-06-04T22:00:00Z',
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-05-27T16:00:00Z'),
|
||||
new Date('2024-05-26T22:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'previous calendar week',
|
||||
'2024-06-05T00:00:00Z',
|
||||
'UTC',
|
||||
new Date('2024-05-27T20:00:00Z'),
|
||||
new Date('2024-05-27T00:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'previous calendar week',
|
||||
'2024-06-05T08:00:00Z',
|
||||
'Etc/GMT+8',
|
||||
new Date('2024-05-27T12:00:00Z'),
|
||||
new Date('2024-05-27T08:00:00Z'),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -257,19 +257,19 @@ test('should return the date for "previous calendar month"', () => {
|
||||
'previous calendar month',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-05-01T10:00:00Z'),
|
||||
new Date('2024-04-30T22:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'previous calendar month',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2024-05-01T16:00:00Z'),
|
||||
new Date('2024-05-01T00:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'previous calendar month',
|
||||
NOW_UTC_IN_PACIFIC,
|
||||
'Etc/GMT+8',
|
||||
new Date('2024-05-01T16:00:00Z'),
|
||||
new Date('2024-05-01T08:00:00Z'),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -279,19 +279,19 @@ test('should return the date for "previous calendar year"', () => {
|
||||
'previous calendar year',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2023-01-01T16:00:00Z'),
|
||||
new Date('2022-12-31T22:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'previous calendar year',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2023-01-01T20:00:00Z'),
|
||||
new Date('2023-01-01T00:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'previous calendar year',
|
||||
NOW_UTC_IN_PACIFIC,
|
||||
'Etc/GMT+8',
|
||||
new Date('2023-01-01T12:00:00Z'),
|
||||
new Date('2023-01-01T08:00:00Z'),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -301,13 +301,13 @@ test('should return the date for "1 day ago"', () => {
|
||||
'1 day ago',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-05-31T22:00:00Z'),
|
||||
new Date('2024-06-01T22:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'1 day ago',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2024-06-01T00:00:00Z'),
|
||||
new Date('2024-06-02T00:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'1 day ago',
|
||||
@@ -323,13 +323,13 @@ test('should return the date for "1 week ago"', () => {
|
||||
'1 week ago',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-05-25T22:00:00Z'),
|
||||
new Date('2024-05-26T22:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'1 week ago',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2024-05-26T00:00:00Z'),
|
||||
new Date('2024-05-27T00:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'1 week ago',
|
||||
@@ -345,13 +345,13 @@ test('should return the date for "1 month ago"', () => {
|
||||
'1 month ago',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-05-01T22:00:00Z'),
|
||||
new Date('2024-05-02T22:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'1 month ago',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2024-05-02T00:00:00Z'),
|
||||
new Date('2024-05-03T00:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'1 month ago',
|
||||
@@ -367,13 +367,13 @@ test('should return the date for "1 year ago"', () => {
|
||||
'1 year ago',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2023-06-01T22:00:00Z'),
|
||||
new Date('2023-06-02T22:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'1 year ago',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2023-06-02T00:00:00Z'),
|
||||
new Date('2023-06-03T00:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'1 year ago',
|
||||
@@ -389,13 +389,13 @@ test('should return the date for "2024-03-09"', () => {
|
||||
'2024-03-09',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-03-07T22:00:00.000Z'),
|
||||
new Date('2024-03-08T22:00:00.000Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'2024-03-09',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2024-03-08T00:00:00.000Z'),
|
||||
new Date('2024-03-09T00:00:00.000Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'2024-03-09',
|
||||
@@ -411,14 +411,14 @@ test('should return the current date for "Last day" with isEndDate true', () =>
|
||||
'Last day',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-06-01T22:00:00Z'),
|
||||
new Date('2024-06-02T22:00:00Z'),
|
||||
true,
|
||||
);
|
||||
runTimezoneTest(
|
||||
'Last day',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2024-06-02T00:00:00Z'),
|
||||
new Date('2024-06-03T00:00:00Z'),
|
||||
true,
|
||||
);
|
||||
runTimezoneTest(
|
||||
@@ -436,14 +436,14 @@ test('should return the current date for "Last week" with isEndDate true', () =>
|
||||
'Last week',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-06-01T22:00:00Z'),
|
||||
new Date('2024-06-02T22:00:00Z'),
|
||||
true,
|
||||
);
|
||||
runTimezoneTest(
|
||||
'Last week',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2024-06-02T00:00:00Z'),
|
||||
new Date('2024-06-03T00:00:00Z'),
|
||||
true,
|
||||
);
|
||||
runTimezoneTest(
|
||||
@@ -461,14 +461,14 @@ test('should return the current date for "Last quarter" with isEndDate true', ()
|
||||
'Last quarter',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-06-01T22:00:00Z'),
|
||||
new Date('2024-06-02T22:00:00Z'),
|
||||
true,
|
||||
);
|
||||
runTimezoneTest(
|
||||
'Last quarter',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2024-06-02T00:00:00Z'),
|
||||
new Date('2024-06-03T00:00:00Z'),
|
||||
true,
|
||||
);
|
||||
runTimezoneTest(
|
||||
@@ -486,14 +486,14 @@ test('should return the current date for "Last year" with isEndDate true', () =>
|
||||
'Last year',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-06-01T22:00:00Z'),
|
||||
new Date('2024-06-02T22:00:00Z'),
|
||||
true,
|
||||
);
|
||||
runTimezoneTest(
|
||||
'Last year',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2024-06-02T00:00:00Z'),
|
||||
new Date('2024-06-03T00:00:00Z'),
|
||||
true,
|
||||
);
|
||||
runTimezoneTest(
|
||||
@@ -511,21 +511,21 @@ test('should return the date for "previous calendar week" with isEndDate true',
|
||||
'previous calendar week',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-06-03T16:00:00Z'),
|
||||
new Date('2024-06-02T22:00:00Z'),
|
||||
true,
|
||||
);
|
||||
runTimezoneTest(
|
||||
'previous calendar week',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2024-06-03T20:00:00Z'),
|
||||
new Date('2024-06-03T00:00:00Z'),
|
||||
true,
|
||||
);
|
||||
runTimezoneTest(
|
||||
'previous calendar week',
|
||||
NOW_UTC_IN_PACIFIC,
|
||||
'Etc/GMT+8',
|
||||
new Date('2024-06-03T12:00:00Z'),
|
||||
new Date('2024-06-03T08:00:00Z'),
|
||||
true,
|
||||
);
|
||||
});
|
||||
@@ -536,21 +536,21 @@ test('should return the date for "previous calendar month" with isEndDate true',
|
||||
'previous calendar month',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-06-01T16:00:00Z'),
|
||||
new Date('2024-05-31T22:00:00Z'),
|
||||
true,
|
||||
);
|
||||
runTimezoneTest(
|
||||
'previous calendar month',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2024-06-01T20:00:00Z'),
|
||||
new Date('2024-06-01T00:00:00Z'),
|
||||
true,
|
||||
);
|
||||
runTimezoneTest(
|
||||
'previous calendar month',
|
||||
NOW_UTC_IN_PACIFIC,
|
||||
'Etc/GMT+8',
|
||||
new Date('2024-06-01T12:00:00Z'),
|
||||
new Date('2024-06-01T08:00:00Z'),
|
||||
true,
|
||||
);
|
||||
});
|
||||
@@ -561,21 +561,21 @@ test('should return the date for "previous calendar year" with isEndDate true',
|
||||
'previous calendar year',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-01-01T16:00:00Z'),
|
||||
new Date('2023-12-31T22:00:00Z'),
|
||||
true,
|
||||
);
|
||||
runTimezoneTest(
|
||||
'previous calendar year',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2024-01-01T20:00:00Z'),
|
||||
new Date('2024-01-01T00:00:00Z'),
|
||||
true,
|
||||
);
|
||||
runTimezoneTest(
|
||||
'previous calendar year',
|
||||
NOW_UTC_IN_PACIFIC,
|
||||
'Etc/GMT+8',
|
||||
new Date('2024-01-01T12:00:00Z'),
|
||||
new Date('2024-01-01T08:00:00Z'),
|
||||
true,
|
||||
);
|
||||
});
|
||||
@@ -586,9 +586,9 @@ test('should return the date for "2024" with parts.length === 1', () => {
|
||||
'2024',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2023-12-30T22:00:00.000Z'),
|
||||
new Date('2023-12-31T22:00:00.000Z'),
|
||||
);
|
||||
runTimezoneTest('2024', NOW_IN_UTC, 'UTC', new Date('2023-12-31T00:00:00Z'));
|
||||
runTimezoneTest('2024', NOW_IN_UTC, 'UTC', new Date('2024-01-01T00:00:00Z'));
|
||||
runTimezoneTest(
|
||||
'2024',
|
||||
NOW_UTC_IN_PACIFIC,
|
||||
@@ -603,13 +603,13 @@ test('should return the date for "2024-03" with parts.length === 2', () => {
|
||||
'2024-03',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-02-28T22:00:00.000Z'),
|
||||
new Date('2024-02-29T22:00:00.000Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'2024-03',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2024-02-29T00:00:00Z'),
|
||||
new Date('2024-03-01T00:00:00Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'2024-03',
|
||||
@@ -625,13 +625,13 @@ test('should return the date for "2024-03-06" with parts.length === 3', () => {
|
||||
'2024-03-06',
|
||||
NOW_UTC_IN_EUROPE,
|
||||
'Etc/GMT-2',
|
||||
new Date('2024-03-04T22:00:00.000Z'),
|
||||
new Date('2024-03-05T22:00:00.000Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'2024-03-06',
|
||||
NOW_IN_UTC,
|
||||
'UTC',
|
||||
new Date('2024-03-05T00:00:00.000Z'),
|
||||
new Date('2024-03-06T00:00:00.000Z'),
|
||||
);
|
||||
runTimezoneTest(
|
||||
'2024-03-06',
|
||||
@@ -643,7 +643,7 @@ test('should return the date for "2024-03-06" with parts.length === 3', () => {
|
||||
|
||||
test('should return the date for "2024-03-06" with computingShifts true', () => {
|
||||
jest.useFakeTimers();
|
||||
const expectedDate = new Date('2024-03-05T22:00:00Z');
|
||||
const expectedDate = new Date('2024-03-06T22:00:00Z');
|
||||
expectedDate.setHours(-expectedDate.getTimezoneOffset() / 60, 0, 0, 0);
|
||||
runTimezoneTest(
|
||||
'2024-03-06',
|
||||
@@ -657,7 +657,7 @@ test('should return the date for "2024-03-06" with computingShifts true', () =>
|
||||
|
||||
test('should return the date for "2024-03-06" with computingShifts true and isEndDate true', () => {
|
||||
jest.useFakeTimers();
|
||||
const expectedDate = new Date('2024-03-05T22:00:00Z');
|
||||
const expectedDate = new Date('2024-03-06T22:00:00Z');
|
||||
expectedDate.setHours(-expectedDate.getTimezoneOffset() / 60, 0, 0, 0);
|
||||
runTimezoneTest(
|
||||
'2024-03-06',
|
||||
|
||||
@@ -25,7 +25,9 @@ const CHROME_UA =
|
||||
|
||||
const makeGetText = (text: string) => () => Promise.resolve(text);
|
||||
|
||||
const globalWithClipboardItem = global as unknown as { ClipboardItem?: unknown };
|
||||
const globalWithClipboardItem = global as unknown as {
|
||||
ClipboardItem?: unknown;
|
||||
};
|
||||
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
@@ -94,9 +96,7 @@ function mockExecCommand(impl: (cmd: string) => boolean) {
|
||||
});
|
||||
}
|
||||
|
||||
function setupFallbackMocks(options: {
|
||||
selection: Partial<Selection> | null;
|
||||
}) {
|
||||
function setupFallbackMocks(options: { selection: Partial<Selection> | null }) {
|
||||
Object.defineProperty(navigator, 'userAgent', {
|
||||
value: CHROME_UA,
|
||||
configurable: true,
|
||||
@@ -117,7 +117,9 @@ function setupFallbackMocks(options: {
|
||||
jest
|
||||
.spyOn(document, 'getSelection')
|
||||
.mockReturnValue(options.selection as Selection | null);
|
||||
jest.spyOn(document, 'createRange').mockReturnValue(mockRange as unknown as Range);
|
||||
jest
|
||||
.spyOn(document, 'createRange')
|
||||
.mockReturnValue(mockRange as unknown as Range);
|
||||
jest.spyOn(document, 'createElement').mockReturnValue(mockSpan);
|
||||
jest.spyOn(document.body, 'appendChild').mockImplementation(() => mockSpan);
|
||||
jest.spyOn(document.body, 'removeChild').mockImplementation(() => mockSpan);
|
||||
@@ -168,7 +170,9 @@ test('rejects when execCommand returns false', async () => {
|
||||
});
|
||||
mockExecCommand(() => false);
|
||||
|
||||
await expect(copyTextToClipboard(makeGetText('fail'))).rejects.toBeUndefined();
|
||||
await expect(
|
||||
copyTextToClipboard(makeGetText('fail')),
|
||||
).rejects.toBeUndefined();
|
||||
});
|
||||
|
||||
test('rejects when execCommand throws', async () => {
|
||||
@@ -187,7 +191,9 @@ test('rejects when execCommand throws', async () => {
|
||||
writable: true,
|
||||
});
|
||||
|
||||
await expect(copyTextToClipboard(makeGetText('throw'))).rejects.toBeUndefined();
|
||||
await expect(
|
||||
copyTextToClipboard(makeGetText('throw')),
|
||||
).rejects.toBeUndefined();
|
||||
});
|
||||
|
||||
test('resolves without copying when getSelection returns null', async () => {
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
"dependencies": {
|
||||
"d3": "^3.5.17",
|
||||
"prop-types": "^15.8.1",
|
||||
"react": "^19.2.1"
|
||||
"react": "^19.2.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@superset-ui/chart-controls": "*",
|
||||
|
||||
@@ -431,6 +431,11 @@ const processColumns = memoizeOne(function processColumns(
|
||||
formatter,
|
||||
config,
|
||||
};
|
||||
})
|
||||
.sort((a, b) => {
|
||||
const aIsMetric = a.isMetric || a.isPercentMetric ? 1 : 0;
|
||||
const bIsMetric = b.isMetric || b.isPercentMetric ? 1 : 0;
|
||||
return aIsMetric - bIsMetric;
|
||||
});
|
||||
return [metrics, percentMetrics, columns] as [
|
||||
typeof metrics,
|
||||
|
||||
@@ -29,6 +29,7 @@ import {
|
||||
} from '@superset-ui/core';
|
||||
import { GenericDataType } from '@apache-superset/core/common';
|
||||
import { BigNumberTotalChartProps, BigNumberVizProps } from '../types';
|
||||
import { PROPORTION } from '../constants';
|
||||
import { getDateFormatter, getOriginalLabel, parseMetricValue } from '../utils';
|
||||
import { Refs } from '../../types';
|
||||
|
||||
@@ -76,8 +77,8 @@ export default function transformProps(
|
||||
const showMetricName = chartProps.rawFormData?.show_metric_name ?? false;
|
||||
const formattedSubtitle = subtitle?.trim() ? subtitle : subheader || '';
|
||||
const formattedSubtitleFontSize = subtitle?.trim()
|
||||
? (subtitleFontSize ?? 1)
|
||||
: (subheaderFontSize ?? 1);
|
||||
? (subtitleFontSize ?? PROPORTION.SUBHEADER)
|
||||
: (subheaderFontSize ?? subtitleFontSize ?? PROPORTION.SUBHEADER);
|
||||
const bigNumber =
|
||||
data.length === 0 ? null : parseMetricValue(data[0][metricName]);
|
||||
|
||||
|
||||
@@ -30,20 +30,11 @@ import {
|
||||
import { styled, useTheme } from '@apache-superset/core/theme';
|
||||
import Echart from '../components/Echart';
|
||||
import { BigNumberVizProps } from './types';
|
||||
import { PROPORTION } from './constants';
|
||||
import { EventHandlers } from '../types';
|
||||
|
||||
const defaultNumberFormatter = getNumberFormatter();
|
||||
|
||||
const PROPORTION = {
|
||||
// text size: proportion of the chart container sans trendline
|
||||
METRIC_NAME: 0.125,
|
||||
KICKER: 0.1,
|
||||
HEADER: 0.3,
|
||||
SUBHEADER: 0.125,
|
||||
// trendline size: proportion of the whole chart container
|
||||
TRENDLINE: 0.3,
|
||||
};
|
||||
|
||||
function BigNumberVis({
|
||||
className = '',
|
||||
headerFormatter = defaultNumberFormatter,
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export const PROPORTION = {
|
||||
METRIC_NAME: 0.125,
|
||||
KICKER: 0.1,
|
||||
HEADER: 0.3,
|
||||
SUBHEADER: 0.125,
|
||||
TRENDLINE: 0.3,
|
||||
};
|
||||
@@ -25,8 +25,8 @@ export const DEFAULT_FORM_DATA: Partial<EchartsBubbleFormData> = {
|
||||
emitFilter: false,
|
||||
logXAis: false,
|
||||
logYAxis: false,
|
||||
xAxisTitleMargin: 30,
|
||||
yAxisTitleMargin: 30,
|
||||
xAxisTitleMargin: 40,
|
||||
yAxisTitleMargin: 50,
|
||||
truncateXAxis: false,
|
||||
truncateYAxis: false,
|
||||
xAxisBounds: [null, null],
|
||||
|
||||
@@ -144,7 +144,7 @@ const config: ControlPanelConfig = {
|
||||
clearable: true,
|
||||
label: t('X axis title margin'),
|
||||
renderTrigger: true,
|
||||
default: sections.TITLE_MARGIN_OPTIONS[1],
|
||||
default: sections.TITLE_MARGIN_OPTIONS[3],
|
||||
choices: formatSelectOptions(sections.TITLE_MARGIN_OPTIONS),
|
||||
},
|
||||
},
|
||||
@@ -216,7 +216,7 @@ const config: ControlPanelConfig = {
|
||||
clearable: true,
|
||||
label: t('Y axis title margin'),
|
||||
renderTrigger: true,
|
||||
default: sections.TITLE_MARGIN_OPTIONS[1],
|
||||
default: sections.TITLE_MARGIN_OPTIONS[4],
|
||||
choices: formatSelectOptions(sections.TITLE_MARGIN_OPTIONS),
|
||||
},
|
||||
},
|
||||
|
||||
@@ -156,9 +156,9 @@ const defaultFormData: EchartsTimeseriesFormData & {
|
||||
showLegend: false,
|
||||
legendSort: null,
|
||||
xAxisTitle: '',
|
||||
xAxisTitleMargin: 0,
|
||||
xAxisTitleMargin: 40,
|
||||
yAxisTitle: '',
|
||||
yAxisTitleMargin: 15,
|
||||
yAxisTitleMargin: 50,
|
||||
yAxisTitlePosition: '',
|
||||
time_range: 'No filter',
|
||||
granularity: undefined,
|
||||
|
||||
@@ -92,7 +92,7 @@ function createAxisTitleControl(axis: 'x' | 'y'): ControlSetRow[] {
|
||||
clearable: true,
|
||||
label: t('Axis title margin'),
|
||||
renderTrigger: true,
|
||||
default: sections.TITLE_MARGIN_OPTIONS[0],
|
||||
default: sections.TITLE_MARGIN_OPTIONS[3],
|
||||
choices: formatSelectOptions(sections.TITLE_MARGIN_OPTIONS),
|
||||
visibility: ({ controls }: ControlPanelsContainerProps) =>
|
||||
isXAxis ? isVertical(controls) : isHorizontal(controls),
|
||||
@@ -125,7 +125,7 @@ function createAxisTitleControl(axis: 'x' | 'y'): ControlSetRow[] {
|
||||
clearable: true,
|
||||
label: t('Axis title margin'),
|
||||
renderTrigger: true,
|
||||
default: sections.TITLE_MARGIN_OPTIONS[1],
|
||||
default: sections.TITLE_MARGIN_OPTIONS[4],
|
||||
choices: formatSelectOptions(sections.TITLE_MARGIN_OPTIONS),
|
||||
visibility: ({ controls }: ControlPanelsContainerProps) =>
|
||||
isXAxis ? isHorizontal(controls) : isVertical(controls),
|
||||
|
||||
@@ -44,9 +44,9 @@ export const DEFAULT_FORM_DATA: EchartsTimeseriesFormData = {
|
||||
// ...DEFAULT_TITLE_FORM_DATA, // TODO: figure out why these break things for stories (e.g. Bubble Chart)
|
||||
// here are the contents of DEFAULT_TITLE_FORM_DATA:
|
||||
xAxisTitle: '',
|
||||
xAxisTitleMargin: 0,
|
||||
xAxisTitleMargin: 40,
|
||||
yAxisTitle: '',
|
||||
yAxisTitleMargin: 15,
|
||||
yAxisTitleMargin: 50,
|
||||
yAxisTitlePosition: 'Top',
|
||||
// Now that the weird bug workaround is over, here's the rest...
|
||||
...DEFAULT_SORT_SERIES_DATA,
|
||||
|
||||
@@ -107,9 +107,9 @@ export const DEFAULT_LEGEND_FORM_DATA: LegendFormData = {
|
||||
|
||||
export const DEFAULT_TITLE_FORM_DATA: TitleFormData = {
|
||||
xAxisTitle: '',
|
||||
xAxisTitleMargin: 0,
|
||||
xAxisTitleMargin: 40,
|
||||
yAxisTitle: '',
|
||||
yAxisTitleMargin: 15,
|
||||
yAxisTitleMargin: 50,
|
||||
yAxisTitlePosition: 'Top',
|
||||
};
|
||||
|
||||
|
||||
@@ -110,11 +110,11 @@ const formData: EchartsMixedTimeseriesFormData = {
|
||||
truncateYAxisSecondary: false,
|
||||
xAxisLabelRotation: 0,
|
||||
xAxisTitle: '',
|
||||
xAxisTitleMargin: 0,
|
||||
xAxisTitleMargin: 40,
|
||||
yAxisBounds: [undefined, undefined],
|
||||
yAxisBoundsSecondary: [undefined, undefined],
|
||||
yAxisTitle: '',
|
||||
yAxisTitleMargin: 15,
|
||||
yAxisTitleMargin: 50,
|
||||
yAxisTitlePosition: '',
|
||||
yAxisTitleSecondary: '',
|
||||
zoomable: false,
|
||||
|
||||
@@ -917,7 +917,7 @@ export class TableRenderer extends Component<
|
||||
allowRenderHtml,
|
||||
)}
|
||||
<span
|
||||
role="columnheader"
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
// Prevents event bubbling to avoid conflict with column header click handlers
|
||||
// Ensures sort operation executes without triggering cross-filtration
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@math.gl/web-mercator": "^4.1.0",
|
||||
"mapbox-gl": "^3.0.0",
|
||||
"maplibre-gl": "^5.0.0",
|
||||
"react-map-gl": "^8.0.0",
|
||||
"mapbox-gl": "^3.22.0",
|
||||
"maplibre-gl": "^5.23.0",
|
||||
"react-map-gl": "^8.1.0",
|
||||
"supercluster": "^8.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/d3-scale": "^4.0.9",
|
||||
"d3-cloud": "^1.2.9",
|
||||
"d3-cloud": "^1.2.8",
|
||||
"d3-scale": "^4.0.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -21,7 +21,8 @@ import { buildQueryContext, QueryFormOrderBy } from '@superset-ui/core';
|
||||
import { WordCloudFormData } from '../types';
|
||||
|
||||
export default function buildQuery(formData: WordCloudFormData) {
|
||||
const { metric, sort_by_metric, series, row_limit } = formData;
|
||||
const { metric, sort_by_metric, sort_by_series, series, row_limit } =
|
||||
formData;
|
||||
const orderby: QueryFormOrderBy[] = [];
|
||||
const shouldApplyOrderBy =
|
||||
row_limit !== undefined && row_limit !== null && row_limit !== 0;
|
||||
@@ -29,7 +30,7 @@ export default function buildQuery(formData: WordCloudFormData) {
|
||||
if (sort_by_metric && metric) {
|
||||
orderby.push([metric, false]);
|
||||
}
|
||||
if (series) {
|
||||
if (sort_by_series && series) {
|
||||
orderby.push([series, true]);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,22 @@ const config: ControlPanelConfig = {
|
||||
['adhoc_filters'],
|
||||
['row_limit'],
|
||||
['sort_by_metric'],
|
||||
[
|
||||
{
|
||||
name: 'sort_by_series',
|
||||
config: {
|
||||
type: 'CheckboxControl',
|
||||
label: t('Sort by series'),
|
||||
default: false,
|
||||
description: t(
|
||||
'Sort results by series name in ascending order. ' +
|
||||
'When combined with "Sort by metric", this acts as a tiebreaker ' +
|
||||
'for equal metric values. Adding this sort may reduce query ' +
|
||||
'performance on some databases.',
|
||||
),
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -21,17 +21,70 @@ import { VizType } from '@superset-ui/core';
|
||||
import { WordCloudFormData } from '../src';
|
||||
import buildQuery from '../src/plugin/buildQuery';
|
||||
|
||||
describe('WordCloud buildQuery', () => {
|
||||
const formData: WordCloudFormData = {
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
series: 'foo',
|
||||
viz_type: VizType.WordCloud,
|
||||
};
|
||||
const basicFormData: WordCloudFormData = {
|
||||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
series: 'foo',
|
||||
viz_type: VizType.WordCloud,
|
||||
};
|
||||
|
||||
test('should build columns from series in form data', () => {
|
||||
const queryContext = buildQuery(formData);
|
||||
const [query] = queryContext.queries;
|
||||
expect(query.columns).toEqual(['foo']);
|
||||
describe('plugin-chart-word-cloud', () => {
|
||||
describe('buildQuery', () => {
|
||||
test('should build columns from series in form data', () => {
|
||||
const queryContext = buildQuery(basicFormData);
|
||||
const [query] = queryContext.queries;
|
||||
expect(query.columns).toEqual(['foo']);
|
||||
});
|
||||
|
||||
test('should not include orderby when neither sort option is enabled', () => {
|
||||
const queryContext = buildQuery({
|
||||
...basicFormData,
|
||||
metric: 'count',
|
||||
sort_by_metric: false,
|
||||
sort_by_series: false,
|
||||
row_limit: 100,
|
||||
});
|
||||
const [query] = queryContext.queries;
|
||||
expect(query.orderby).toBeUndefined();
|
||||
});
|
||||
|
||||
test('should order by metric DESC only when sort_by_metric is true', () => {
|
||||
const queryContext = buildQuery({
|
||||
...basicFormData,
|
||||
metric: 'count',
|
||||
sort_by_metric: true,
|
||||
sort_by_series: false,
|
||||
row_limit: 100,
|
||||
});
|
||||
const [query] = queryContext.queries;
|
||||
expect(query.orderby).toEqual([['count', false]]);
|
||||
});
|
||||
|
||||
test('should order by series ASC only when sort_by_series is true', () => {
|
||||
const queryContext = buildQuery({
|
||||
...basicFormData,
|
||||
metric: 'count',
|
||||
sort_by_metric: false,
|
||||
sort_by_series: true,
|
||||
row_limit: 100,
|
||||
});
|
||||
const [query] = queryContext.queries;
|
||||
expect(query.orderby).toEqual([['foo', true]]);
|
||||
});
|
||||
|
||||
test('should order by metric DESC then series ASC when both are true', () => {
|
||||
const queryContext = buildQuery({
|
||||
...basicFormData,
|
||||
metric: 'count',
|
||||
sort_by_metric: true,
|
||||
sort_by_series: true,
|
||||
row_limit: 100,
|
||||
});
|
||||
const [query] = queryContext.queries;
|
||||
expect(query.orderby).toEqual([
|
||||
['count', false],
|
||||
['foo', true],
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"@deck.gl/extensions": "~9.2.9",
|
||||
"@deck.gl/geo-layers": "~9.2.5",
|
||||
"@deck.gl/layers": "~9.2.5",
|
||||
"@deck.gl/mapbox": "~9.2.5",
|
||||
"@deck.gl/mapbox": "~9.3.1",
|
||||
"@deck.gl/mesh-layers": "~9.2.5",
|
||||
"@luma.gl/constants": "~9.2.5",
|
||||
"@luma.gl/core": "~9.2.5",
|
||||
@@ -46,11 +46,11 @@
|
||||
"d3-scale": "^4.0.2",
|
||||
"handlebars": "^4.7.9",
|
||||
"lodash": "^4.18.1",
|
||||
"maplibre-gl": "^5.0.0",
|
||||
"maplibre-gl": "^5.23.0",
|
||||
"mousetrap": "^1.6.5",
|
||||
"ngeohash": "^0.6.3",
|
||||
"prop-types": "^15.8.1",
|
||||
"react-map-gl": "^8.0.0",
|
||||
"react-map-gl": "^8.1.1",
|
||||
"underscore": "^1.13.7",
|
||||
"urijs": "^1.19.11",
|
||||
"xss": "^1.0.15"
|
||||
|
||||
@@ -124,6 +124,25 @@ describe('ShareSqlLabQuery', () => {
|
||||
).toEqual(expected);
|
||||
});
|
||||
|
||||
test('does not show duplicate "Copy to clipboard" tooltip on hover', async () => {
|
||||
await act(async () => {
|
||||
render(<ShareSqlLabQuery {...defaultProps} />, {
|
||||
useRedux: true,
|
||||
store,
|
||||
});
|
||||
});
|
||||
const button = screen.getByRole('button');
|
||||
userEvent.hover(button);
|
||||
expect(
|
||||
await screen.findByText('Copy query link to your clipboard'),
|
||||
).toBeInTheDocument();
|
||||
await waitFor(() => {
|
||||
// CopyToClipboard default tooltip must NOT appear —
|
||||
// only the Button-level "Copy query link to your clipboard" should show.
|
||||
expect(screen.queryByText('Copy to clipboard')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
test('calls storeQuery() with unsaved changes', async () => {
|
||||
await act(async () => {
|
||||
render(<ShareSqlLabQuery {...defaultProps} />, {
|
||||
|
||||
@@ -89,6 +89,7 @@ const ShareSqlLabQuery = ({
|
||||
getText={getCopyUrl}
|
||||
wrapped={false}
|
||||
copyNode={buildButton()}
|
||||
hideTooltip
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
type ChangeEvent,
|
||||
useMemo,
|
||||
} from 'react';
|
||||
import { useDebounceValue } from 'src/hooks/useDebounceValue';
|
||||
import { useSelector, useDispatch, shallowEqual } from 'react-redux';
|
||||
import { styled, css, useTheme } from '@apache-superset/core/theme';
|
||||
import { t } from '@apache-superset/core/translation';
|
||||
@@ -313,6 +314,7 @@ const TableExploreTree: React.FC<Props> = ({ queryEditorId }) => {
|
||||
}, [sortedTreeData, sortedTables]);
|
||||
|
||||
const [searchTerm, setSearchTerm] = useState('');
|
||||
const debouncedSearchTerm = useDebounceValue(searchTerm);
|
||||
const handleSearchChange = useCallback(
|
||||
({ target }: ChangeEvent<HTMLInputElement>) => setSearchTerm(target.value),
|
||||
[],
|
||||
@@ -370,9 +372,9 @@ const TableExploreTree: React.FC<Props> = ({ queryEditorId }) => {
|
||||
|
||||
// Check if any nodes match the search term
|
||||
const hasMatchingNodes = useMemo(() => {
|
||||
if (!searchTerm) return true;
|
||||
if (!debouncedSearchTerm) return true;
|
||||
|
||||
const lowerTerm = searchTerm.toLowerCase();
|
||||
const lowerTerm = debouncedSearchTerm.toLowerCase();
|
||||
|
||||
const checkNode = (node: TreeNodeData): boolean => {
|
||||
if (node.type === 'empty') return false;
|
||||
@@ -384,7 +386,7 @@ const TableExploreTree: React.FC<Props> = ({ queryEditorId }) => {
|
||||
};
|
||||
|
||||
return displayTreeData.some(node => checkNode(node));
|
||||
}, [searchTerm, displayTreeData]);
|
||||
}, [debouncedSearchTerm, displayTreeData]);
|
||||
|
||||
// Node renderer for react-arborist
|
||||
const renderNode = useCallback(
|
||||
@@ -393,7 +395,7 @@ const TableExploreTree: React.FC<Props> = ({ queryEditorId }) => {
|
||||
{...props}
|
||||
manuallyOpenedNodes={manuallyOpenedNodes}
|
||||
loadingNodes={loadingNodes}
|
||||
searchTerm={searchTerm}
|
||||
searchTerm={debouncedSearchTerm}
|
||||
catalog={catalog}
|
||||
pinnedTableKeys={pinnedTableKeys}
|
||||
pinnedSchemas={pinnedSchemas}
|
||||
@@ -423,7 +425,7 @@ const TableExploreTree: React.FC<Props> = ({ queryEditorId }) => {
|
||||
toggleSortColumns,
|
||||
loadingNodes,
|
||||
manuallyOpenedNodes,
|
||||
searchTerm,
|
||||
debouncedSearchTerm,
|
||||
],
|
||||
);
|
||||
|
||||
@@ -482,7 +484,7 @@ const TableExploreTree: React.FC<Props> = ({ queryEditorId }) => {
|
||||
return <Skeleton active />;
|
||||
}
|
||||
|
||||
if (searchTerm && !hasMatchingNodes) {
|
||||
if (debouncedSearchTerm && !hasMatchingNodes) {
|
||||
return (
|
||||
<Empty
|
||||
description={t('No matching results found')}
|
||||
@@ -499,7 +501,7 @@ const TableExploreTree: React.FC<Props> = ({ queryEditorId }) => {
|
||||
height={height || 500}
|
||||
rowHeight={ROW_HEIGHT}
|
||||
indent={16}
|
||||
searchTerm={searchTerm}
|
||||
searchTerm={debouncedSearchTerm}
|
||||
searchMatch={searchMatch}
|
||||
disableDrag
|
||||
disableDrop
|
||||
@@ -525,7 +527,7 @@ const TableExploreTree: React.FC<Props> = ({ queryEditorId }) => {
|
||||
// react-arborist marks all schemas as open (isOpen=true) even before any
|
||||
// user interaction. Using treeRef in that case would treat every first
|
||||
// click as a close action, so fall back to manuallyOpenedNodes instead.
|
||||
const wasOpen = searchTerm
|
||||
const wasOpen = debouncedSearchTerm
|
||||
? (treeRef.current?.get(id)?.isOpen ??
|
||||
manuallyOpenedNodes[id] ??
|
||||
false)
|
||||
|
||||
@@ -34,6 +34,7 @@ const apiData = {
|
||||
lastName: 'last name',
|
||||
permissions: {},
|
||||
roles: {},
|
||||
groups: [],
|
||||
},
|
||||
};
|
||||
const apiDataWithTabState = {
|
||||
|
||||
@@ -32,6 +32,7 @@ jest.mock('@superset-ui/core', () => ({
|
||||
const mockSupersetClientGet = SupersetClient.get as jest.Mock;
|
||||
|
||||
const defaultProps: PluginDeckglLayerVisibilityProps = {
|
||||
data: [],
|
||||
formData: {
|
||||
viz_type: 'deckgl_layer_visibility',
|
||||
defaultToAllLayersVisible: true,
|
||||
@@ -40,7 +41,13 @@ const defaultProps: PluginDeckglLayerVisibilityProps = {
|
||||
height: 400,
|
||||
width: 600,
|
||||
filterState: {},
|
||||
inputRef: { current: null },
|
||||
setDataMask: jest.fn(),
|
||||
setFocusedFilter: jest.fn(),
|
||||
unsetFocusedFilter: jest.fn(),
|
||||
setHoveredFilter: jest.fn(),
|
||||
unsetHoveredFilter: jest.fn(),
|
||||
setFilterActive: jest.fn(),
|
||||
};
|
||||
|
||||
const mockCharts = {
|
||||
@@ -85,10 +92,13 @@ test('displays loading state initially', () => {
|
||||
},
|
||||
});
|
||||
|
||||
expect(screen.getByText('Loading deck.gl layers...')).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByTestId('deckgl-layer-visibility-select'),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByRole('combobox')).toBeDisabled();
|
||||
});
|
||||
|
||||
test('displays message when no deck.gl multi layer charts are found', async () => {
|
||||
test('displays disabled select when no deck.gl multi layer charts are found', async () => {
|
||||
mockSupersetClientGet.mockResolvedValue({ json: { result: [] } });
|
||||
|
||||
render(<DeckglLayerVisibilityCustomizationPlugin {...defaultProps} />, {
|
||||
@@ -107,11 +117,7 @@ test('displays message when no deck.gl multi layer charts are found', async () =
|
||||
});
|
||||
|
||||
await waitFor(() => {
|
||||
expect(
|
||||
screen.getByText(
|
||||
'No deck.gl multi layer charts found in this dashboard.',
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByRole('combobox')).toBeDisabled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -126,10 +132,10 @@ test('renders layer selection control with layers from API', async () => {
|
||||
});
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Exclude layers (deck.gl)')).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByTestId('deckgl-layer-visibility-select'),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
expect(screen.getByRole('combobox')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('collects unique layer IDs from multiple deck_multi charts', async () => {
|
||||
@@ -168,7 +174,9 @@ test('handles layer selection and calls setDataMask', async () => {
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Exclude layers (deck.gl)')).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByTestId('deckgl-layer-visibility-select'),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
const select = screen.getByRole('combobox');
|
||||
@@ -211,7 +219,9 @@ test('initializes with filterState value when provided', async () => {
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Exclude layers (deck.gl)')).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByTestId('deckgl-layer-visibility-select'),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
const select = screen.getByRole('combobox');
|
||||
@@ -280,7 +290,9 @@ test('does not auto-initialize when defaultToAllLayersVisible is false', async (
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Exclude layers (deck.gl)')).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByTestId('deckgl-layer-visibility-select'),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
expect(setDataMaskMock).not.toHaveBeenCalled();
|
||||
@@ -304,7 +316,9 @@ test('handles multiple layer selection', async () => {
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Exclude layers (deck.gl)')).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByTestId('deckgl-layer-visibility-select'),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
const select = screen.getByRole('combobox');
|
||||
@@ -331,29 +345,36 @@ test('handles multiple layer selection', async () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('displays tooltip info icon', async () => {
|
||||
mockSupersetClientGet.mockResolvedValue(mockApiResponse);
|
||||
test('displays tooltip on hover when select is disabled', async () => {
|
||||
mockSupersetClientGet.mockResolvedValue({ json: { result: [] } });
|
||||
|
||||
render(<DeckglLayerVisibilityCustomizationPlugin {...defaultProps} />, {
|
||||
useRedux: true,
|
||||
initialState: {
|
||||
sliceEntities: { slices: mockCharts },
|
||||
sliceEntities: {
|
||||
slices: {
|
||||
chart1: {
|
||||
form_data: {
|
||||
viz_type: 'line',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Exclude layers (deck.gl)')).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByTestId('deckgl-layer-visibility-select'),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
const tooltipIcon = screen.getByRole('img', { name: /info-circle/i });
|
||||
expect(tooltipIcon).toBeInTheDocument();
|
||||
|
||||
await userEvent.hover(tooltipIcon);
|
||||
await userEvent.hover(screen.getByTestId('deckgl-layer-visibility-select'));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(
|
||||
screen.getByText(
|
||||
'Choose layers to hide from all deck.gl Multiple Layer charts in this dashboard.',
|
||||
'No multilayer deck.gl charts are currently added to this dashboard.',
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
@@ -378,11 +399,7 @@ test('handles charts with undefined deck_slices', async () => {
|
||||
});
|
||||
|
||||
await waitFor(() => {
|
||||
expect(
|
||||
screen.getByText(
|
||||
'No deck.gl multi layer charts found in this dashboard.',
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByRole('combobox')).toBeDisabled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -406,11 +423,7 @@ test('handles charts with non-array deck_slices', async () => {
|
||||
});
|
||||
|
||||
await waitFor(() => {
|
||||
expect(
|
||||
screen.getByText(
|
||||
'No deck.gl multi layer charts found in this dashboard.',
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByRole('combobox')).toBeDisabled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -447,6 +460,30 @@ test('deduplicates layer IDs from multiple charts', async () => {
|
||||
expect(callArgs.endpoint).toContain('/api/v1/chart/?q=');
|
||||
});
|
||||
|
||||
test('renders validate message when filterState has validateMessage', async () => {
|
||||
mockSupersetClientGet.mockResolvedValue(mockApiResponse);
|
||||
|
||||
render(
|
||||
<DeckglLayerVisibilityCustomizationPlugin
|
||||
{...defaultProps}
|
||||
filterState={{
|
||||
validateMessage: 'This field is required',
|
||||
validateStatus: 'error',
|
||||
}}
|
||||
/>,
|
||||
{
|
||||
useRedux: true,
|
||||
initialState: {
|
||||
sliceEntities: { slices: mockCharts },
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('This field is required')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
test('respects existing visible_deckgl_layers from Redux state', async () => {
|
||||
mockSupersetClientGet.mockResolvedValue(mockApiResponse);
|
||||
const setDataMaskMock = jest.fn();
|
||||
@@ -477,7 +514,9 @@ test('respects existing visible_deckgl_layers from Redux state', async () => {
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Exclude layers (deck.gl)')).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByTestId('deckgl-layer-visibility-select'),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
expect(setDataMaskMock).not.toHaveBeenCalled();
|
||||
|
||||
@@ -19,19 +19,17 @@
|
||||
import { useEffect, useState, useMemo, useRef, useCallback } from 'react';
|
||||
import { t } from '@apache-superset/core/translation';
|
||||
import { DataMask, ExtraFormData } from '@superset-ui/core';
|
||||
import { useTheme } from '@apache-superset/core/theme';
|
||||
import {
|
||||
Select,
|
||||
FormItem,
|
||||
Tooltip,
|
||||
Icons,
|
||||
Flex,
|
||||
type FormItemProps,
|
||||
} from '@superset-ui/core/components';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { createSelector } from '@reduxjs/toolkit';
|
||||
import { PluginDeckglLayerVisibilityProps } from './types';
|
||||
import { useDeckLayerMetadata } from './useDeckLayerMetadata';
|
||||
import { FilterPluginStyle } from '../common';
|
||||
import { FilterPluginStyle, StatusMessage } from '../common';
|
||||
import { Slice } from 'src/dashboard/types';
|
||||
|
||||
type SliceEntitiesState = {
|
||||
@@ -72,7 +70,6 @@ export default function DeckglLayerVisibilityCustomizationPlugin(
|
||||
props: PluginDeckglLayerVisibilityProps,
|
||||
) {
|
||||
const { formData, filterState, setDataMask, width, height } = props;
|
||||
const theme = useTheme();
|
||||
const [hiddenLayers, setHiddenLayers] = useState<number[]>(
|
||||
filterState?.value || [],
|
||||
);
|
||||
@@ -128,6 +125,19 @@ export default function DeckglLayerVisibilityCustomizationPlugin(
|
||||
setDataMask,
|
||||
]);
|
||||
|
||||
const formItemData: FormItemProps = useMemo(() => {
|
||||
if (filterState.validateMessage) {
|
||||
return {
|
||||
extra: (
|
||||
<StatusMessage status={filterState.validateStatus}>
|
||||
{filterState.validateMessage}
|
||||
</StatusMessage>
|
||||
),
|
||||
};
|
||||
}
|
||||
return EMPTY_OBJECT as FormItemProps;
|
||||
}, [filterState.validateMessage, filterState.validateStatus]);
|
||||
|
||||
const handleLayerChange = useCallback(
|
||||
(selectedHiddenLayers: number[]) => {
|
||||
setHiddenLayers(selectedHiddenLayers);
|
||||
@@ -157,48 +167,34 @@ export default function DeckglLayerVisibilityCustomizationPlugin(
|
||||
[apiLayers],
|
||||
);
|
||||
|
||||
if (isLoadingMetadata && apiLayers.length === 0) {
|
||||
return (
|
||||
<FilterPluginStyle height={height} width={width}>
|
||||
<div>{t('Loading deck.gl layers...')}</div>
|
||||
</FilterPluginStyle>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<FilterPluginStyle height={height} width={width}>
|
||||
{apiLayers.length === 0 ? (
|
||||
<div>{t('No deck.gl multi layer charts found in this dashboard.')}</div>
|
||||
) : (
|
||||
<FormItem
|
||||
label={
|
||||
<Flex gap={theme.sizeUnit}>
|
||||
<span>{t('Exclude layers (deck.gl)')}</span>
|
||||
<Tooltip
|
||||
title={t(
|
||||
'Choose layers to hide from all deck.gl Multiple Layer charts in this dashboard.',
|
||||
)}
|
||||
>
|
||||
<span className="tooltip-icon">
|
||||
<Icons.InfoCircleOutlined
|
||||
iconSize="m"
|
||||
iconColor={theme.colorIcon}
|
||||
/>
|
||||
</span>
|
||||
</Tooltip>
|
||||
</Flex>
|
||||
<FormItem validateStatus={filterState.validateStatus} {...formItemData}>
|
||||
<Tooltip
|
||||
title={
|
||||
!isLoadingMetadata && apiLayers.length === 0
|
||||
? t(
|
||||
'No multilayer deck.gl charts are currently added to this dashboard.',
|
||||
)
|
||||
: null
|
||||
}
|
||||
>
|
||||
<Select
|
||||
mode="multiple"
|
||||
value={hiddenLayers}
|
||||
onChange={handleLayerChange}
|
||||
options={selectOptions}
|
||||
placeholder={t('Select layers to hide')}
|
||||
allowClear
|
||||
/>
|
||||
</FormItem>
|
||||
)}
|
||||
<div>
|
||||
<Select
|
||||
data-test="deckgl-layer-visibility-select"
|
||||
mode="multiple"
|
||||
oneLine
|
||||
value={hiddenLayers}
|
||||
onChange={handleLayerChange}
|
||||
options={selectOptions}
|
||||
placeholder={t('Select layers to hide')}
|
||||
allowClear
|
||||
disabled={apiLayers.length === 0}
|
||||
loading={isLoadingMetadata && apiLayers.length === 0}
|
||||
/>
|
||||
</div>
|
||||
</Tooltip>
|
||||
</FormItem>
|
||||
</FilterPluginStyle>
|
||||
);
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
@@ -21,6 +21,7 @@ import { Behavior, ChartMetadata, ChartPlugin } from '@superset-ui/core';
|
||||
import buildQuery from './buildQuery';
|
||||
import controlPanel from './controlPanel';
|
||||
import transformProps from './transformProps';
|
||||
import thumbnail from './images/thumbnail.png';
|
||||
|
||||
export default class DeckglLayerVisibilityCustomizationPlugin extends ChartPlugin {
|
||||
constructor() {
|
||||
@@ -29,7 +30,7 @@ export default class DeckglLayerVisibilityCustomizationPlugin extends ChartPlugi
|
||||
description: t('Chart customization to control deck.gl layer visibility'),
|
||||
behaviors: [Behavior.InteractiveChart, Behavior.ChartCustomization],
|
||||
tags: [t('Deckgl'), t('Experimental')],
|
||||
thumbnail: '',
|
||||
thumbnail,
|
||||
enableNoResults: false,
|
||||
datasourceCount: 0,
|
||||
});
|
||||
|
||||
@@ -16,31 +16,25 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { QueryFormData, DataMask } from '@superset-ui/core';
|
||||
import { QueryFormData, FilterState } from '@superset-ui/core';
|
||||
import { PluginFilterHooks, PluginFilterStylesProps } from '../types';
|
||||
import { RefObject } from 'react';
|
||||
import type { RefSelectProps } from '@superset-ui/core/components';
|
||||
import { ColumnData, ColumnOption } from '../DynamicGroupBy/types';
|
||||
|
||||
export interface DeckglLayerVisibilityFormData extends QueryFormData {
|
||||
defaultToAllLayersVisible?: boolean;
|
||||
}
|
||||
|
||||
export const DEFAULT_FORM_DATA: Partial<DeckglLayerVisibilityFormData> = {
|
||||
defaultToAllLayersVisible: true,
|
||||
};
|
||||
|
||||
export interface LayerInfo {
|
||||
sliceId: number;
|
||||
name: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface PluginDeckglLayerVisibilityProps {
|
||||
export type PluginDeckglLayerVisibilityProps = PluginFilterStylesProps & {
|
||||
data: (ColumnOption | ColumnData)[];
|
||||
filterState: FilterState;
|
||||
formData: DeckglLayerVisibilityFormData;
|
||||
height: number;
|
||||
width: number;
|
||||
filterState: {
|
||||
value?: number[];
|
||||
};
|
||||
setDataMask: (dataMask: DataMask) => void;
|
||||
ownState?: {
|
||||
availableLayers?: LayerInfo[];
|
||||
};
|
||||
}
|
||||
inputRef: RefObject<RefSelectProps>;
|
||||
} & PluginFilterHooks;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { act, renderHook } from '@testing-library/react-hooks';
|
||||
import { SupersetClient } from '@superset-ui/core';
|
||||
import { useDeckLayerMetadata } from './useDeckLayerMetadata';
|
||||
|
||||
@@ -168,6 +168,34 @@ test('handles empty result from API', async () => {
|
||||
expect(result.current.error).toBe(null);
|
||||
});
|
||||
|
||||
test('clears isLoading when sliceIds transitions from non-empty to empty', async () => {
|
||||
const mockResponse = {
|
||||
json: {
|
||||
result: [{ id: 1, slice_name: 'Layer 1', viz_type: 'deck_scatter' }],
|
||||
},
|
||||
};
|
||||
mockSupersetClientGet.mockResolvedValue(mockResponse);
|
||||
|
||||
const { result, rerender, waitForNextUpdate } = renderHook(
|
||||
({ ids }) => useDeckLayerMetadata(ids),
|
||||
{
|
||||
initialProps: { ids: [1] },
|
||||
},
|
||||
);
|
||||
|
||||
await waitForNextUpdate();
|
||||
|
||||
expect(result.current.isLoading).toBe(false);
|
||||
expect(result.current.layers).toHaveLength(1);
|
||||
|
||||
act(() => {
|
||||
rerender({ ids: [] });
|
||||
});
|
||||
|
||||
expect(result.current.isLoading).toBe(false);
|
||||
expect(result.current.layers).toEqual([]);
|
||||
});
|
||||
|
||||
test('does not refetch when sliceIds array has same values', async () => {
|
||||
const mockResponse = {
|
||||
json: {
|
||||
|
||||
@@ -35,12 +35,13 @@ export const useDeckLayerMetadata = (
|
||||
error: string | null;
|
||||
} => {
|
||||
const [layers, setLayers] = useState<LayerInfo[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [isLoading, setIsLoading] = useState(sliceIds.length > 0);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!sliceIds || sliceIds.length === 0) {
|
||||
setLayers([]);
|
||||
setIsLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,9 @@ export const formatValueHandler = (
|
||||
v.comparator && v.comparator.constructor === Array
|
||||
? `[${v.comparator.join(', ')}]`
|
||||
: v.comparator;
|
||||
return filterVal ? `${v.subject} ${v.operator} ${filterVal}` : `${v.subject} ${v.operator}`;
|
||||
return filterVal
|
||||
? `${v.subject} ${v.operator} ${filterVal}`
|
||||
: `${v.subject} ${v.operator}`;
|
||||
})
|
||||
.join(', ');
|
||||
}
|
||||
|
||||
@@ -40,6 +40,19 @@ jest.mock('src/dashboard/util/isEmbedded', () => ({
|
||||
isEmbedded: jest.fn(() => false),
|
||||
}));
|
||||
|
||||
jest.mock('src/explore/exploreUtils', () => {
|
||||
const actual = jest.requireActual('src/explore/exploreUtils');
|
||||
return {
|
||||
...actual,
|
||||
exportChart: jest.fn(),
|
||||
};
|
||||
});
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const { exportChart: exportChartMock } = jest.requireMock(
|
||||
'src/explore/exploreUtils',
|
||||
) as { exportChart: jest.Mock };
|
||||
|
||||
const CHART_DATA_ENDPOINT = 'glob:*/api/v1/chart/data*';
|
||||
const FORM_DATA_KEY_ENDPOINT = 'glob:*/api/v1/explore/form_data';
|
||||
|
||||
@@ -553,4 +566,66 @@ describe('Table view with pagination', () => {
|
||||
// Table should still be rendered without crashes
|
||||
expect(screen.getByTestId('drill-by-results-table')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('CSV download calls exportChart with drilledFormData', async () => {
|
||||
exportChartMock.mockClear();
|
||||
await renderModal({
|
||||
column: { column_name: 'state', verbose_name: null },
|
||||
drillByConfig: {
|
||||
filters: [{ col: 'gender', op: '==', val: 'boy' }],
|
||||
groupbyFieldName: 'groupby',
|
||||
},
|
||||
});
|
||||
|
||||
const tableRadio = await screen.findByRole('radio', { name: /table/i });
|
||||
userEvent.click(tableRadio);
|
||||
await waitFor(() =>
|
||||
expect(screen.getByTestId('drill-by-results-table')).toBeInTheDocument(),
|
||||
);
|
||||
|
||||
await userEvent.click(
|
||||
await screen.findByRole('button', { name: 'Download' }),
|
||||
);
|
||||
await userEvent.click(await screen.findByText('Export to CSV'));
|
||||
|
||||
expect(exportChartMock).toHaveBeenCalledTimes(1);
|
||||
expect(exportChartMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
resultFormat: 'csv',
|
||||
resultType: 'full',
|
||||
formData: expect.objectContaining({ slice_id: 0 }),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
test('XLSX download calls exportChart with xlsx format', async () => {
|
||||
exportChartMock.mockClear();
|
||||
await renderModal({
|
||||
column: { column_name: 'state', verbose_name: null },
|
||||
drillByConfig: {
|
||||
filters: [{ col: 'gender', op: '==', val: 'boy' }],
|
||||
groupbyFieldName: 'groupby',
|
||||
},
|
||||
});
|
||||
|
||||
const tableRadio = await screen.findByRole('radio', { name: /table/i });
|
||||
userEvent.click(tableRadio);
|
||||
await waitFor(() =>
|
||||
expect(screen.getByTestId('drill-by-results-table')).toBeInTheDocument(),
|
||||
);
|
||||
|
||||
await userEvent.click(
|
||||
await screen.findByRole('button', { name: 'Download' }),
|
||||
);
|
||||
await userEvent.click(await screen.findByText('Export to Excel'));
|
||||
|
||||
expect(exportChartMock).toHaveBeenCalledTimes(1);
|
||||
expect(exportChartMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
resultFormat: 'xlsx',
|
||||
resultType: 'full',
|
||||
formData: expect.objectContaining({ slice_id: 0 }),
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -54,7 +54,7 @@ import {
|
||||
LOG_ACTIONS_FURTHER_DRILL_BY,
|
||||
} from 'src/logger/LogUtils';
|
||||
import { findPermission } from 'src/utils/findPermission';
|
||||
import { getQuerySettings } from 'src/explore/exploreUtils';
|
||||
import { getQuerySettings, exportChart } from 'src/explore/exploreUtils';
|
||||
import { isEmbedded } from 'src/dashboard/util/isEmbedded';
|
||||
import { Dataset, DrillByType } from '../types';
|
||||
import DrillByChart from './DrillByChart';
|
||||
@@ -209,12 +209,6 @@ export default function DrillByModal({
|
||||
const { displayModeToggle, drillByDisplayMode } = useDisplayModeToggle();
|
||||
const [chartDataResult, setChartDataResult] = useState<QueryData[]>();
|
||||
|
||||
const resultsTable = useResultsTableView(
|
||||
chartDataResult,
|
||||
formData.datasource,
|
||||
canDownload,
|
||||
);
|
||||
|
||||
const [currentFormData, setCurrentFormData] = useState(formData);
|
||||
const [usedGroupbyColumns, setUsedGroupbyColumns] = useState<Column[]>(
|
||||
[...initialGroupbyColumns, column].filter(isDefined),
|
||||
@@ -377,6 +371,63 @@ export default function DrillByModal({
|
||||
formData,
|
||||
]);
|
||||
|
||||
const handleDownload = useCallback(
|
||||
(exportType: 'csv' | 'xlsx') => {
|
||||
Promise.resolve(
|
||||
exportChart({
|
||||
formData: drilledFormData,
|
||||
resultFormat: exportType,
|
||||
resultType: 'full',
|
||||
}),
|
||||
).catch(error => {
|
||||
addDangerToast(
|
||||
t('Failed to generate download: %s', error?.message || error),
|
||||
);
|
||||
});
|
||||
},
|
||||
[drilledFormData, addDangerToast],
|
||||
);
|
||||
|
||||
const handleDownloadCSV = useCallback(
|
||||
() => handleDownload('csv'),
|
||||
[handleDownload],
|
||||
);
|
||||
|
||||
const handleDownloadXLSX = useCallback(
|
||||
() => handleDownload('xlsx'),
|
||||
[handleDownload],
|
||||
);
|
||||
|
||||
const handleReload = useCallback(() => {
|
||||
setChartDataResult(undefined);
|
||||
setIsChartDataLoading(true);
|
||||
const [useLegacyApi] = getQuerySettings(drilledFormData);
|
||||
getChartDataRequest({
|
||||
formData: drilledFormData,
|
||||
})
|
||||
.then(({ response, json }) =>
|
||||
handleChartDataResponse(response, json, useLegacyApi),
|
||||
)
|
||||
.then(queriesResponse => {
|
||||
setChartDataResult(queriesResponse);
|
||||
})
|
||||
.catch(() => {
|
||||
addDangerToast(t('Failed to load chart data.'));
|
||||
})
|
||||
.finally(() => {
|
||||
setIsChartDataLoading(false);
|
||||
});
|
||||
}, [addDangerToast, drilledFormData]);
|
||||
|
||||
const resultsTable = useResultsTableView(
|
||||
chartDataResult,
|
||||
formData.datasource,
|
||||
canDownload,
|
||||
handleDownloadCSV,
|
||||
handleDownloadXLSX,
|
||||
handleReload,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
setUsedGroupbyColumns(usedCols =>
|
||||
!currentColumn ||
|
||||
|
||||
@@ -35,6 +35,9 @@ export const useResultsTableView = (
|
||||
chartDataResult: QueryData[] | undefined,
|
||||
datasourceId: string,
|
||||
canDownload: boolean,
|
||||
onDownloadCSV?: () => void,
|
||||
onDownloadXLSX?: () => void,
|
||||
onReload?: () => void,
|
||||
) => {
|
||||
if (!isDefined(chartDataResult)) {
|
||||
return <div />;
|
||||
@@ -50,6 +53,9 @@ export const useResultsTableView = (
|
||||
datasourceId={datasourceId}
|
||||
isVisible
|
||||
canDownload={canDownload}
|
||||
onDownloadCSV={onDownloadCSV}
|
||||
onDownloadXLSX={onDownloadXLSX}
|
||||
onReload={onReload}
|
||||
/>
|
||||
</ResultContainer>
|
||||
);
|
||||
@@ -70,6 +76,9 @@ export const useResultsTableView = (
|
||||
datasourceId={datasourceId}
|
||||
isVisible
|
||||
canDownload={canDownload}
|
||||
onDownloadCSV={onDownloadCSV}
|
||||
onDownloadXLSX={onDownloadXLSX}
|
||||
onReload={onReload}
|
||||
/>
|
||||
</ResultContainer>
|
||||
),
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* 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 'spec/helpers/testing-library';
|
||||
import DownloadDropdown from './DownloadDropdown';
|
||||
|
||||
const onDownloadCSV = jest.fn();
|
||||
const onDownloadXLSX = jest.fn();
|
||||
|
||||
beforeEach(() => {
|
||||
onDownloadCSV.mockClear();
|
||||
onDownloadXLSX.mockClear();
|
||||
});
|
||||
|
||||
const setup = () =>
|
||||
render(
|
||||
<DownloadDropdown
|
||||
onDownloadCSV={onDownloadCSV}
|
||||
onDownloadXLSX={onDownloadXLSX}
|
||||
/>,
|
||||
);
|
||||
|
||||
test('renders a download trigger with accessible label', () => {
|
||||
setup();
|
||||
expect(screen.getByRole('button', { name: 'Download' })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('fires onDownloadCSV when CSV menu item is selected', async () => {
|
||||
setup();
|
||||
await userEvent.click(screen.getByRole('button', { name: 'Download' }));
|
||||
await userEvent.click(await screen.findByText('Export to CSV'));
|
||||
expect(onDownloadCSV).toHaveBeenCalledTimes(1);
|
||||
expect(onDownloadXLSX).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('fires onDownloadXLSX when Excel menu item is selected', async () => {
|
||||
setup();
|
||||
await userEvent.click(screen.getByRole('button', { name: 'Download' }));
|
||||
await userEvent.click(await screen.findByText('Export to Excel'));
|
||||
expect(onDownloadXLSX).toHaveBeenCalledTimes(1);
|
||||
expect(onDownloadCSV).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* 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 } from '@apache-superset/core/translation';
|
||||
import { css, useTheme } from '@apache-superset/core/theme';
|
||||
import { Dropdown, Tooltip } from '@superset-ui/core/components';
|
||||
import { Icons } from '@superset-ui/core/components/Icons';
|
||||
|
||||
interface DownloadDropdownProps {
|
||||
onDownloadCSV: () => void;
|
||||
onDownloadXLSX: () => void;
|
||||
}
|
||||
|
||||
const DownloadDropdown = ({
|
||||
onDownloadCSV,
|
||||
onDownloadXLSX,
|
||||
}: DownloadDropdownProps) => {
|
||||
const theme = useTheme();
|
||||
return (
|
||||
<Dropdown
|
||||
trigger={['click']}
|
||||
menu={{
|
||||
onClick: ({ key }) => {
|
||||
if (key === 'csv') {
|
||||
onDownloadCSV();
|
||||
} else if (key === 'xlsx') {
|
||||
onDownloadXLSX();
|
||||
}
|
||||
},
|
||||
items: [
|
||||
{
|
||||
key: 'csv',
|
||||
label: t('Export to CSV'),
|
||||
icon: <Icons.FileOutlined />,
|
||||
},
|
||||
{
|
||||
key: 'xlsx',
|
||||
label: t('Export to Excel'),
|
||||
icon: <Icons.FileOutlined />,
|
||||
},
|
||||
],
|
||||
}}
|
||||
>
|
||||
<Tooltip title={t('Download')}>
|
||||
<span
|
||||
tabIndex={0}
|
||||
role="button"
|
||||
aria-label={t('Download')}
|
||||
data-test="drill-detail-download-btn"
|
||||
>
|
||||
<Icons.DownloadOutlined
|
||||
iconColor={theme.colorIcon}
|
||||
iconSize="l"
|
||||
css={css`
|
||||
&.anticon > * {
|
||||
line-height: 0;
|
||||
}
|
||||
`}
|
||||
/>
|
||||
</span>
|
||||
</Tooltip>
|
||||
</Dropdown>
|
||||
);
|
||||
};
|
||||
|
||||
export default DownloadDropdown;
|
||||
@@ -18,7 +18,12 @@
|
||||
*/
|
||||
import fetchMock from 'fetch-mock';
|
||||
import { QueryFormData, SupersetClient } from '@superset-ui/core';
|
||||
import { render, screen, waitFor } from 'spec/helpers/testing-library';
|
||||
import {
|
||||
render,
|
||||
screen,
|
||||
userEvent,
|
||||
waitFor,
|
||||
} from 'spec/helpers/testing-library';
|
||||
import { getMockStoreWithNativeFilters } from 'spec/fixtures/mockStore';
|
||||
import chartQueries, { sliceId } from 'spec/fixtures/mockChartQueries';
|
||||
import { supersetGetCache } from 'src/utils/cachedSupersetGet';
|
||||
@@ -189,6 +194,66 @@ test('should render the error', async () => {
|
||||
expect(screen.getByText('Error: Something went wrong')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
describe('download actions', () => {
|
||||
const renderWithDownloadPermission = () =>
|
||||
render(
|
||||
<DrillDetailPane
|
||||
initialFilters={[]}
|
||||
formData={chart.form_data as unknown as QueryFormData}
|
||||
/>,
|
||||
{
|
||||
useRedux: true,
|
||||
initialState: {
|
||||
user: { roles: { Admin: [['can_csv', 'Superset']] } },
|
||||
common: { conf: { SAMPLES_ROW_LIMIT: 10, ROW_LIMIT: 50000 } },
|
||||
dashboardInfo: { id: 123 },
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const clickDownloadItem = async (label: string) => {
|
||||
await userEvent.click(
|
||||
await screen.findByRole('button', { name: 'Download' }),
|
||||
);
|
||||
await userEvent.click(await screen.findByText(label));
|
||||
};
|
||||
|
||||
test('CSV export posts drill_detail payload with ROW_LIMIT', async () => {
|
||||
fetchWithData();
|
||||
const postFormSpy = jest
|
||||
.spyOn(SupersetClient, 'postForm')
|
||||
.mockImplementation(() => Promise.resolve());
|
||||
renderWithDownloadPermission();
|
||||
|
||||
await clickDownloadItem('Export to CSV');
|
||||
|
||||
expect(postFormSpy).toHaveBeenCalledTimes(1);
|
||||
const body = postFormSpy.mock.calls[0][1] as { form_data: string };
|
||||
const payload = JSON.parse(body.form_data);
|
||||
expect(payload.result_type).toBe('drill_detail');
|
||||
expect(payload.result_format).toBe('csv');
|
||||
expect(payload.queries[0].row_limit).toBe(50000);
|
||||
expect(payload.form_data.dashboardId).toBe(123);
|
||||
postFormSpy.mockRestore();
|
||||
});
|
||||
|
||||
test('XLSX export uses xlsx result_format', async () => {
|
||||
fetchWithData();
|
||||
const postFormSpy = jest
|
||||
.spyOn(SupersetClient, 'postForm')
|
||||
.mockImplementation(() => Promise.resolve());
|
||||
renderWithDownloadPermission();
|
||||
|
||||
await clickDownloadItem('Export to Excel');
|
||||
|
||||
expect(postFormSpy).toHaveBeenCalledTimes(1);
|
||||
const body = postFormSpy.mock.calls[0][1] as { form_data: string };
|
||||
const payload = JSON.parse(body.form_data);
|
||||
expect(payload.result_format).toBe('xlsx');
|
||||
postFormSpy.mockRestore();
|
||||
});
|
||||
});
|
||||
|
||||
test('should use verbose_map for column headers when available', async () => {
|
||||
jest.restoreAllMocks();
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import {
|
||||
ensureIsArray,
|
||||
JsonObject,
|
||||
QueryFormData,
|
||||
SupersetClient,
|
||||
} from '@superset-ui/core';
|
||||
import { css, useTheme } from '@apache-superset/core/theme';
|
||||
import { GenericDataType } from '@apache-superset/core/common';
|
||||
@@ -47,6 +48,10 @@ import Table, {
|
||||
TableSize,
|
||||
} from '@superset-ui/core/components/Table';
|
||||
import { RootState } from 'src/dashboard/types';
|
||||
import { usePermissions } from 'src/hooks/usePermissions';
|
||||
import { useToasts } from 'src/components/MessageToasts/withToasts';
|
||||
import { ensureAppRoot } from 'src/utils/pathUtils';
|
||||
import { safeStringify } from 'src/utils/safeStringify';
|
||||
import HeaderWithRadioGroup from '@superset-ui/core/components/Table/header-renderers/HeaderWithRadioGroup';
|
||||
import { useDatasetMetadataBar } from 'src/features/datasets/metadataBar/useDatasetMetadataBar';
|
||||
import { Dataset } from '../types';
|
||||
@@ -108,6 +113,13 @@ export default function DrillDetailPane({
|
||||
state.common.conf.SAMPLES_ROW_LIMIT,
|
||||
);
|
||||
|
||||
const ROW_LIMIT = useSelector(
|
||||
(state: { common: { conf: JsonObject } }) => state.common.conf.ROW_LIMIT,
|
||||
);
|
||||
|
||||
const { canDownload } = usePermissions();
|
||||
const { addDangerToast } = useToasts();
|
||||
|
||||
// Extract datasource ID/type from string ID
|
||||
const [datasourceId, datasourceType] = useMemo(
|
||||
() => formData.datasource.split('__'),
|
||||
@@ -207,6 +219,64 @@ export default function DrillDetailPane({
|
||||
setPageIndex(0);
|
||||
}, []);
|
||||
|
||||
const handleDownload = useCallback(
|
||||
(exportType: 'csv' | 'xlsx') => {
|
||||
const drillPayload = getDrillPayload(formData, filters);
|
||||
if (!drillPayload) {
|
||||
addDangerToast(t('Unable to generate download payload'));
|
||||
return;
|
||||
}
|
||||
const payload: JsonObject = {
|
||||
datasource: {
|
||||
id: parseInt(datasourceId, 10),
|
||||
type: datasourceType,
|
||||
},
|
||||
queries: [
|
||||
{
|
||||
...drillPayload,
|
||||
columns: [],
|
||||
metrics: [],
|
||||
orderby: [],
|
||||
row_limit: ROW_LIMIT,
|
||||
row_offset: 0,
|
||||
},
|
||||
],
|
||||
result_type: 'drill_detail',
|
||||
result_format: exportType,
|
||||
force: false,
|
||||
};
|
||||
if (dashboardId) {
|
||||
payload.form_data = { dashboardId };
|
||||
}
|
||||
SupersetClient.postForm(ensureAppRoot('/api/v1/chart/data'), {
|
||||
form_data: safeStringify(payload),
|
||||
}).catch(error => {
|
||||
addDangerToast(
|
||||
t('Failed to generate download: %s', error.message || error),
|
||||
);
|
||||
});
|
||||
},
|
||||
[
|
||||
formData,
|
||||
filters,
|
||||
datasourceId,
|
||||
datasourceType,
|
||||
ROW_LIMIT,
|
||||
dashboardId,
|
||||
addDangerToast,
|
||||
],
|
||||
);
|
||||
|
||||
const handleDownloadCSV = useCallback(
|
||||
() => handleDownload('csv'),
|
||||
[handleDownload],
|
||||
);
|
||||
|
||||
const handleDownloadXLSX = useCallback(
|
||||
() => handleDownload('xlsx'),
|
||||
[handleDownload],
|
||||
);
|
||||
|
||||
// Clear cache and reset page index if filters change
|
||||
useEffect(() => {
|
||||
setResponseError('');
|
||||
@@ -338,6 +408,11 @@ export default function DrillDetailPane({
|
||||
totalCount={resultsPage?.total}
|
||||
loading={isLoading}
|
||||
onReload={handleReload}
|
||||
canDownload={canDownload}
|
||||
onDownloadCSV={handleDownloadCSV}
|
||||
onDownloadXLSX={handleDownloadXLSX}
|
||||
data={data}
|
||||
columnNames={resultsPage?.colNames}
|
||||
/>
|
||||
)}
|
||||
{tableContent}
|
||||
|
||||
@@ -33,4 +33,9 @@ InteractiveTableControls.args = {
|
||||
{ op: '>', col: 'tz_offset', val: 200 },
|
||||
{ op: '==', col: 'platform', val: 'GB' },
|
||||
],
|
||||
canDownload: true,
|
||||
onDownloadCSV: () => {},
|
||||
onDownloadXLSX: () => {},
|
||||
onReload: () => {},
|
||||
loading: false,
|
||||
};
|
||||
|
||||
@@ -17,20 +17,27 @@
|
||||
* under the License.
|
||||
*/
|
||||
import { render, screen, userEvent } from 'spec/helpers/testing-library';
|
||||
import TableControls from './DrillDetailTableControls';
|
||||
import TableControls, { TableControlsProps } from './DrillDetailTableControls';
|
||||
|
||||
const setFilters = jest.fn();
|
||||
const onReload = jest.fn();
|
||||
const setup = (overrides: Record<string, any> = {}) => {
|
||||
const onDownloadCSV = jest.fn();
|
||||
const onDownloadXLSX = jest.fn();
|
||||
const setup = (overrides: Partial<TableControlsProps> = {}) => {
|
||||
const props = {
|
||||
filters: [],
|
||||
setFilters,
|
||||
onReload,
|
||||
loading: false,
|
||||
totalCount: 0,
|
||||
canDownload: true,
|
||||
onDownloadCSV,
|
||||
onDownloadXLSX,
|
||||
data: [],
|
||||
columnNames: [],
|
||||
...overrides,
|
||||
};
|
||||
return render(<TableControls {...props} />);
|
||||
return render(<TableControls {...props} />, { useRedux: true });
|
||||
};
|
||||
test('should render', () => {
|
||||
const { container } = setup();
|
||||
|
||||
@@ -27,6 +27,11 @@ import {
|
||||
import { css, useTheme } from '@apache-superset/core/theme';
|
||||
import RowCountLabel from 'src/components/RowCountLabel';
|
||||
import { Icons } from '@superset-ui/core/components/Icons';
|
||||
import { Tooltip } from '@superset-ui/core/components';
|
||||
import { CopyToClipboardButton } from 'src/explore/components/DataTableControl';
|
||||
import { TabularDataRow } from 'src/utils/common';
|
||||
import { usePermissions } from 'src/hooks/usePermissions';
|
||||
import DownloadDropdown from './DownloadDropdown';
|
||||
|
||||
export type TableControlsProps = {
|
||||
filters: BinaryQueryObjectFilterClause[];
|
||||
@@ -34,6 +39,11 @@ export type TableControlsProps = {
|
||||
totalCount?: number;
|
||||
loading: boolean;
|
||||
onReload: () => void;
|
||||
canDownload: boolean;
|
||||
onDownloadCSV: () => void;
|
||||
onDownloadXLSX: () => void;
|
||||
data?: TabularDataRow[];
|
||||
columnNames?: string[];
|
||||
};
|
||||
|
||||
export default function TableControls({
|
||||
@@ -42,8 +52,14 @@ export default function TableControls({
|
||||
totalCount,
|
||||
loading,
|
||||
onReload,
|
||||
canDownload,
|
||||
onDownloadCSV,
|
||||
onDownloadXLSX,
|
||||
data,
|
||||
columnNames,
|
||||
}: TableControlsProps) {
|
||||
const theme = useTheme();
|
||||
const { canCopyClipboard: copyEnabled } = usePermissions();
|
||||
const filterMap: Record<string, BinaryQueryObjectFilterClause> = useMemo(
|
||||
() =>
|
||||
Object.assign(
|
||||
@@ -118,16 +134,38 @@ export default function TableControls({
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: min-content;
|
||||
gap: ${theme.sizeUnit * 3}px;
|
||||
`}
|
||||
>
|
||||
<RowCountLabel loading={loading && !totalCount} rowcount={totalCount} />
|
||||
<Icons.ReloadOutlined
|
||||
iconColor={theme.colorIcon}
|
||||
iconSize="l"
|
||||
aria-label={t('Reload')}
|
||||
role="button"
|
||||
onClick={onReload}
|
||||
/>
|
||||
{canDownload && (
|
||||
<DownloadDropdown
|
||||
onDownloadCSV={onDownloadCSV}
|
||||
onDownloadXLSX={onDownloadXLSX}
|
||||
/>
|
||||
)}
|
||||
{copyEnabled ? (
|
||||
<CopyToClipboardButton data={data} columns={columnNames} />
|
||||
) : (
|
||||
<Tooltip title={t("You don't have permission to copy to clipboard")}>
|
||||
<span>
|
||||
<CopyToClipboardButton
|
||||
data={data}
|
||||
columns={columnNames}
|
||||
disabled
|
||||
/>
|
||||
</span>
|
||||
</Tooltip>
|
||||
)}
|
||||
<Tooltip title={t('Reload')}>
|
||||
<Icons.ReloadOutlined
|
||||
iconColor={theme.colorIcon}
|
||||
iconSize="l"
|
||||
aria-label={t('Reload')}
|
||||
role="button"
|
||||
onClick={onReload}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
/**
|
||||
* 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 fetchMock from 'fetch-mock';
|
||||
import { ChartCustomization, ChartCustomizationType } from '@superset-ui/core';
|
||||
import {
|
||||
setInScopeStatusOfCustomizations,
|
||||
saveChartCustomization,
|
||||
} from './chartCustomizationActions';
|
||||
import { SET_IN_SCOPE_STATUS_OF_FILTERS } from './nativeFilters';
|
||||
import { DASHBOARD_INFO_UPDATED } from './dashboardInfo';
|
||||
|
||||
beforeAll(() => fetchMock.mockGlobal());
|
||||
afterAll(() => fetchMock.hardReset());
|
||||
afterEach(() => fetchMock.clearHistory().removeRoutes());
|
||||
|
||||
function setup(stateOverrides: Record<string, unknown> = {}) {
|
||||
const state = {
|
||||
nativeFilters: {
|
||||
filters: {},
|
||||
},
|
||||
dashboardInfo: {
|
||||
metadata: {
|
||||
chart_customization_config: [],
|
||||
},
|
||||
},
|
||||
...stateOverrides,
|
||||
};
|
||||
const getState = jest.fn(() => state) as unknown as () => any;
|
||||
const dispatch = jest.fn();
|
||||
return { getState, dispatch, state };
|
||||
}
|
||||
|
||||
test('setInScopeStatusOfCustomizations filters null entries from chart_customization_config', () => {
|
||||
const { getState, dispatch } = setup({
|
||||
nativeFilters: {
|
||||
filters: {
|
||||
'CUSTOM-1': {
|
||||
id: 'CUSTOM-1',
|
||||
name: 'Group By',
|
||||
chartsInScope: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
dashboardInfo: {
|
||||
metadata: {
|
||||
chart_customization_config: [
|
||||
null,
|
||||
{ id: 'CUSTOM-1', name: 'Group By', chartsInScope: [] },
|
||||
null,
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const thunk = setInScopeStatusOfCustomizations([
|
||||
{
|
||||
customizationId: 'CUSTOM-1',
|
||||
chartsInScope: [10, 20],
|
||||
tabsInScope: ['TAB-A'],
|
||||
},
|
||||
]);
|
||||
thunk(dispatch, getState, null);
|
||||
|
||||
// Should dispatch SET_IN_SCOPE_STATUS_OF_FILTERS for the matching filter
|
||||
expect(dispatch).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ type: SET_IN_SCOPE_STATUS_OF_FILTERS }),
|
||||
);
|
||||
|
||||
// Should dispatch DASHBOARD_INFO_UPDATED with only the valid config item (nulls stripped)
|
||||
const infoUpdateCall = dispatch.mock.calls.find(
|
||||
([action]: [{ type: string }]) => action.type === DASHBOARD_INFO_UPDATED,
|
||||
);
|
||||
expect(infoUpdateCall).toBeDefined();
|
||||
const updatedConfig =
|
||||
infoUpdateCall[0].newInfo.metadata.chart_customization_config;
|
||||
expect(updatedConfig).toHaveLength(1);
|
||||
expect(updatedConfig[0].id).toBe('CUSTOM-1');
|
||||
expect(updatedConfig[0].chartsInScope).toEqual([10, 20]);
|
||||
expect(updatedConfig[0].tabsInScope).toEqual(['TAB-A']);
|
||||
});
|
||||
|
||||
test('setInScopeStatusOfCustomizations filters undefined entries from chart_customization_config', () => {
|
||||
const { getState, dispatch } = setup({
|
||||
nativeFilters: {
|
||||
filters: {
|
||||
'CUSTOM-1': {
|
||||
id: 'CUSTOM-1',
|
||||
name: 'Group By',
|
||||
chartsInScope: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
dashboardInfo: {
|
||||
metadata: {
|
||||
chart_customization_config: [
|
||||
undefined,
|
||||
{ id: 'CUSTOM-1', name: 'Group By', chartsInScope: [] },
|
||||
undefined,
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const thunk = setInScopeStatusOfCustomizations([
|
||||
{
|
||||
customizationId: 'CUSTOM-1',
|
||||
chartsInScope: [10, 20],
|
||||
tabsInScope: ['TAB-A'],
|
||||
},
|
||||
]);
|
||||
thunk(dispatch, getState, null);
|
||||
|
||||
const infoUpdateCall = dispatch.mock.calls.find(
|
||||
([action]: [{ type: string }]) => action.type === DASHBOARD_INFO_UPDATED,
|
||||
);
|
||||
expect(infoUpdateCall).toBeDefined();
|
||||
const updatedConfig =
|
||||
infoUpdateCall[0].newInfo.metadata.chart_customization_config;
|
||||
expect(updatedConfig).toHaveLength(1);
|
||||
expect(updatedConfig[0].id).toBe('CUSTOM-1');
|
||||
expect(updatedConfig[0].chartsInScope).toEqual([10, 20]);
|
||||
});
|
||||
|
||||
test('setInScopeStatusOfCustomizations handles config that is entirely null entries', () => {
|
||||
const { getState, dispatch } = setup({
|
||||
nativeFilters: { filters: {} },
|
||||
dashboardInfo: {
|
||||
metadata: {
|
||||
chart_customization_config: [null, null],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const thunk = setInScopeStatusOfCustomizations([
|
||||
{
|
||||
customizationId: 'CUSTOM-MISSING',
|
||||
chartsInScope: [10],
|
||||
tabsInScope: [],
|
||||
},
|
||||
]);
|
||||
thunk(dispatch, getState, null);
|
||||
|
||||
// Should still dispatch the info update with an empty config
|
||||
const infoUpdateCall = dispatch.mock.calls.find(
|
||||
([action]: [{ type: string }]) => action.type === DASHBOARD_INFO_UPDATED,
|
||||
);
|
||||
expect(infoUpdateCall).toBeDefined();
|
||||
expect(
|
||||
infoUpdateCall[0].newInfo.metadata.chart_customization_config,
|
||||
).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('setInScopeStatusOfCustomizations works with undefined metadata', () => {
|
||||
const { getState, dispatch } = setup({
|
||||
nativeFilters: { filters: {} },
|
||||
dashboardInfo: { metadata: undefined },
|
||||
});
|
||||
|
||||
const thunk = setInScopeStatusOfCustomizations([
|
||||
{
|
||||
customizationId: 'CUSTOM-1',
|
||||
chartsInScope: [10],
|
||||
tabsInScope: [],
|
||||
},
|
||||
]);
|
||||
thunk(dispatch, getState, null);
|
||||
|
||||
const infoUpdateCall = dispatch.mock.calls.find(
|
||||
([action]: [{ type: string }]) => action.type === DASHBOARD_INFO_UPDATED,
|
||||
);
|
||||
expect(infoUpdateCall).toBeDefined();
|
||||
expect(
|
||||
infoUpdateCall[0].newInfo.metadata.chart_customization_config,
|
||||
).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('saveChartCustomization filters null entries from currentConfig before merging', async () => {
|
||||
const customization: ChartCustomization = {
|
||||
id: 'CUSTOM-1',
|
||||
type: ChartCustomizationType.ChartCustomization,
|
||||
name: 'Group By',
|
||||
filterType: 'chart_customization_dynamic_groupby',
|
||||
targets: [{}],
|
||||
scope: { rootPath: ['ROOT_ID'], excluded: [] },
|
||||
chartsInScope: [10],
|
||||
tabsInScope: ['TAB-A'],
|
||||
defaultDataMask: {},
|
||||
controlValues: {},
|
||||
};
|
||||
|
||||
fetchMock.put('glob:*/api/v1/dashboard/1/chart_customizations', {
|
||||
result: [customization],
|
||||
});
|
||||
|
||||
const { getState, dispatch } = setup({
|
||||
nativeFilters: { filters: {} },
|
||||
dashboardInfo: {
|
||||
id: 1,
|
||||
metadata: {
|
||||
chart_customization_config: [
|
||||
null,
|
||||
{ id: 'CUSTOM-1', name: 'Group By', chartsInScope: [10] },
|
||||
null,
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const thunk = saveChartCustomization([customization], [], [], false);
|
||||
await thunk(dispatch, getState, null);
|
||||
|
||||
// DASHBOARD_INFO_UPDATED should have merged config without nulls
|
||||
const infoUpdateCall = dispatch.mock.calls.find(
|
||||
([action]: [{ type: string }]) => action.type === DASHBOARD_INFO_UPDATED,
|
||||
);
|
||||
expect(infoUpdateCall).toBeDefined();
|
||||
const config = infoUpdateCall[0].newInfo.metadata.chart_customization_config;
|
||||
expect(config.every((item: unknown) => item !== null)).toBe(true);
|
||||
});
|
||||
|
||||
test('saveChartCustomization filters null entries from oldConfig when resetDataMask is true', async () => {
|
||||
const customization: ChartCustomization = {
|
||||
id: 'CUSTOM-1',
|
||||
type: ChartCustomizationType.ChartCustomization,
|
||||
name: 'Group By',
|
||||
filterType: 'chart_customization_dynamic_groupby',
|
||||
targets: [{}],
|
||||
scope: { rootPath: ['ROOT_ID'], excluded: [] },
|
||||
chartsInScope: [10],
|
||||
tabsInScope: ['TAB-A'],
|
||||
defaultDataMask: {},
|
||||
controlValues: {},
|
||||
};
|
||||
|
||||
fetchMock.put('glob:*/api/v1/dashboard/1/chart_customizations', {
|
||||
result: [customization],
|
||||
});
|
||||
|
||||
const { getState, dispatch } = setup({
|
||||
nativeFilters: { filters: {} },
|
||||
dashboardInfo: {
|
||||
id: 1,
|
||||
metadata: {
|
||||
chart_customization_config: [
|
||||
null,
|
||||
{ id: 'CUSTOM-1', name: 'Group By', chartsInScope: [10] },
|
||||
null,
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const thunk = saveChartCustomization([customization], [], [], true);
|
||||
|
||||
// Should not throw when building oldCustomizationsById from null-containing config
|
||||
await expect(thunk(dispatch, getState, null)).resolves.toBeDefined();
|
||||
});
|
||||
@@ -107,7 +107,8 @@ export function saveChartCustomization(
|
||||
});
|
||||
|
||||
const currentMetadata = getState().dashboardInfo.metadata;
|
||||
const currentConfig = currentMetadata?.chart_customization_config || [];
|
||||
const currentConfig =
|
||||
currentMetadata?.chart_customization_config?.filter(Boolean) || [];
|
||||
|
||||
const mergedResult = response.result.map(
|
||||
(item: ChartCustomization | ChartCustomizationDivider) => {
|
||||
@@ -148,7 +149,8 @@ export function saveChartCustomization(
|
||||
);
|
||||
|
||||
if (resetDataMask) {
|
||||
const oldConfig = metadata?.chart_customization_config || [];
|
||||
const oldConfig =
|
||||
metadata?.chart_customization_config?.filter(Boolean) || [];
|
||||
const oldCustomizationsById = oldConfig.reduce<
|
||||
Record<string, ChartCustomization | ChartCustomizationDivider>
|
||||
>((acc, customization) => {
|
||||
@@ -333,7 +335,8 @@ export function setInScopeStatusOfCustomizations(
|
||||
}
|
||||
|
||||
const { metadata } = getState().dashboardInfo;
|
||||
const customizationConfig = metadata?.chart_customization_config || [];
|
||||
const customizationConfig =
|
||||
metadata?.chart_customization_config?.filter(Boolean) || [];
|
||||
|
||||
const scopeMap = new Map(
|
||||
customizationScopes.map(
|
||||
|
||||
@@ -293,15 +293,17 @@ export const hydrateDashboard =
|
||||
directPathToChild.push(directLinkComponentId);
|
||||
}
|
||||
|
||||
const rawChartCustomizations =
|
||||
(metadata?.chart_customization_config as JsonObject[]) || [];
|
||||
const rawChartCustomizations = (
|
||||
(metadata?.chart_customization_config as JsonObject[]) || []
|
||||
).filter(Boolean);
|
||||
|
||||
const chartCustomizations = migrateChartCustomizationArray(
|
||||
rawChartCustomizations,
|
||||
);
|
||||
|
||||
const filters =
|
||||
(metadata?.native_filter_configuration as JsonObject[]) || [];
|
||||
const filters = (
|
||||
(metadata?.native_filter_configuration as JsonObject[]) || []
|
||||
).filter(Boolean);
|
||||
const combinedFilters = [...filters, ...chartCustomizations];
|
||||
|
||||
const nativeFilters = getInitialNativeFilterState({
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { render, waitFor } from 'spec/helpers/testing-library';
|
||||
import { render, screen, waitFor } from 'spec/helpers/testing-library';
|
||||
import fetchMock from 'fetch-mock';
|
||||
import { storeWithState } from 'spec/fixtures/mockStore';
|
||||
import mockState from 'spec/fixtures/mockState';
|
||||
@@ -700,6 +700,136 @@ test('returns empty scope data for chart customization dividers', async () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('does not crash when chart_customization_config contains a legacy item with customization: null', async () => {
|
||||
const nullCustomizationId = 'CHART_CUSTOMIZATION-null-1';
|
||||
const originalFn = chartCustomizationActions.setInScopeStatusOfCustomizations;
|
||||
const spy = jest.spyOn(
|
||||
chartCustomizationActions,
|
||||
'setInScopeStatusOfCustomizations',
|
||||
);
|
||||
spy.mockImplementation(args => originalFn(args));
|
||||
|
||||
try {
|
||||
const state = {
|
||||
dashboardInfo: {
|
||||
...mockState.dashboardInfo,
|
||||
metadata: {
|
||||
...mockState.dashboardInfo.metadata,
|
||||
native_filter_configuration: [],
|
||||
chart_customization_config: [
|
||||
{
|
||||
id: nullCustomizationId,
|
||||
customization: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
nativeFilters: {
|
||||
filters: {
|
||||
[nullCustomizationId]: {
|
||||
id: nullCustomizationId,
|
||||
chartsInScope: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
setup(state);
|
||||
expect(screen.getByTestId('mock-dashboard-grid')).toBeInTheDocument();
|
||||
} finally {
|
||||
spy.mockRestore();
|
||||
}
|
||||
});
|
||||
|
||||
test('does not crash when chart_customization_config contains a null entry', async () => {
|
||||
setup({
|
||||
dashboardInfo: {
|
||||
...mockState.dashboardInfo,
|
||||
metadata: {
|
||||
...mockState.dashboardInfo.metadata,
|
||||
native_filter_configuration: [],
|
||||
chart_customization_config: [null],
|
||||
},
|
||||
},
|
||||
nativeFilters: { filters: {} },
|
||||
});
|
||||
expect(screen.getByTestId('mock-dashboard-grid')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('does not crash when chart_customization_config contains an undefined entry', async () => {
|
||||
setup({
|
||||
dashboardInfo: {
|
||||
...mockState.dashboardInfo,
|
||||
metadata: {
|
||||
...mockState.dashboardInfo.metadata,
|
||||
native_filter_configuration: [],
|
||||
chart_customization_config: [undefined],
|
||||
},
|
||||
},
|
||||
nativeFilters: { filters: {} },
|
||||
});
|
||||
expect(screen.getByTestId('mock-dashboard-grid')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('does not crash when chart_customization_config mixes null and new-format items', async () => {
|
||||
const customizationId = 'CHART_CUSTOMIZATION-new-format-1';
|
||||
const originalFn = chartCustomizationActions.setInScopeStatusOfCustomizations;
|
||||
const spy = jest.spyOn(
|
||||
chartCustomizationActions,
|
||||
'setInScopeStatusOfCustomizations',
|
||||
);
|
||||
spy.mockImplementation(args => originalFn(args));
|
||||
|
||||
try {
|
||||
setup({
|
||||
dashboardInfo: {
|
||||
...mockState.dashboardInfo,
|
||||
metadata: {
|
||||
...mockState.dashboardInfo.metadata,
|
||||
native_filter_configuration: [],
|
||||
chart_customization_config: [
|
||||
null,
|
||||
{
|
||||
id: customizationId,
|
||||
type: 'CHART_CUSTOMIZATION',
|
||||
name: 'Dynamic Group By',
|
||||
filterType: 'chart_customization_dynamic_groupby',
|
||||
targets: [{ datasetId: 1, column: { name: 'status' } }],
|
||||
scope: { rootPath: ['ROOT_ID'], excluded: [] },
|
||||
chartsInScope: [],
|
||||
defaultDataMask: {},
|
||||
controlValues: {},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
nativeFilters: {
|
||||
filters: {
|
||||
[customizationId]: {
|
||||
id: customizationId,
|
||||
type: 'CHART_CUSTOMIZATION',
|
||||
chartsInScope: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(screen.getByTestId('mock-dashboard-grid')).toBeInTheDocument();
|
||||
|
||||
await waitFor(() => {
|
||||
expect(spy).toHaveBeenCalledWith(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
customizationId,
|
||||
chartsInScope: [sliceId],
|
||||
}),
|
||||
]),
|
||||
);
|
||||
});
|
||||
} finally {
|
||||
spy.mockRestore();
|
||||
}
|
||||
});
|
||||
|
||||
test('does not dispatch setInScopeStatusOfCustomizations when chart_customization_config is empty', async () => {
|
||||
const spy = jest.spyOn(
|
||||
chartCustomizationActions,
|
||||
|
||||
@@ -93,11 +93,13 @@ function normalizeChartCustomizationsForScopeCalculation(
|
||||
chartCustomizations: ChartCustomizationConfiguration,
|
||||
chartIds: number[],
|
||||
): ChartCustomizationConfiguration {
|
||||
if (!chartCustomizations.some(isLegacyChartCustomizationFormat)) {
|
||||
return chartCustomizations;
|
||||
const truthyCustomizations = chartCustomizations.filter(Boolean);
|
||||
|
||||
if (!truthyCustomizations.some(isLegacyChartCustomizationFormat)) {
|
||||
return truthyCustomizations;
|
||||
}
|
||||
|
||||
return chartCustomizations.map(item => {
|
||||
return truthyCustomizations.map(item => {
|
||||
if (!isLegacyChartCustomizationFormat(item)) {
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ function getCheckboxIcon(element: HTMLElement): Element {
|
||||
* checkbox state change is the fill color of the SVG icon.
|
||||
*/
|
||||
function getCheckboxState(name: string): CheckboxState {
|
||||
const element = screen.getByRole('link', { name });
|
||||
const element = screen.getByRole('button', { name });
|
||||
const svgPath = getCheckboxIcon(element).children[1].children[0].children[0];
|
||||
const fill = svgPath.getAttribute('fill');
|
||||
return fill === supersetTheme.colorPrimary
|
||||
@@ -183,7 +183,7 @@ function getCheckboxState(name: string): CheckboxState {
|
||||
|
||||
// Replace the original clickCheckbox function with the async version
|
||||
async function clickCheckbox(name: string) {
|
||||
const element = screen.getByRole('link', { name });
|
||||
const element = screen.getByRole('button', { name });
|
||||
const checkboxLabel = getCheckboxIcon(element);
|
||||
await userEvent.click(checkboxLabel);
|
||||
}
|
||||
@@ -204,11 +204,11 @@ test('renders with empty filters', () => {
|
||||
|
||||
test('renders with filters values', () => {
|
||||
render(<FilterScopeSelector {...createProps()} />, { useRedux: true });
|
||||
expect(screen.getByRole('link', { name: FILTER_A })).toBeInTheDocument();
|
||||
expect(screen.getByRole('link', { name: FILTER_B })).toBeInTheDocument();
|
||||
expect(screen.getByRole('link', { name: FILTER_C })).toBeInTheDocument();
|
||||
expect(screen.getByRole('link', { name: TAB_A })).toBeInTheDocument();
|
||||
expect(screen.getByRole('link', { name: TAB_B })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: FILTER_A })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: FILTER_B })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: FILTER_C })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: TAB_A })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: TAB_B })).toBeInTheDocument();
|
||||
expect(screen.queryByText(CHART_A)).not.toBeInTheDocument();
|
||||
expect(screen.queryByText(CHART_B)).not.toBeInTheDocument();
|
||||
expect(screen.queryByText(CHART_C)).not.toBeInTheDocument();
|
||||
@@ -222,21 +222,21 @@ test('collapses/expands all filters', () => {
|
||||
useRedux: true,
|
||||
});
|
||||
userEvent.click(screen.getAllByRole('button', { name: COLLAPSE_ALL })[0]);
|
||||
expect(screen.getByRole('link', { name: ALL_FILTERS })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: ALL_FILTERS })).toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByRole('link', { name: FILTER_A }),
|
||||
screen.queryByRole('button', { name: FILTER_A }),
|
||||
).not.toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByRole('link', { name: FILTER_B }),
|
||||
screen.queryByRole('button', { name: FILTER_B }),
|
||||
).not.toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByRole('link', { name: FILTER_C }),
|
||||
screen.queryByRole('button', { name: FILTER_C }),
|
||||
).not.toBeInTheDocument();
|
||||
userEvent.click(screen.getAllByRole('button', { name: EXPAND_ALL })[0]);
|
||||
expect(screen.getByRole('link', { name: ALL_FILTERS })).toBeInTheDocument();
|
||||
expect(screen.getByRole('link', { name: FILTER_A })).toBeInTheDocument();
|
||||
expect(screen.getByRole('link', { name: FILTER_B })).toBeInTheDocument();
|
||||
expect(screen.getByRole('link', { name: FILTER_C })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: ALL_FILTERS })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: FILTER_A })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: FILTER_B })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: FILTER_C })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('collapses/expands all charts', () => {
|
||||
@@ -251,10 +251,10 @@ test('collapses/expands all charts', () => {
|
||||
expect(screen.queryByText(CHART_D)).not.toBeInTheDocument();
|
||||
userEvent.click(screen.getAllByRole('button', { name: EXPAND_ALL })[1]);
|
||||
expect(screen.getByText(ALL_CHARTS)).toBeInTheDocument();
|
||||
expect(screen.getByRole('link', { name: CHART_A })).toBeInTheDocument();
|
||||
expect(screen.getByRole('link', { name: CHART_B })).toBeInTheDocument();
|
||||
expect(screen.getByRole('link', { name: CHART_C })).toBeInTheDocument();
|
||||
expect(screen.getByRole('link', { name: CHART_D })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: CHART_A })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: CHART_B })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: CHART_C })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: CHART_D })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('searches for a chart', () => {
|
||||
@@ -262,9 +262,13 @@ test('searches for a chart', () => {
|
||||
useRedux: true,
|
||||
});
|
||||
userEvent.type(screen.getByPlaceholderText('Search...'), CHART_C);
|
||||
expect(screen.queryByRole('link', { name: CHART_A })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole('link', { name: CHART_B })).not.toBeInTheDocument();
|
||||
expect(screen.getByRole('link', { name: CHART_C })).toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByRole('button', { name: CHART_A }),
|
||||
).not.toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByRole('button', { name: CHART_B }),
|
||||
).not.toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: CHART_C })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
// Update all tests that use clickCheckbox to be async and await the function call
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
* 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 { ReactNode } from 'react';
|
||||
import { render, screen } from 'spec/helpers/testing-library';
|
||||
import {
|
||||
ChartCustomization,
|
||||
ChartCustomizationType,
|
||||
Filter,
|
||||
NativeFilterType,
|
||||
} from '@superset-ui/core';
|
||||
import { ChartCustomizationPlugins } from 'src/constants';
|
||||
import FilterControl from './FilterControl';
|
||||
|
||||
jest.mock('src/dashboard/components/nativeFilters/state', () => ({
|
||||
useIsFilterInScope: () => () => false,
|
||||
}));
|
||||
|
||||
jest.mock('../Vertical', () => {
|
||||
const { createContext } = require('react');
|
||||
return {
|
||||
FilterBarScrollContext: createContext(false),
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock('./FilterValue', () => () => null);
|
||||
|
||||
jest.mock('../../FilterCard', () => ({
|
||||
FilterCard: ({ children }: { children: ReactNode }) => <>{children}</>,
|
||||
}));
|
||||
|
||||
jest.mock('./GroupByFilterCard', () => () => null);
|
||||
|
||||
jest.mock('../utils', () => ({
|
||||
checkIsMissingRequiredValue: () => false,
|
||||
}));
|
||||
|
||||
jest.mock('react-reverse-portal', () => ({
|
||||
createHtmlPortalNode: () => ({}),
|
||||
InPortal: ({ children }: { children: ReactNode }) => <>{children}</>,
|
||||
OutPortal: () => null,
|
||||
}));
|
||||
|
||||
const deckglFilter: ChartCustomization = {
|
||||
id: 'filter1',
|
||||
name: 'Layer Visibility',
|
||||
filterType: ChartCustomizationPlugins.DeckglLayerVisibility,
|
||||
type: ChartCustomizationType.ChartCustomization,
|
||||
targets: [],
|
||||
scope: { rootPath: [], excluded: [] },
|
||||
controlValues: {},
|
||||
defaultDataMask: {},
|
||||
};
|
||||
|
||||
const nativeFilter: Filter = {
|
||||
id: 'filter2',
|
||||
name: 'Select Filter',
|
||||
filterType: 'filter_select',
|
||||
type: NativeFilterType.NativeFilter,
|
||||
targets: [],
|
||||
scope: { rootPath: [], excluded: [] },
|
||||
controlValues: {},
|
||||
defaultDataMask: {},
|
||||
cascadeParentIds: [],
|
||||
description: '',
|
||||
};
|
||||
|
||||
test('renders DeckglLayerVisibilityTooltip for deckgl layer visibility filter type', () => {
|
||||
render(
|
||||
<FilterControl filter={deckglFilter} onFilterSelectionChange={jest.fn()} />,
|
||||
);
|
||||
expect(
|
||||
screen.getByTestId('deckgl-layer-visibility-tooltip-icon'),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('does not render DeckglLayerVisibilityTooltip for standard filter type', () => {
|
||||
render(
|
||||
<FilterControl filter={nativeFilter} onFilterSelectionChange={jest.fn()} />,
|
||||
);
|
||||
expect(
|
||||
screen.queryByTestId('deckgl-layer-visibility-tooltip-icon'),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
} from 'react-reverse-portal';
|
||||
import { FilterBarOrientation } from 'src/dashboard/types';
|
||||
import { isChartCustomization } from '@superset-ui/core';
|
||||
import { ChartCustomizationPlugins } from 'src/constants';
|
||||
import { checkIsMissingRequiredValue } from '../utils';
|
||||
import FilterValue from './FilterValue';
|
||||
import { FilterCard } from '../../FilterCard';
|
||||
@@ -35,6 +36,7 @@ import {
|
||||
FilterStyledIcon,
|
||||
RequiredFieldIndicator,
|
||||
DescriptionToolTip,
|
||||
DeckglLayerVisibilityTooltip,
|
||||
useFilterControlDisplay,
|
||||
} from './FilterControlShared';
|
||||
import GroupByFilterCard from './GroupByFilterCard';
|
||||
@@ -85,6 +87,10 @@ const FilterControl = ({
|
||||
{filter.description?.trim() && (
|
||||
<DescriptionToolTip description={filter.description} />
|
||||
)}
|
||||
{filter.filterType ===
|
||||
ChartCustomizationPlugins.DeckglLayerVisibility && (
|
||||
<DeckglLayerVisibilityTooltip />
|
||||
)}
|
||||
<FilterStyledIcon data-test="filter-icon">{icon}</FilterStyledIcon>
|
||||
</FilterControlTitleBox>
|
||||
),
|
||||
@@ -94,6 +100,7 @@ const FilterControl = ({
|
||||
name,
|
||||
isRequired,
|
||||
filter.description,
|
||||
filter.filterType,
|
||||
icon,
|
||||
],
|
||||
);
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* 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 'spec/helpers/testing-library';
|
||||
import { DeckglLayerVisibilityTooltip } from './FilterControlShared';
|
||||
|
||||
test('renders DeckglLayerVisibilityTooltip with icon button', () => {
|
||||
render(<DeckglLayerVisibilityTooltip />);
|
||||
expect(screen.getByRole('button')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('shows tooltip content on hover for DeckglLayerVisibilityTooltip', async () => {
|
||||
render(<DeckglLayerVisibilityTooltip />);
|
||||
userEvent.hover(screen.getByRole('button'));
|
||||
const tooltip = await screen.findByRole('tooltip');
|
||||
expect(tooltip).toHaveTextContent(
|
||||
'Choose layers to hide from all deck.gl Multiple Layer charts in this dashboard.',
|
||||
);
|
||||
});
|
||||
@@ -19,6 +19,7 @@
|
||||
import { useMemo } from 'react';
|
||||
import { truncationCSS } from '@superset-ui/core';
|
||||
import { styled, SupersetTheme } from '@apache-superset/core/theme';
|
||||
import { t } from '@apache-superset/core/translation';
|
||||
import {
|
||||
FormItem as StyledFormItem,
|
||||
Form,
|
||||
@@ -201,6 +202,10 @@ const ToolTipContainer = styled.div`
|
||||
display: flex;
|
||||
`;
|
||||
|
||||
const StyledInfoCircleOutlined = styled(Icons.InfoCircleOutlined)`
|
||||
padding-left: ${({ theme }) => theme.sizeUnit}px;
|
||||
`;
|
||||
|
||||
export const RequiredFieldIndicator = () => (
|
||||
<span
|
||||
css={(theme: SupersetTheme) => ({
|
||||
@@ -231,12 +236,23 @@ export const DescriptionToolTip = ({
|
||||
whiteSpace: 'normal',
|
||||
}}
|
||||
>
|
||||
<Icons.InfoCircleOutlined
|
||||
<StyledInfoCircleOutlined className="text-muted" role="button" />
|
||||
</Tooltip>
|
||||
</ToolTipContainer>
|
||||
);
|
||||
|
||||
export const DeckglLayerVisibilityTooltip = () => (
|
||||
<ToolTipContainer>
|
||||
<Tooltip
|
||||
title={t(
|
||||
'Choose layers to hide from all deck.gl Multiple Layer charts in this dashboard.',
|
||||
)}
|
||||
placement="right"
|
||||
>
|
||||
<StyledInfoCircleOutlined
|
||||
className="text-muted"
|
||||
role="button"
|
||||
css={(theme: SupersetTheme) => ({
|
||||
paddingLeft: `${theme.sizeUnit}px`,
|
||||
})}
|
||||
data-test="deckgl-layer-visibility-tooltip-icon"
|
||||
/>
|
||||
</Tooltip>
|
||||
</ToolTipContainer>
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* 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 { ChartDataResponseResult } from '@superset-ui/core';
|
||||
import { applyTimeGrainAllowlist } from './FilterValue';
|
||||
|
||||
const baseResults = [
|
||||
{
|
||||
data: [
|
||||
{ duration: 'PT1H', name: 'Hour' },
|
||||
{ duration: 'P1D', name: 'Day' },
|
||||
{ duration: 'P1W', name: 'Week' },
|
||||
{ duration: 'P1M', name: 'Month' },
|
||||
],
|
||||
},
|
||||
] as unknown as ChartDataResponseResult[];
|
||||
|
||||
test('applyTimeGrainAllowlist should filter to configured durations', () => {
|
||||
const filtered = applyTimeGrainAllowlist(
|
||||
'filter_timegrain',
|
||||
['PT1H', 'P1D', 'P1W'],
|
||||
baseResults,
|
||||
);
|
||||
|
||||
expect(filtered[0].data).toEqual([
|
||||
{ duration: 'PT1H', name: 'Hour' },
|
||||
{ duration: 'P1D', name: 'Day' },
|
||||
{ duration: 'P1W', name: 'Week' },
|
||||
]);
|
||||
});
|
||||
|
||||
test('applyTimeGrainAllowlist should return unfiltered results for non-timegrain filters', () => {
|
||||
const filtered = applyTimeGrainAllowlist(
|
||||
'filter_select',
|
||||
['PT1H'],
|
||||
baseResults,
|
||||
);
|
||||
expect(filtered).toEqual(baseResults);
|
||||
});
|
||||
|
||||
test('applyTimeGrainAllowlist should return unfiltered results when allowlist is empty', () => {
|
||||
const filtered = applyTimeGrainAllowlist('filter_timegrain', [], baseResults);
|
||||
expect(filtered).toEqual(baseResults);
|
||||
});
|
||||
@@ -61,7 +61,7 @@ import { RESPONSIVE_WIDTH } from 'src/filters/components/common';
|
||||
import { dispatchHoverAction, dispatchFocusAction } from './utils';
|
||||
import { FilterControlProps } from './types';
|
||||
import { getFormData } from '../../utils';
|
||||
import { useFilterDependencies } from './state';
|
||||
import { useFilterDependencies, useTransitiveParentIds } from './state';
|
||||
import { useFilterOutlined } from '../useFilterOutlined';
|
||||
|
||||
const HEIGHT = 32;
|
||||
@@ -84,6 +84,35 @@ const StyledDiv = styled.div<{
|
||||
|
||||
const queriesDataPlaceholder = [{ data: [{}] }];
|
||||
|
||||
type TimeGrainFilterConfig = {
|
||||
time_grains?: string[];
|
||||
};
|
||||
|
||||
export const applyTimeGrainAllowlist = (
|
||||
filterType: string,
|
||||
allowedTimeGrains: string[] | undefined,
|
||||
results: ChartDataResponseResult[],
|
||||
): ChartDataResponseResult[] => {
|
||||
if (filterType !== 'filter_timegrain' || !allowedTimeGrains?.length) {
|
||||
return results;
|
||||
}
|
||||
|
||||
return results.map(result => {
|
||||
if (!Array.isArray(result.data)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return {
|
||||
...result,
|
||||
data: result.data.filter(row =>
|
||||
allowedTimeGrains.includes(
|
||||
(row as { duration?: string }).duration ?? '',
|
||||
),
|
||||
),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const useShouldFilterRefresh = () => {
|
||||
const isDashboardRefreshing = useSelector<RootState, boolean>(
|
||||
state => state.dashboardState.isRefreshing,
|
||||
@@ -114,11 +143,15 @@ const FilterValue: FC<FilterValueProps> = ({
|
||||
}) => {
|
||||
const { id, targets, filterType } = filter;
|
||||
const isCustomization = isChartCustomization(filter);
|
||||
const allowedTimeGrains = isCustomization
|
||||
? undefined
|
||||
: (filter as TimeGrainFilterConfig).time_grains;
|
||||
const adhocFilters = isCustomization ? undefined : filter.adhoc_filters;
|
||||
const timeRange = isCustomization ? undefined : filter.time_range;
|
||||
const granularitySqla = isCustomization ? undefined : filter.granularity_sqla;
|
||||
const metadata = getChartMetadataRegistry().get(filterType);
|
||||
const dependencies = useFilterDependencies(id, dataMaskSelected);
|
||||
const transitiveParentIds = useTransitiveParentIds(id);
|
||||
const shouldRefresh = useShouldFilterRefresh();
|
||||
|
||||
const behaviors = useMemo(
|
||||
@@ -187,12 +220,15 @@ const FilterValue: FC<FilterValueProps> = ({
|
||||
dashboardId,
|
||||
});
|
||||
const filterOwnState = filter.dataMask?.ownState || {};
|
||||
if ((filter.cascadeParentIds ?? []).length) {
|
||||
// Prevent unnecessary backend requests by validating parent filter selections first
|
||||
if (transitiveParentIds.length) {
|
||||
// Prevent unnecessary backend requests by validating ancestor filter
|
||||
// selections first. We walk the full transitive ancestor chain (not just
|
||||
// direct parents) so the counts line up with `dependencies`, which is
|
||||
// itself built from the transitive chain by `useFilterDependencies`.
|
||||
|
||||
let selectedParentFilterValueCounts = 0;
|
||||
let isTimeRangeSelected = false;
|
||||
(filter.cascadeParentIds ?? []).forEach(pId => {
|
||||
transitiveParentIds.forEach(pId => {
|
||||
const extraFormData = dataMaskSelected?.[pId]?.extraFormData;
|
||||
if (extraFormData?.filters?.length) {
|
||||
selectedParentFilterValueCounts += extraFormData.filters.length;
|
||||
@@ -202,7 +238,7 @@ const FilterValue: FC<FilterValueProps> = ({
|
||||
}
|
||||
});
|
||||
|
||||
// check if all parent filters with defaults have a value selected
|
||||
// check if all ancestor filters with defaults have a value selected
|
||||
|
||||
const depsCount = dependencies.filters?.length ?? 0;
|
||||
const hasTimeRangeDeps = Boolean(dependencies?.time_range);
|
||||
@@ -212,7 +248,7 @@ const FilterValue: FC<FilterValueProps> = ({
|
||||
(hasTimeRangeDeps && !isTimeRangeSelected)
|
||||
) {
|
||||
// child filter should not request backend until it
|
||||
// has all the required information from parent filters
|
||||
// has all the required information from ancestor filters
|
||||
return;
|
||||
}
|
||||
setHasDepsFilterValue(false);
|
||||
@@ -247,12 +283,24 @@ const FilterValue: FC<FilterValueProps> = ({
|
||||
// deal with getChartDataRequest transforming the response data
|
||||
const result = 'result' in json ? json.result[0] : json;
|
||||
if (response.status === 200) {
|
||||
setState([result as ChartDataResponseResult]);
|
||||
setState(
|
||||
applyTimeGrainAllowlist(filterType, allowedTimeGrains, [
|
||||
result as ChartDataResponseResult,
|
||||
]),
|
||||
);
|
||||
setError(undefined);
|
||||
handleFilterLoadFinish();
|
||||
} else if (response.status === 202) {
|
||||
waitForAsyncData(result as Parameters<typeof waitForAsyncData>[0])
|
||||
.then((asyncResult: ChartDataResponseResult[]) => {
|
||||
setState(asyncResult);
|
||||
setState(
|
||||
applyTimeGrainAllowlist(
|
||||
filterType,
|
||||
allowedTimeGrains,
|
||||
asyncResult,
|
||||
),
|
||||
);
|
||||
setError(undefined);
|
||||
handleFilterLoadFinish();
|
||||
})
|
||||
.catch((error: Response) => {
|
||||
@@ -267,7 +315,13 @@ const FilterValue: FC<FilterValueProps> = ({
|
||||
);
|
||||
}
|
||||
} else {
|
||||
setState(json.result as ChartDataResponseResult[]);
|
||||
setState(
|
||||
applyTimeGrainAllowlist(
|
||||
filterType,
|
||||
allowedTimeGrains,
|
||||
json.result as ChartDataResponseResult[],
|
||||
),
|
||||
);
|
||||
setError(undefined);
|
||||
handleFilterLoadFinish();
|
||||
}
|
||||
@@ -286,11 +340,13 @@ const FilterValue: FC<FilterValueProps> = ({
|
||||
groupby,
|
||||
handleFilterLoadFinish,
|
||||
filter,
|
||||
allowedTimeGrains,
|
||||
hasDataSource,
|
||||
isRefreshing,
|
||||
shouldRefresh,
|
||||
dataMaskSelected,
|
||||
setHasDepsFilterValue,
|
||||
transitiveParentIds,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
/**
|
||||
* 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 { renderHook } from '@testing-library/react-hooks';
|
||||
import { Provider } from 'react-redux';
|
||||
import configureStore from 'redux-mock-store';
|
||||
import { createElement } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
import type { DataMaskStateWithId } from '@superset-ui/core';
|
||||
import {
|
||||
FilterConfigMap,
|
||||
resolveTransitiveParentIds,
|
||||
} from '../../dependencyGraph';
|
||||
import { useFilterDependencies, useTransitiveParentIds } from './state';
|
||||
|
||||
const mockStore = configureStore([]);
|
||||
|
||||
const buildWrapper = (filters: FilterConfigMap) => {
|
||||
const store = mockStore({ nativeFilters: { filters } });
|
||||
return ({ children }: { children: ReactNode }) =>
|
||||
createElement(Provider, { store }, children);
|
||||
};
|
||||
|
||||
test('resolveTransitiveParentIds returns empty for a filter with no parents', () => {
|
||||
expect(
|
||||
resolveTransitiveParentIds('A', {
|
||||
A: { cascadeParentIds: [] },
|
||||
}),
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
test('resolveTransitiveParentIds walks a linear chain A -> B -> C -> D', () => {
|
||||
// D depends on C, C on B, B on A; each level only lists its direct parent.
|
||||
const result = resolveTransitiveParentIds('D', {
|
||||
A: { cascadeParentIds: [] },
|
||||
B: { cascadeParentIds: ['A'] },
|
||||
C: { cascadeParentIds: ['B'] },
|
||||
D: { cascadeParentIds: ['C'] },
|
||||
});
|
||||
// Furthest ancestor first, closest parent last.
|
||||
expect(result).toEqual(['A', 'B', 'C']);
|
||||
});
|
||||
|
||||
test('resolveTransitiveParentIds deduplicates shared ancestors in a diamond', () => {
|
||||
// A
|
||||
// / \
|
||||
// B C
|
||||
// \ /
|
||||
// D
|
||||
const result = resolveTransitiveParentIds('D', {
|
||||
A: { cascadeParentIds: [] },
|
||||
B: { cascadeParentIds: ['A'] },
|
||||
C: { cascadeParentIds: ['A'] },
|
||||
D: { cascadeParentIds: ['B', 'C'] },
|
||||
});
|
||||
expect(result).toContain('A');
|
||||
expect(result).toContain('B');
|
||||
expect(result).toContain('C');
|
||||
// A should only appear once even though reachable via B and C.
|
||||
expect(result.filter(id => id === 'A')).toHaveLength(1);
|
||||
});
|
||||
|
||||
test('resolveTransitiveParentIds defends against cyclic configuration', () => {
|
||||
// Filter config modal enforces acyclicity, but malformed saved state
|
||||
// should not spin forever here.
|
||||
const result = resolveTransitiveParentIds('A', {
|
||||
A: { cascadeParentIds: ['B'] },
|
||||
B: { cascadeParentIds: ['A'] },
|
||||
});
|
||||
expect(result).toEqual(['B']);
|
||||
});
|
||||
|
||||
test('resolveTransitiveParentIds tolerates missing filter entries', () => {
|
||||
// Unknown parent id referenced in cascadeParentIds should not crash.
|
||||
expect(
|
||||
resolveTransitiveParentIds('X', {
|
||||
X: { cascadeParentIds: ['Y'] },
|
||||
}),
|
||||
).toEqual(['Y']);
|
||||
});
|
||||
|
||||
test('useTransitiveParentIds reads filter config from redux', () => {
|
||||
const wrapper = buildWrapper({
|
||||
A: { cascadeParentIds: [] },
|
||||
B: { cascadeParentIds: ['A'] },
|
||||
C: { cascadeParentIds: ['B'] },
|
||||
});
|
||||
const { result } = renderHook(() => useTransitiveParentIds('C'), { wrapper });
|
||||
expect(result.current).toEqual(['A', 'B']);
|
||||
});
|
||||
|
||||
test('useFilterDependencies merges extraFormData across the full chain', () => {
|
||||
// Regression test for sc-102912: a chain A -> B -> C -> D where each level
|
||||
// only lists its direct parent must still produce extra_form_data that
|
||||
// includes clauses from every ancestor, not just the closest parent.
|
||||
const wrapper = buildWrapper({
|
||||
A: { cascadeParentIds: [] },
|
||||
B: { cascadeParentIds: ['A'] },
|
||||
C: { cascadeParentIds: ['B'] },
|
||||
D: { cascadeParentIds: ['C'] },
|
||||
});
|
||||
const dataMaskSelected: DataMaskStateWithId = {
|
||||
A: {
|
||||
id: 'A',
|
||||
extraFormData: { filters: [{ col: 'country', op: 'IN', val: ['US'] }] },
|
||||
},
|
||||
B: {
|
||||
id: 'B',
|
||||
extraFormData: { filters: [{ col: 'region', op: 'IN', val: ['West'] }] },
|
||||
},
|
||||
C: {
|
||||
id: 'C',
|
||||
extraFormData: { filters: [{ col: 'state', op: 'IN', val: ['CA'] }] },
|
||||
},
|
||||
};
|
||||
const { result } = renderHook(
|
||||
() => useFilterDependencies('D', dataMaskSelected),
|
||||
{ wrapper },
|
||||
);
|
||||
const cols = (result.current.filters ?? []).map(f => f.col);
|
||||
// All three ancestor clauses must be present.
|
||||
expect(cols).toEqual(expect.arrayContaining(['country', 'region', 'state']));
|
||||
expect(result.current.filters ?? []).toHaveLength(3);
|
||||
});
|
||||
|
||||
test('useFilterDependencies lets the closest ancestor override scalar fields', () => {
|
||||
// `mergeExtraFormData` appends filter arrays but overrides scalar fields
|
||||
// like `time_range`. Topological order must put the closest parent last so
|
||||
// its scalar overrides win over further ancestors.
|
||||
const wrapper = buildWrapper({
|
||||
A: { cascadeParentIds: [] },
|
||||
B: { cascadeParentIds: ['A'] },
|
||||
C: { cascadeParentIds: ['B'] },
|
||||
});
|
||||
const dataMaskSelected: DataMaskStateWithId = {
|
||||
A: {
|
||||
id: 'A',
|
||||
extraFormData: { time_range: 'Last year' },
|
||||
},
|
||||
B: {
|
||||
id: 'B',
|
||||
extraFormData: { time_range: 'Last month' },
|
||||
},
|
||||
};
|
||||
const { result } = renderHook(
|
||||
() => useFilterDependencies('C', dataMaskSelected),
|
||||
{ wrapper },
|
||||
);
|
||||
// B is C's closest ancestor with a time_range, so it should win over A.
|
||||
expect(result.current.time_range).toBe('Last month');
|
||||
});
|
||||
|
||||
test('useFilterDependencies returns empty object when parent state is missing', () => {
|
||||
const wrapper = buildWrapper({
|
||||
A: { cascadeParentIds: [] },
|
||||
B: { cascadeParentIds: ['A'] },
|
||||
});
|
||||
const { result } = renderHook(() => useFilterDependencies('B', {}), {
|
||||
wrapper,
|
||||
});
|
||||
expect(result.current).toEqual({});
|
||||
});
|
||||
@@ -18,25 +18,41 @@
|
||||
*/
|
||||
import { useMemo } from 'react';
|
||||
import { shallowEqual, useSelector } from 'react-redux';
|
||||
import {
|
||||
DataMaskStateWithId,
|
||||
ensureIsArray,
|
||||
ExtraFormData,
|
||||
} from '@superset-ui/core';
|
||||
import { DataMaskStateWithId, ExtraFormData } from '@superset-ui/core';
|
||||
import { RootState } from 'src/dashboard/types';
|
||||
import { mergeExtraFormData } from '../../utils';
|
||||
import {
|
||||
FilterConfigMap,
|
||||
resolveTransitiveParentIds,
|
||||
} from '../../dependencyGraph';
|
||||
|
||||
/**
|
||||
* Resolve the transitive ancestor ids for a given filter from the live
|
||||
* native-filter configuration in Redux. Shared between
|
||||
* `useFilterDependencies` and the readiness guard in `FilterValue` so they
|
||||
* always agree on which parents count.
|
||||
*/
|
||||
export function useTransitiveParentIds(id: string): string[] {
|
||||
const filterConfig = useSelector<RootState, FilterConfigMap | undefined>(
|
||||
state => state.nativeFilters?.filters,
|
||||
shallowEqual,
|
||||
);
|
||||
|
||||
return useMemo(
|
||||
() => resolveTransitiveParentIds(id, filterConfig ?? {}),
|
||||
[id, filterConfig],
|
||||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export function useFilterDependencies(
|
||||
id: string,
|
||||
dataMaskSelected?: DataMaskStateWithId,
|
||||
): ExtraFormData {
|
||||
const dependencyIds = useSelector<any, string[] | undefined>(
|
||||
state => state.nativeFilters.filters[id]?.cascadeParentIds,
|
||||
shallowEqual,
|
||||
);
|
||||
const dependencyIds = useTransitiveParentIds(id);
|
||||
|
||||
return useMemo(() => {
|
||||
let dependencies = {};
|
||||
ensureIsArray(dependencyIds).forEach(parentId => {
|
||||
let dependencies: ExtraFormData = {};
|
||||
dependencyIds.forEach(parentId => {
|
||||
const parentState = dataMaskSelected?.[parentId];
|
||||
dependencies = mergeExtraFormData(
|
||||
dependencies,
|
||||
|
||||
@@ -212,6 +212,7 @@ const FilterTitleContainer = forwardRef<HTMLDivElement, Props>(
|
||||
onRemove(id);
|
||||
}}
|
||||
alt={t('Remove filter')}
|
||||
data-test="filter-remove-button"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user