You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2023/10/03 00:13:28 UTC

[superset] branch sc_71594 updated (bcaeca476f -> 66fc17e473)

This is an automated email from the ASF dual-hosted git repository.

beto pushed a change to branch sc_71594
in repository https://gitbox.apache.org/repos/asf/superset.git


    omit bcaeca476f Add test
    omit e2544e8ef2 Fix test
    omit 4d5988edbf Address comments.
    omit d5d8afc64c Fix lint
    omit 2d030002e0 feat: generic marshmallow error component
     add 3630d6844c fix: small fixes for the meta DB (#25067)
     add 0d5be8e3f6 fix(table): condition formatting can't formate 0 values (#24008)
     add 60c2ac3268 feat: adding Scarf pixels to gather telemetry on readme and website (#25065)
     add 63f24ea57e test(cypress): Fail Cypress on Console errors (#24872)
     add 8d3340045c build(deps): Bump PyHive (#25030)
     add f584c8462b fix: Cross filters initial scope (#25074)
     add 6ac906f388 chore: remove CssTemplate and Annotation access from gamma role (#24826)
     add 4d9e9a4b1c chore(sqllab): typescript for getInitialState (#25047)
     add 7402379346 fix(embedded sdk): Remove trailing slash from passed superset domain if there is one (#25020)
     add 04bb73cf27 chore(reports): add metrics to report schedule and log prune (#25080)
     add b3424266cd build(deps-dev): bump @types/node from 20.5.1 to 20.5.6 in /superset-websocket (#25082)
     add da172bf8cf docs(docker-compose): add missing parenthesis (#24771)
     add 5168475826 fix: dataset update permission out of sync (#25043)
     add 69fb309ec3 feat: Update Tags CRUD API (#24839)
     add c2a21d2da0 refactor(pinot): The `python_date_format` for a temporal column was not being passed to `get_timestamp_expr` (#24942)
     add fcd045f84a chore: Update docs for docker-compose installation (#24980)
     add 4c4fedc452 chore: Refactor deck.gl plugins to Typescript (#24933)
     add b5bac6c876 fix: Filter names overflow wrap (#25087)
     add b240b795b5 fix(assets import): Ensure old datasource ids are not referenced in imported charts (#25086)
     add 2b8d8da22a fix: Allow embedded guest user datasource access with dashboard context (#25081)
     add 7d418f3dce build(deps-dev): bump @types/node from 20.5.6 to 20.5.7 in /superset-websocket (#25097)
     add da89feeb16 build(deps-dev): bump eslint from 8.47.0 to 8.48.0 in /superset-websocket (#25098)
     add e4b54c3c01 feat(docker):  refactor docker images (#25089)
     add 72150ebadf fix(sqllab): rendering performance regression by resultset (#25091)
     add e585db85b6 chore: use contextlib.surpress instead of passing on error (#24896)
     add 29355577f1 fix(sqllab): error while removing a referenced table (#25114)
     add e642361399 docs: Update UPDATING.md regarding potential breaking change to `ab_user.email` column (#25115)
     add 00550d7c02 fix: Date format when importing international timestamps (#25113)
     add 46a0a6e08a fix(DB Connection): Update placeholder values for Snowflake connection (#25119)
     add 067bfbf950 chore: move TypedDict from typing_extensions to typing (#25121)
     add 66e2807009 feat: removing renderCard from Tags/index.tsc to remove cardview from Tags ListView (#25105)
     add eeecd59c9d refactor(frontend): make "Search" box the first filter for charts and datasets (#25129)
     add 846c79ef55 chore: consolidate sqllab store into SPA store (#25088)
     add 9df1b26654 fix: Bumps Flask Caching to fix RCE vulnerability (#25090)
     add 1144ac15c9 fix: Partially reverts #25007 (#25124)
     add e18294463e docs: Fix typo in UPDATING.md (#25127)
     add 15d6508407 build(deps): bump jsonwebtoken from 9.0.1 to 9.0.2 in /superset-websocket/utils/client-ws-app (#25140)
     add 0b780d55bb build(deps): bump jsonwebtoken from 9.0.1 to 9.0.2 in /superset-websocket (#25141)
     add 62f9e54c8f build(deps-dev): bump @types/uuid from 9.0.2 to 9.0.3 in /superset-websocket (#25142)
     add 321d968504 fix: add format for timestamp in crdb to correctly use times values (#24711)
     add 06bf44a823 fix(sqllab): invalid reducer key name (#25152)
     add de9515c294 fix: Handle Python date format for GENERIC_CHART_AXES feature (#25135)
     add bbfaeb074e fix: Chart series limit doesn't work for some databases (#25150)
     add 2c4629a77d fix: Fixing untranslated FR strings (#20078)
     add 1f5cec94bd chore: fix broken link to Celery worker docs (#25160)
     add aea916782d fix: Sunburst chart error when secondary metric is null (#25159)
     add e391a1b49e chore: Add a note about adhoc subqueries in UPDATING.md (#25161)
     add 8b2a408dea fix(sqllab): Invalid start date (#25133)
     add f2523b26fa fix: Applying Dashboard Time Range Filters to Overwritten Charts (#25156)
     add d0305445b2 fix: Issue #24493; Resolved report selection menu in chart and dashboard page (#25157)
     add d8496425e2 fix: DML failures in SQL Lab (#25190)
     add e605d6dddf fix: All values being selected in Select (#25202)
     add 78b8e9421e docs: fix wrong type in PREFERRED_DATABASES example (#25200)
     add 251ce2ed2a docs: add CVEs for 2.1.1 (#25206)
     add a40e9a4d06 chore: back port 2.1.1 doc changes (#25165)
     add 2d4de5146b feat(sqllab): Show sql in the current result (#24787)
     add 8be8014504 docs(FAQ): add answer re: necessary specs, copy-edit existing answer (#24992)
     add 2f68010729 fix: `is_select` (#25189)
     add 47518cb002 fix: Cypress test to force mouseover (#25209)
     add cfda30c81a fix(sqllab): Force trino client async execution (#24859)
     add 749274e635 fix: granularity_sqla and GENERIC_CHART_AXES (#25213)
     add 09e9cb484b chore: Convert deckgl class components to functional (#25177)
     add 0e17e4b06f fix: Cypress test to force mouseover (follow-up) (#25223)
     add 33624289fe fix(docs): Fixing a typo in README.md (#25216)
     add 710e111c5e chore(read_csv): remove deprecated argument (#25226)
     add 0668d12e3b chore(trino): remove unnecessary index checks (#25211)
     add 6f4e63162f fix: Clearing the currency format has no effect on the chart (#25238)
     add 894f250229 fix: Don't apply number formatting to the label in Treemap (#25249)
     add ea21e800a7 fix: Currency formatting in Table raw mode (#25248)
     add 83fc553841 refactor: Remove obsolete HiveEngineSpec.fetch_logs method (#20631)
     add 37742c40ca build(deps-dev): bump @types/node from 20.5.7 to 20.6.0 in /superset-websocket (#25253)
     add baf713aad5 fix(dockefile): broken docker image (#25251)
     add 55ac01b675 feat: Tags ListView Page (#24964)
     add 242921bb4c fix: Add line height to metadata bar (#25268)
     add a9512c1eef fix: inability to remove chart filter when dashboard time filter is applied (#25217)
     add a747eaa740 build(deps-dev): bump eslint from 8.48.0 to 8.49.0 in /superset-websocket (#25263)
     add 8eff5a75b4 chore: Remove the ability to switch to filter-box chart when DASHBOARD_NATIVE_FILTERS feature is enabled (#25275)
     add 426aa777fb build(deps): bump uuid from 9.0.0 to 9.0.1 in /superset-websocket (#25279)
     add e1ddba9c0f docs: rewrite superset docker localhost prose (#25296)
     add bb002d6147 fix: is_select with UNION (#25290)
     add ec61910232 build(deps): bump ws from 8.13.0 to 8.14.1 in /superset-websocket (#25293)
     add 467e062e8e build(docker): bump geckodriver and firefox to latest (#25287)
     add 14c324950a feat(datasource): Checkbox for always filtering main dttm in datasource (#25204)
     add 78cbdc3e42 chore: changing one word (disablement -> disabling) (#25291)
     add 52faa2e17d chore(sqllab): Migrate tests to typescript (#25274)
     add 06c0a5bba9 build(deps-dev): bump @types/uuid from 9.0.3 to 9.0.4 in /superset-websocket (#25311)
     add 4ddd56f788 chore: bump gunicorn to v21 (#25313)
     add d54e827bb9 fix: Add explicit ON DELETE CASCADE for dashboard_roles (#25320)
     add e11012d426 docs: add ReadyTech to INTHEWILD.md (#25324)
     add c8c94825ce fix(chart): Supporting custom SQL as temporal x-axis column with filter (#25126)
     add fba66c6250 fix: Use RLS clause instead of ID for cache key (#25229)
     add 6e799e37f4 docs: add snowflake-sqlalchemy in ./docker/requirements-local.txt  (#25312)
     add 090ae64dfa feat(tag): fast follow for Tags flatten api + update client with generator + some bug fixes (#25309)
     add 5cc0feb647 feat(helm): Support HPA for supersetNode and supersetWorker (#25280)
     add a724850c84 docs: jwks_uri addition to OAUTH provider (#24928)
     add f672d5da5c fix: Improve the reliability of alerts & reports (#25239)
     add b722a95bab feat: Adds CLI commands to execute viz migrations (#25304)
     add 7aaae06c9d fix(sqllab): invalid persisted tab state (#25308)
     add a971a28a34 fix: DashboardRoles cascade operation (#25349)
     add 515452c7e2 chore(async): Making create app configurable (#25346)
     add 16f31f8090 feat(sqllab): extra logging when chart is downloaded (#25345)
     add 5b3910db97 chore: Adds 3.0 data to CHANGELOG and UPDATING (#25360)
     add 5ebcd2a5f6 fix: datetime with timezone excel export (#25318)
     add 9bd97ef4f2 fix: update helm chart app version (#25361)
     add 0c083bdc1a feat: Adds Sunburst chart migration logic (#25343)
     add e1a91e2228 feat(docker): Use docker buildx and Add ARM builds for dockerize and websocket (#25377)
     add d76ff39766 fix: Workaround for Cypress ECONNRESET error (#25399)
     add f6ce40d246 chore: upgrade node to most recent 16.x (#25362)
     add 52eba11d6a docs: update docker-compose to match latest release  (#25332)
     add 296ff17f19 fix: preventing save button from flickering in SQL Lab (#25106)
     add 893b45feef fix: Rename on_delete parameter to ondelete (#25424)
     add 40ba3c2d57 chore: cryptography version bump (#25276)
     add a4d8f36863 fix: chart import (#25425)
     add 1716b9f8f6 fix: swagger UI CSP error (#25368)
     add 463962a58b fix(sqllab): misplaced limit warning alert (#25306)
     add f0080f9c55 fix: smarter date formatter (#25404)
     add ba5e2f634a fix(sqllab): invalid start date (#25437)
     add a0eeb4d767 fix(nativeFilters): Speed up native filters by removing unnecessary rerenders (#25282)
     add 11b49a6ceb fix(SqlLab): make icon placement even (#25372)
     add 1a759ce56d build(deps): bump get-func-name from 2.0.0 to 2.0.2 in /superset-frontend/cypress-base (#25441)
     add 7cf96cd843 fix: Duplicate items when pasting into Select (#25447)
     add e83a76a586 fix: update the SQLAlchemy model definition at json column for Log table (#25445)
     add b9b557a761 fix(helm chart): set chart appVersion to 3.0.0 (#25373)
     add 041197b6df chore(docs): Spelling (#25453)
     add 3e0c70d018 chore(misc): Spelling (#25456)
     add 0735680674 chore(backend): Spelling (#25457)
     add 7eab59af51 fix(mysql): handle string typed decimal results (#24241)
     add 0cebffd59a fix: Styles not loading because of faulty CSP setting (#25468)
     add 85251f8cae fix: Tags Page Polish (#25403)
     add ddde178e3b fix(sqllab): error with lazy_gettext for tab titles (#25469)
     add a14fcc95e7 chore(misc): Typos in config.py (#25465)
     add e36e0fdf25 chore: Update Explore tooltip copy (#25438)
     add b33d152a5b docs(FAQ): remove reference to filter box, add Q&A re: usage analytics (#25435)
     add 6aed5887e5 build(deps-dev): bump @types/jsonwebtoken from 9.0.2 to 9.0.3 in /superset-websocket (#25325)
     add 8553b06155 build(deps-dev): bump prettier from 3.0.2 to 3.0.3 in /superset-websocket (#25120)
     add 0d0a81c0d2 fix(Indian Map Changes): fixed-Indian-map-border (#24927)
     add 36ed617090 fix: Address Mypy issue which is causing CI to fail (#25494)
     new 544a6be812 feat: generic marshmallow error component
     new 3eb59fec0d Fix lint
     new 0a0627cfcf Address comments.
     new 27e71b6b64 Fix test
     new 66fc17e473 Add test

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (bcaeca476f)
            \
             N -- N -- N   refs/heads/sc_71594 (66fc17e473)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .github/CODEOWNERS                                 |    2 +-
 .github/ISSUE_TEMPLATE/sip.md                      |    2 +-
 .github/workflows/chromatic-master.yml             |    2 +-
 .github/workflows/codecov.sh                       |    4 +-
 .github/workflows/docker-release.yml               |    4 +
 .github/workflows/docker.yml                       |   14 +-
 .github/workflows/docker_build_push.sh             |   81 +-
 .github/workflows/prefer-typescript.yml            |    4 +-
 .gitignore                                         |    1 +
 CHANGELOG.md                                       |  910 ++++-
 CONTRIBUTING.md                                    |  116 +-
 Dockerfile                                         |   78 +-
 README.md                                          |    3 +
 RELEASING/README.md                                |    4 +-
 RELEASING/release-notes-2-0/README.md              |    4 +-
 RELEASING/release-notes-2-0/changelog.md           |   12 +-
 RESOURCES/INTHEWILD.md                             |    1 +
 UPDATING.md                                        |   41 +-
 docker-compose.yml                                 |    8 +
 docker/docker-entrypoint-initdb.d/examples-init.sh |    2 +-
 docker/nginx/nginx.conf                            |  127 +
 docker/pythonpath_dev/superset_config.py           |    2 +-
 dockerize.Dockerfile                               |    9 +-
 docs/docs/api.mdx                                  |    2 +-
 docs/docs/contributing/hooks-and-linting.mdx       |    2 +-
 docs/docs/contributing/translations.mdx            |    2 +-
 docs/docs/contributing/types-of-contributions.mdx  |    4 +-
 .../creating-your-first-dashboard.mdx              |    2 +-
 docs/docs/databases/db-connection-ui.mdx           |    2 +-
 docs/docs/databases/snowflake.mdx                  |   11 +-
 docs/docs/databases/sql-server.mdx                 |    2 +-
 docs/docs/frequently-asked-questions.mdx           |  100 +-
 docs/docs/installation/async-queries-celery.mdx    |    4 +-
 docs/docs/installation/configuring-superset.mdx    |    3 +-
 .../installing-superset-using-docker-compose.mdx   |   32 +-
 docs/docs/installation/setup-ssh-tunneling.mdx     |    2 +-
 docs/docs/miscellaneous/chart-params.mdx           |   16 +-
 docs/docs/miscellaneous/issue-codes.mdx            |    2 +-
 docs/docs/security/cves.mdx                        |   30 +-
 docs/docusaurus.config.js                          |    5 +-
 helm/superset/Chart.yaml                           |    4 +-
 helm/superset/README.md                            |   10 +-
 helm/superset/templates/_helpers.tpl               |    2 +-
 helm/superset/templates/deployment-worker.yaml     |    2 +
 helm/superset/templates/deployment.yaml            |    2 +
 helm/superset/templates/hpa-node.yaml              |   54 +
 helm/superset/templates/hpa-worker.yaml            |   54 +
 helm/superset/values.yaml                          |   14 +
 requirements/base.txt                              |   12 +-
 requirements/development.txt                       |    8 +-
 requirements/testing.txt                           |    2 +-
 scripts/generate_frontend_ts_tasklist.js           |    4 +-
 setup.cfg                                          |    2 +-
 setup.py                                           |   23 +-
 superset-embedded-sdk/CONTRIBUTING.md              |    2 +-
 superset-embedded-sdk/package-lock.json            |    4 +-
 superset-embedded-sdk/package.json                 |    2 +-
 superset-embedded-sdk/src/index.ts                 |    4 +
 superset-frontend/.nvmrc                           |    2 +-
 superset-frontend/cypress-base/cypress.config.ts   |   17 +
 .../cypress/e2e/dashboard/editmode.test.ts         |    2 +
 .../cypress-base/cypress/e2e/explore/chart.test.js |    4 +-
 .../cypress-base/cypress/support/e2e.ts            |   22 +
 .../cypress-base/cypress/support/index.d.ts        |    1 +
 superset-frontend/cypress-base/package-lock.json   |  411 ++-
 superset-frontend/cypress-base/package.json        |    1 +
 superset-frontend/jest.config.js                   |    3 +
 superset-frontend/package-lock.json                | 2597 ++++++++------
 superset-frontend/package.json                     |    4 +-
 .../src/shared-controls/dndControls.tsx            |   36 +-
 .../src/shared-controls/sharedControls.tsx         |   18 +-
 .../superset-ui-chart-controls/src/types.ts        |    2 +-
 .../test/utils/columnChoices.test.tsx              |    2 +-
 .../test/utils/defineSavedMetrics.test.tsx         |    2 +-
 .../superset-ui-core/src/chart/types/Base.ts       |    1 +
 .../formatters/finestTemporalGrain.test.ts         |   63 +
 .../time-format/formatters/finestTemporalGrain.ts  |   80 +
 .../superset-ui-core/src/time-format/index.ts      |    1 +
 .../scripts/Country Map GeoJSON Generator.ipynb    | 3759 ++++++++++----------
 .../src/countries/india.geojson                    |    4 +-
 .../legacy-plugin-chart-sunburst/src/Sunburst.js   |    3 +-
 .../legacy-preset-chart-deckgl/package.json        |    8 +-
 .../src/AnimatableDeckGLContainer.jsx              |  117 -
 .../src/CategoricalDeckGLContainer.jsx             |  293 --
 .../src/CategoricalDeckGLContainer.tsx             |  239 ++
 .../src/DeckGLContainer.jsx                        |  147 -
 .../src/DeckGLContainer.tsx                        |  141 +
 .../legacy-preset-chart-deckgl/src/Multi/Multi.jsx |  147 -
 .../legacy-preset-chart-deckgl/src/Multi/Multi.tsx |  149 +
 .../src/Multi/{controlPanel.js => controlPanel.ts} |    6 +-
 .../src/Multi/{index.js => index.ts}               |    0
 .../src/{TooltipRow.jsx => TooltipRow.tsx}         |   27 +-
 .../src/components/BootstrapSliderWrapper.jsx      |   41 -
 .../src/components/{Legend.jsx => Legend.tsx}      |  125 +-
 .../src/components/PlaySlider.jsx                  |  232 --
 .../src/components/Tooltip.tsx                     |    4 +-
 .../legacy-preset-chart-deckgl/src/factory.tsx     |  139 +-
 .../src/{index.js => index.ts}                     |    0
 .../src/layers/Arc/{Arc.jsx => Arc.tsx}            |   28 +-
 .../src/layers/Arc/{index.js => index.ts}          |    0
 .../layers/Geojson/{Geojson.jsx => Geojson.tsx}    |  156 +-
 .../src/layers/Geojson/{index.js => index.ts}      |    0
 .../src/layers/Grid/{Grid.jsx => Grid.tsx}         |   30 +-
 .../src/layers/Grid/{index.js => index.ts}         |    0
 .../src/layers/Heatmap/Heatmap.tsx                 |   12 +-
 .../src/layers/Hex/{Hex.jsx => Hex.tsx}            |   32 +-
 .../src/layers/Hex/{index.js => index.ts}          |    0
 .../src/layers/Path/{Path.jsx => Path.tsx}         |   22 +-
 .../src/layers/Path/{index.js => index.ts}         |    0
 .../src/layers/Polygon/Polygon.jsx                 |  347 --
 .../src/layers/Polygon/Polygon.tsx                 |  306 ++
 .../src/layers/Polygon/{index.js => index.ts}      |    0
 .../layers/Scatter/{Scatter.jsx => Scatter.tsx}    |   38 +-
 .../src/layers/Scatter/{index.js => index.ts}      |    0
 .../src/layers/Screengrid/Screengrid.jsx           |  242 --
 .../src/layers/Screengrid/Screengrid.tsx           |  161 +
 .../src/layers/Screengrid/{index.js => index.ts}   |    0
 .../src/layers/{common.jsx => common.tsx}          |   44 +-
 .../src/layers/{index.js => index.ts}              |    0
 .../src/{preset.js => preset.ts}                   |    0
 .../src/{transformProps.js => transformProps.ts}   |    5 +-
 .../src/utilities/Shared_DeckGL.jsx                |    2 +-
 .../src/utilities/{controls.jsx => controls.ts}    |   21 +-
 ...sharedDndControls.jsx => sharedDndControls.tsx} |    0
 .../src/utilities/utils.js                         |   90 -
 .../src/{utils/utils.js => utilities/utils.ts}     |   14 +-
 .../src/{utils.js => utils.ts}                     |   89 +-
 .../src/utils/{colors.js => colors.ts}             |    5 +-
 .../src/utils/{explore.js => explore.ts}           |   13 +-
 .../src/utils/fitViewport.ts                       |    2 +-
 .../src/utils/{geo.js => geo.ts}                   |   24 +-
 .../utils/{safeStringify.js => safeStringify.ts}   |    4 +-
 .../src/utils/{sandbox.js => sandbox.ts}           |    8 +-
 .../legacy-preset-chart-deckgl/src/utils/time.js   |  135 -
 .../test/utils/{colors.test.js => colors.test.ts}  |    0
 .../legacy-preset-chart-deckgl/types/external.d.ts |   29 +-
 .../src/Sunburst/transformProps.ts                 |    7 +-
 .../src/Treemap/transformProps.ts                  |    1 -
 .../src/plugin/controls/metrics.tsx                |    4 +-
 .../plugins/plugin-chart-table/src/TableChart.tsx  |    7 +-
 .../plugin-chart-table/src/controlPanel.tsx        |   10 +-
 .../plugin-chart-table/src/transformProps.ts       |    2 +-
 .../plugin-chart-table/src/utils/isEqualColumns.ts |    4 +-
 .../plugin-chart-table/test/TableChart.test.tsx    |   41 +
 .../plugins/plugin-chart-table/test/testData.ts    |   29 +
 superset-frontend/src/SqlLab/App.jsx               |   88 +-
 superset-frontend/src/SqlLab/actions/sqlLab.js     |   20 +-
 .../HighlightedSql/HighlightedSql.test.jsx         |   64 -
 .../HighlightedSql/HighlightedSql.test.tsx         |   48 +
 .../src/SqlLab/components/HighlightedSql/index.tsx |    2 +-
 .../SqlLab/components/QueryAutoRefresh/index.tsx   |    1 +
 ...tateLabel.test.jsx => QueryStateLabel.test.tsx} |   34 +-
 .../SqlLab/components/QueryStateLabel/index.tsx    |    2 +-
 .../{QueryTable.test.jsx => QueryTable.test.tsx}   |   54 +-
 .../src/SqlLab/components/QueryTable/index.tsx     |    2 +-
 .../src/SqlLab/components/ResultSet/index.tsx      |  165 +-
 .../SqlLab/components/SaveDatasetModal/index.tsx   |    2 +-
 .../SqlLab/components/SaveQuery/SaveQuery.test.tsx |   21 +-
 .../src/SqlLab/components/SaveQuery/index.tsx      |   12 +-
 .../{SouthPane.test.jsx => SouthPane.test.tsx}     |    9 +-
 .../src/SqlLab/components/SouthPane/index.tsx      |   57 +-
 .../SqlLab/components/SqlEditor/SqlEditor.test.jsx |   24 +-
 .../src/SqlLab/components/SqlEditor/index.jsx      |    2 +-
 .../SqlLab/components/SqlEditorLeftBar/index.tsx   |    7 +-
 .../SqlLab/components/SqlEditorTabHeader/index.tsx |    2 +-
 .../src/SqlLab/components/TableElement/index.tsx   |   27 +-
 .../src/SqlLab/hooks/useQueryEditor/index.ts       |    2 +-
 .../middlewares/persistSqlLabStateEnhancer.js      |   85 +
 .../src/SqlLab/reducers/getInitialState.test.ts    |  160 +-
 .../{getInitialState.js => getInitialState.ts}     |   85 +-
 superset-frontend/src/SqlLab/reducers/sqlLab.js    |   18 +-
 .../src/SqlLab/reducers/sqlLab.test.js             |   42 +-
 superset-frontend/src/SqlLab/types.ts              |   22 +-
 .../SqlLab/utils/reduxStateToLocalStorageHelper.js |   23 +
 .../src/components/Datasource/DatasourceEditor.jsx |   10 +
 .../src/components/Datasource/DatasourceModal.tsx  |    1 +
 .../src/components/ListView/ListView.tsx           |   40 +-
 .../src/components/MetadataBar/ContentConfig.tsx   |    4 +-
 .../src/components/MetadataBar/ContentType.ts      |    2 +-
 .../src/components/MetadataBar/MetadataBar.tsx     |    1 +
 .../src/components/PageHeaderWithActions/index.tsx |   40 +-
 .../src/components/Select/AsyncSelect.test.tsx     |   39 +
 .../src/components/Select/AsyncSelect.tsx          |   26 +-
 .../src/components/Select/Select.test.tsx          |   39 +
 superset-frontend/src/components/Select/Select.tsx |   37 +-
 superset-frontend/src/components/Select/utils.tsx  |   28 +-
 superset-frontend/src/components/Tags/Tag.tsx      |    2 +-
 .../dashboard/components/Header/Header.test.tsx    |    1 +
 .../FilterBar/FilterControls/FilterControl.tsx     |    2 +-
 .../FilterBar/FilterControls/state.ts              |    3 +-
 .../components/nativeFilters/FilterBar/index.tsx   |   16 +-
 .../components/nativeFilters/FilterCard/Styles.ts  |    1 +
 superset-frontend/src/dashboard/constants.ts       |    4 +-
 .../src/dashboard/util/crossFilters.ts             |    2 +-
 superset-frontend/src/dataMask/reducer.ts          |    1 +
 .../src/explore/actions/exploreActions.test.js     |   13 +-
 .../src/explore/actions/saveModalActions.js        |   35 +-
 .../src/explore/actions/saveModalActions.test.js   |    1 -
 .../controls/CurrencyControl/CurrencyControl.tsx   |    2 +
 .../controls/DateFilterControl/DateFilterLabel.tsx |    6 +-
 .../components/controls/VizTypeControl/index.tsx   |    9 +
 .../useExploreAdditionalActionsMenu/index.jsx      |   60 +-
 .../src/explore/reducers/exploreReducer.js         |   18 +-
 .../src/features/allEntities/AllEntitiesTable.tsx  |  112 +-
 .../DatabaseConnectionForm/ValidatedInputField.tsx |    4 +-
 .../src/features/databases/DatabaseModal/index.tsx |    7 +-
 superset-frontend/src/features/datasets/types.ts   |    1 +
 .../ReportModal/HeaderReportDropdown/index.tsx     |    3 +-
 .../src/features/tags/BulkTagModal.tsx             |  122 +
 .../src/features/tags/TagModal.test.tsx            |   72 +
 superset-frontend/src/features/tags/TagModal.tsx   |  331 ++
 superset-frontend/src/features/tags/tags.ts        |   10 +
 .../components/Select/SelectFilterPlugin.tsx       |    6 +-
 .../src/hooks/apiResources/queryApi.ts             |    1 +
 .../src/hooks/apiResources/sqlLab.test.ts          |  100 +
 superset-frontend/src/hooks/apiResources/sqlLab.ts |   84 +
 superset-frontend/src/logger/LogUtils.ts           |    5 +
 .../src/pages/AlertReportList/index.tsx            |    3 +
 superset-frontend/src/pages/AllEntities/index.tsx  |  155 +-
 .../src/pages/AnnotationLayerList/index.tsx        |    3 +
 .../src/pages/AnnotationList/index.tsx             |    3 +
 .../src/pages/ChartCreation/index.tsx              |    2 +-
 superset-frontend/src/pages/ChartList/index.tsx    |   19 +-
 .../src/pages/CssTemplateList/index.tsx            |    3 +
 .../src/pages/DashboardList/index.tsx              |    7 +-
 superset-frontend/src/pages/DatabaseList/index.tsx |    3 +
 superset-frontend/src/pages/DatasetList/index.tsx  |   17 +-
 .../src/pages/ExecutionLogList/index.tsx           |    9 +-
 .../src/pages/QueryHistoryList/index.tsx           |    4 +
 .../src/pages/RowLevelSecurityList/index.tsx       |    3 +
 .../src/pages/SavedQueryList/index.tsx             |    5 +
 superset-frontend/src/pages/Tags/index.tsx         |  125 +-
 superset-frontend/src/views/CRUD/types.ts          |   12 +-
 superset-frontend/src/views/store.ts               |   22 +-
 superset-websocket/package-lock.json               |  244 +-
 superset-websocket/package.json                    |   16 +-
 .../utils/client-ws-app/package-lock.json          |  122 +-
 .../utils/client-ws-app/package.json               |    2 +-
 .../advanced_data_type/plugins/internet_address.py |    4 +-
 .../advanced_data_type/plugins/internet_port.py    |    4 +-
 superset/advanced_data_type/types.py               |    2 +-
 superset/app.py                                    |    7 +-
 superset/async_events/api.py                       |    2 +-
 .../{utils => async_events}/async_query_manager.py |    0
 .../async_query_manager_factory.py}                |   24 +-
 superset/charts/commands/importers/v1/utils.py     |    4 +-
 superset/charts/data/api.py                        |   14 +-
 superset/charts/schemas.py                         |    8 +-
 superset/cli/test_db.py                            |    2 +-
 superset/cli/viz_migrations.py                     |   94 +
 superset/columns/models.py                         |    6 +-
 superset/commands/importers/v1/assets.py           |    9 +-
 superset/common/query_context_factory.py           |    7 +-
 superset/common/query_context_processor.py         |   10 +-
 superset/common/tags.py                            |   27 +-
 superset/config.py                                 |   36 +-
 superset/connectors/sqla/models.py                 |  126 +-
 superset/connectors/sqla/views.py                  |    7 +
 superset/daos/report.py                            |    2 +-
 superset/daos/tag.py                               |   65 +-
 superset/dashboards/permalink/schemas.py           |    2 +-
 superset/dashboards/schemas.py                     |    3 +-
 superset/databases/decorators.py                   |    2 +-
 superset/datasets/api.py                           |    2 +
 superset/datasets/commands/create.py               |    2 +-
 superset/datasets/commands/duplicate.py            |    1 +
 superset/datasets/schemas.py                       |    4 +
 superset/db_engine_specs/README.md                 |   54 +-
 superset/db_engine_specs/base.py                   |   77 +-
 superset/db_engine_specs/bigquery.py               |   10 +-
 superset/db_engine_specs/clickhouse.py             |    1 -
 superset/db_engine_specs/cockroachdb.py            |   17 +-
 superset/db_engine_specs/databricks.py             |    3 +-
 superset/db_engine_specs/elasticsearch.py          |    2 -
 superset/db_engine_specs/gsheets.py                |    9 +-
 superset/db_engine_specs/hive.py                   |   51 +-
 superset/db_engine_specs/kusto.py                  |    2 -
 superset/db_engine_specs/lib.py                    |    3 +-
 superset/db_engine_specs/mysql.py                  |   11 +-
 superset/db_engine_specs/ocient.py                 |    6 +-
 superset/db_engine_specs/pinot.py                  |  134 +-
 superset/db_engine_specs/presto.py                 |   20 +-
 superset/db_engine_specs/snowflake.py              |    3 +-
 superset/db_engine_specs/solr.py                   |    1 -
 superset/db_engine_specs/trino.py                  |   81 +-
 superset/errors.py                                 |    2 +-
 .../configs/charts/Messages_per_Channel.yaml       |    2 +-
 .../configs/dashboards/Slack_Dashboard.yaml        |    2 +-
 superset/explore/commands/get.py                   |    7 +-
 superset/explore/form_data/commands/state.py       |    4 +-
 superset/extensions/__init__.py                    |   10 +-
 superset/extensions/metadb.py                      |   11 +-
 superset/extensions/ssh.py                         |   17 +-
 superset/initialization/__init__.py                |   14 +-
 superset/jinja_context.py                          |    5 +-
 superset/legacy.py                                 |   25 +-
 superset/migrations/shared/migrate_viz/base.py     |   12 +-
 .../migrations/shared/migrate_viz/processors.py    |    6 +
 ..._13-00_c747c78868b6_migrating_legacy_treemap.py |   12 +-
 ...-07_14-00_06e1e70058c7_migrating_legacy_area.py |   11 +-
 ...02_9ba2ce3086e5_migrate_pivot_table_v1_to_v2.py |   11 +-
 ...-08_10-22_4c5da39be729_migrate_treemap_chart.py |   12 +-
 ...e58e1e58e5c_migrate_dual_line_to_mixed_chart.py |   11 +-
 ...3_add_on_delete_cascade_for_dashboard_slices.py |    2 +-
 ...on_delete_cascade_for_embedded_dashboards.py.py |    2 +-
 ...317970b4400c_added_time_secondary_column_to_.py |   67 +
 ...1_add_on_delete_cascade_for_dashboard_roles.py} |   20 +-
 superset/models/core.py                            |   20 +-
 superset/models/dashboard.py                       |   16 +-
 superset/models/helpers.py                         |   22 +-
 superset/models/user_attributes.py                 |    2 +-
 superset/reports/schemas.py                        |    2 +-
 superset/security/manager.py                       |  121 +-
 superset/sql_lab.py                                |   17 +-
 superset/sql_parse.py                              |   84 +-
 superset/sqllab/sqllab_execution_context.py        |    5 +-
 superset/sqllab/utils.py                           |   29 +-
 superset/superset_typing.py                        |    4 +-
 superset/tags/api.py                               |  228 +-
 superset/tags/commands/create.py                   |   67 +-
 superset/tags/commands/exceptions.py               |    8 +-
 superset/tags/commands/update.py                   |   78 +
 superset/tags/commands/utils.py                    |   18 +
 superset/tags/exceptions.py                        |   10 +
 superset/tags/schemas.py                           |   28 +-
 superset/tasks/cron_util.py                        |   14 +-
 superset/tasks/scheduler.py                        |   19 +-
 .../form_view/csv_to_database_view/edit.html       |  225 +-
 superset/temporary_cache/api.py                    |    5 +-
 superset/temporary_cache/commands/entry.py         |    4 +-
 superset/translations/en/LC_MESSAGES/messages.json |    2 +-
 superset/translations/en/LC_MESSAGES/messages.po   |    2 +-
 superset/translations/fr/LC_MESSAGES/messages.json |   38 +-
 superset/translations/fr/LC_MESSAGES/messages.po   |   41 +-
 superset/translations/messages.pot                 |   23 +-
 superset/translations/pt/LC_MESSAGES/message.json  |   14 +-
 superset/utils/class_utils.py                      |   39 +
 superset/utils/core.py                             |   36 +-
 .../utils/dashboard_filter_scopes_converter.py     |    6 +-
 superset/utils/excel.py                            |    5 +
 superset/utils/machine_auth.py                     |   17 +-
 superset/utils/mock_data.py                        |    3 +-
 superset/utils/webdriver.py                        |    2 +-
 superset/views/base.py                             |   36 +-
 superset/views/core.py                             |   42 +-
 superset/views/database/forms.py                   |    6 +-
 superset/views/database/views.py                   |    4 +-
 superset/views/datasource/schemas.py               |    7 +-
 superset/views/datasource/views.py                 |    2 +
 superset/views/sql_lab/views.py                    |   42 +-
 superset/views/utils.py                            |    6 +-
 superset/viz.py                                    |   15 +-
 tests/integration_tests/cachekeys/api_tests.py     |    5 +
 tests/integration_tests/charts/data/api_tests.py   |   84 +-
 tests/integration_tests/commands_test.py           |    3 +
 tests/integration_tests/core_tests.py              |    7 +-
 tests/integration_tests/dashboard_utils.py         |    7 +-
 tests/integration_tests/datasets/api_tests.py      |    1 +
 tests/integration_tests/datasets/commands_tests.py |    2 +
 tests/integration_tests/datasource_tests.py        |   58 +
 .../db_engine_specs/pinot_tests.py                 |   39 +-
 .../fixtures/birth_names_dashboard.py              |    8 +
 tests/integration_tests/fixtures/importexport.py   |    2 +
 .../fixtures/world_bank_dashboard.py               |    8 +
 tests/integration_tests/reports/alert_tests.py     |   12 +-
 .../security/guest_token_security_tests.py         |  258 +-
 .../security/row_level_security_tests.py           |   15 +
 tests/integration_tests/security_tests.py          |    5 +-
 tests/integration_tests/sql_lab/api_tests.py       |   29 +
 tests/integration_tests/sql_lab/conftest.py        |    9 +-
 tests/integration_tests/tags/api_tests.py          |  112 +
 tests/integration_tests/test_app.py                |    7 +-
 .../charts/commands/importers/v1/utils_test.py     |    1 +
 tests/unit_tests/dao/tag_test.py                   |   25 +
 tests/unit_tests/datasets/commands/export_test.py  |    2 +
 .../unit_tests/db_engine_specs/test_clickhouse.py  |    6 +-
 .../unit_tests/db_engine_specs/test_crdb.py        |   27 +-
 tests/unit_tests/db_engine_specs/test_mysql.py     |   40 +
 tests/unit_tests/db_engine_specs/test_pinot.py     |   57 +
 tests/unit_tests/db_engine_specs/test_trino.py     |   31 +-
 tests/unit_tests/legacy_tests.py                   |  100 +
 tests/unit_tests/sql_lab_test.py                   |   10 +-
 tests/unit_tests/sql_parse_tests.py                |   17 +
 .../.nojekyll => tests/unit_tests/tags/__init__.py |    0
 tests/unit_tests/tags/commands/create_test.py      |  125 +
 tests/unit_tests/tags/commands/update_test.py      |  187 +
 tests/unit_tests/tasks/test_cron_util.py           |  145 +-
 .../unit_tests/utils/excel_tests.py                |   18 +-
 388 files changed, 12605 insertions(+), 7328 deletions(-)
 create mode 100644 docker/nginx/nginx.conf
 create mode 100644 helm/superset/templates/hpa-node.yaml
 create mode 100644 helm/superset/templates/hpa-worker.yaml
 create mode 100644 superset-frontend/packages/superset-ui-core/src/time-format/formatters/finestTemporalGrain.test.ts
 create mode 100644 superset-frontend/packages/superset-ui-core/src/time-format/formatters/finestTemporalGrain.ts
 delete mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/AnimatableDeckGLContainer.jsx
 delete mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/CategoricalDeckGLContainer.jsx
 create mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/CategoricalDeckGLContainer.tsx
 delete mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/DeckGLContainer.jsx
 create mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/DeckGLContainer.tsx
 delete mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/Multi/Multi.jsx
 create mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/Multi/Multi.tsx
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/Multi/{controlPanel.js => controlPanel.ts} (93%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/Multi/{index.js => index.ts} (100%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/{TooltipRow.jsx => TooltipRow.tsx} (68%)
 delete mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/components/BootstrapSliderWrapper.jsx
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/components/{Legend.jsx => Legend.tsx} (50%)
 delete mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/components/PlaySlider.jsx
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/{index.js => index.ts} (100%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Arc/{Arc.jsx => Arc.tsx} (78%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Arc/{index.js => index.ts} (100%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Geojson/{Geojson.jsx => Geojson.tsx} (55%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Geojson/{index.js => index.ts} (100%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/{Grid.jsx => Grid.tsx} (77%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/{index.js => index.ts} (100%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/{Hex.jsx => Hex.tsx} (75%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/{index.js => index.ts} (100%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Path/{Path.jsx => Path.tsx} (78%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Path/{index.js => index.ts} (100%)
 delete mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/Polygon.jsx
 create mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/Polygon.tsx
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/{index.js => index.ts} (100%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Scatter/{Scatter.jsx => Scatter.tsx} (76%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Scatter/{index.js => index.ts} (100%)
 delete mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/Screengrid.jsx
 create mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/Screengrid.tsx
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/{index.js => index.ts} (100%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/{common.jsx => common.tsx} (63%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/{index.js => index.ts} (100%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/{preset.js => preset.ts} (100%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/{transformProps.js => transformProps.ts} (91%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/{controls.jsx => controls.ts} (69%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/{sharedDndControls.jsx => sharedDndControls.tsx} (100%)
 delete mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/utils.js
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/{utils/utils.js => utilities/utils.ts} (69%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/{utils.js => utils.ts} (62%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils/{colors.js => colors.ts} (90%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils/{explore.js => explore.ts} (88%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils/{geo.js => geo.ts} (72%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils/{safeStringify.js => safeStringify.ts} (94%)
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils/{sandbox.js => sandbox.ts} (91%)
 delete mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils/time.js
 rename superset-frontend/plugins/legacy-preset-chart-deckgl/test/utils/{colors.test.js => colors.test.ts} (100%)
 delete mode 100644 superset-frontend/src/SqlLab/components/HighlightedSql/HighlightedSql.test.jsx
 create mode 100644 superset-frontend/src/SqlLab/components/HighlightedSql/HighlightedSql.test.tsx
 rename superset-frontend/src/SqlLab/components/QueryStateLabel/{QueryStateLabel.test.jsx => QueryStateLabel.test.tsx} (59%)
 rename superset-frontend/src/SqlLab/components/QueryTable/{QueryTable.test.jsx => QueryTable.test.tsx} (55%)
 rename superset-frontend/src/SqlLab/components/SouthPane/{SouthPane.test.jsx => SouthPane.test.tsx} (93%)
 create mode 100644 superset-frontend/src/SqlLab/middlewares/persistSqlLabStateEnhancer.js
 rename superset-frontend/src/SqlLab/reducers/{getInitialState.js => getInitialState.ts} (77%)
 create mode 100644 superset-frontend/src/features/tags/BulkTagModal.tsx
 create mode 100644 superset-frontend/src/features/tags/TagModal.test.tsx
 create mode 100644 superset-frontend/src/features/tags/TagModal.tsx
 create mode 100644 superset-frontend/src/hooks/apiResources/sqlLab.test.ts
 create mode 100644 superset-frontend/src/hooks/apiResources/sqlLab.ts
 rename superset/{utils => async_events}/async_query_manager.py (100%)
 copy superset/{tags/exceptions.py => async_events/async_query_manager_factory.py} (58%)
 create mode 100644 superset/cli/viz_migrations.py
 create mode 100755 superset/migrations/versions/2023-09-06_13-18_317970b4400c_added_time_secondary_column_to_.py
 copy superset/migrations/versions/{2023-08-09_14-17_8ace289026f3_add_on_delete_cascade_for_dashboard_slices.py => 2023-09-15_12-58_4b85906e5b91_add_on_delete_cascade_for_dashboard_roles.py} (79%)
 create mode 100644 superset/tags/commands/update.py
 create mode 100644 superset/utils/class_utils.py
 mode change 100644 => 100755 tests/integration_tests/db_engine_specs/pinot_tests.py
 copy superset/explore/form_data/commands/state.py => tests/unit_tests/db_engine_specs/test_crdb.py (54%)
 create mode 100644 tests/unit_tests/db_engine_specs/test_pinot.py
 create mode 100644 tests/unit_tests/legacy_tests.py
 copy docs/static/.nojekyll => tests/unit_tests/tags/__init__.py (100%)
 create mode 100644 tests/unit_tests/tags/commands/create_test.py
 create mode 100644 tests/unit_tests/tags/commands/update_test.py
 copy superset/utils/excel.py => tests/unit_tests/utils/excel_tests.py (67%)


[superset] 02/05: Fix lint

Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch sc_71594
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 3eb59fec0d120493837e96769491e30588afb30b
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Thu Sep 14 14:29:29 2023 -0700

    Fix lint
---
 superset-frontend/src/components/Datasource/DatasourceModal.tsx    | 7 ++++++-
 .../src/components/ErrorMessage/MarshmallowErrorMessage.tsx        | 4 ++--
 superset-frontend/src/components/FilterableTable/index.tsx         | 1 -
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/superset-frontend/src/components/Datasource/DatasourceModal.tsx b/superset-frontend/src/components/Datasource/DatasourceModal.tsx
index fa88989f8a..7cb5f630b6 100644
--- a/superset-frontend/src/components/Datasource/DatasourceModal.tsx
+++ b/superset-frontend/src/components/Datasource/DatasourceModal.tsx
@@ -31,6 +31,7 @@ import {
 
 import Modal from 'src/components/Modal';
 import AsyncEsmComponent from 'src/components/AsyncEsmComponent';
+import { SupersetError } from 'src/components/ErrorMessage/types';
 import ErrorMessageWithStackTrace from 'src/components/ErrorMessage/ErrorMessageWithStackTrace';
 import withToasts from 'src/components/MessageToasts/withToasts';
 import { useSelector } from 'react-redux';
@@ -67,6 +68,10 @@ interface DatasourceModalProps {
   show: boolean;
 }
 
+interface ErrorResponse {
+  errors: SupersetError[];
+}
+
 function buildExtraJsonObject(item: Record<string, unknown>) {
   const certification =
     item?.certified_by || item?.certification_details
@@ -203,7 +208,7 @@ const DatasourceModal: FunctionComponent<DatasourceModalProps> = ({
       })
       .catch(response => {
         setIsSaving(false);
-        response.json().then(errorJson => {
+        response.json().then((errorJson: ErrorResponse) => {
           modal.error({
             title: t('Error saving dataset'),
             okButtonProps: { danger: true, className: 'btn-danger' },
diff --git a/superset-frontend/src/components/ErrorMessage/MarshmallowErrorMessage.tsx b/superset-frontend/src/components/ErrorMessage/MarshmallowErrorMessage.tsx
index 0718840121..854de2ee39 100644
--- a/superset-frontend/src/components/ErrorMessage/MarshmallowErrorMessage.tsx
+++ b/superset-frontend/src/components/ErrorMessage/MarshmallowErrorMessage.tsx
@@ -18,7 +18,7 @@
  */
 import React from 'react';
 import { JSONTree } from 'react-json-tree';
-import { css, styled, t } from '@superset-ui/core';
+import { css, styled, SupersetTheme, t } from '@superset-ui/core';
 
 import { useJsonTreeTheme } from 'src/hooks/useJsonTreeTheme';
 import Collapse from 'src/components/Collapse';
@@ -38,7 +38,7 @@ const StyledUl = styled.ul`
   padding-top: ${({ theme }) => theme.gridUnit * 4}px;
 `;
 
-const collapseStyle = theme => css`
+const collapseStyle = (theme: SupersetTheme) => css`
   .ant-collapse-arrow {
     left: 0px !important;
   }
diff --git a/superset-frontend/src/components/FilterableTable/index.tsx b/superset-frontend/src/components/FilterableTable/index.tsx
index 8e7d54ef9f..b27bc33010 100644
--- a/superset-frontend/src/components/FilterableTable/index.tsx
+++ b/superset-frontend/src/components/FilterableTable/index.tsx
@@ -24,7 +24,6 @@ import {
   t,
   safeHtmlSpan,
   styled,
-  useTheme,
 } from '@superset-ui/core';
 import { useDebounceValue } from 'src/hooks/useDebounceValue';
 import { useJsonTreeTheme } from 'src/hooks/useJsonTreeTheme';


[superset] 01/05: feat: generic marshmallow error component

Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch sc_71594
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 544a6be81262a6bedec015ce29aadfd7a92233d6
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Tue Sep 5 12:13:18 2023 -0700

    feat: generic marshmallow error component
---
 .../src/components/Datasource/DatasourceModal.tsx  |  13 ++-
 .../ErrorMessage/MarshmallowErrorMessage.tsx       | 109 +++++++++++++++++++++
 .../src/components/ErrorMessage/types.ts           |   3 +-
 .../src/components/FilterableTable/index.tsx       |  30 +-----
 superset-frontend/src/hooks/useJsonTreeTheme.ts    |  41 ++++++++
 superset-frontend/src/setup/setupErrorMessages.ts  |   5 +
 superset/datasets/api.py                           |   1 -
 superset/datasets/schemas.py                       |  12 +++
 superset/errors.py                                 |   3 +
 superset/exceptions.py                             |  17 ++++
 10 files changed, 201 insertions(+), 33 deletions(-)

diff --git a/superset-frontend/src/components/Datasource/DatasourceModal.tsx b/superset-frontend/src/components/Datasource/DatasourceModal.tsx
index d4239136a7..fa88989f8a 100644
--- a/superset-frontend/src/components/Datasource/DatasourceModal.tsx
+++ b/superset-frontend/src/components/Datasource/DatasourceModal.tsx
@@ -31,7 +31,7 @@ import {
 
 import Modal from 'src/components/Modal';
 import AsyncEsmComponent from 'src/components/AsyncEsmComponent';
-import { getClientErrorObject } from 'src/utils/getClientErrorObject';
+import ErrorMessageWithStackTrace from 'src/components/ErrorMessage/ErrorMessageWithStackTrace';
 import withToasts from 'src/components/MessageToasts/withToasts';
 import { useSelector } from 'react-redux';
 
@@ -203,11 +203,16 @@ const DatasourceModal: FunctionComponent<DatasourceModalProps> = ({
       })
       .catch(response => {
         setIsSaving(false);
-        getClientErrorObject(response).then(({ error }) => {
+        response.json().then(errorJson => {
           modal.error({
-            title: t('Error'),
-            content: error || t('An error has occurred'),
+            title: t('Error saving dataset'),
             okButtonProps: { danger: true, className: 'btn-danger' },
+            content: (
+              <ErrorMessageWithStackTrace
+                error={errorJson.errors[0]}
+                source="crud"
+              />
+            ),
           });
         });
       });
diff --git a/superset-frontend/src/components/ErrorMessage/MarshmallowErrorMessage.tsx b/superset-frontend/src/components/ErrorMessage/MarshmallowErrorMessage.tsx
new file mode 100644
index 0000000000..0718840121
--- /dev/null
+++ b/superset-frontend/src/components/ErrorMessage/MarshmallowErrorMessage.tsx
@@ -0,0 +1,109 @@
+/**
+ * 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 React from 'react';
+import { JSONTree } from 'react-json-tree';
+import { css, styled, t } from '@superset-ui/core';
+
+import { useJsonTreeTheme } from 'src/hooks/useJsonTreeTheme';
+import Collapse from 'src/components/Collapse';
+import { ErrorMessageComponentProps } from './types';
+
+interface MarshmallowErrorExtra {
+  messages: object;
+  payload: object;
+  issue_codes: {
+    code: number;
+    message: string;
+  }[];
+}
+
+const StyledUl = styled.ul`
+  padding-left: ${({ theme }) => theme.gridUnit * 5}px;
+  padding-top: ${({ theme }) => theme.gridUnit * 4}px;
+`;
+
+const collapseStyle = theme => css`
+  .ant-collapse-arrow {
+    left: 0px !important;
+  }
+  .ant-collapse-header {
+    padding-left: ${theme.gridUnit * 4}px !important;
+  }
+  .ant-collapse-content-box {
+    padding: 0px !important;
+  }
+`;
+
+const extractInvalidValues = (messages: object, payload: object): string[] => {
+  const invalidValues: string[] = [];
+
+  const recursiveExtract = (messages: object, payload: object) => {
+    Object.keys(messages).forEach(key => {
+      const value = payload[key];
+      const message = messages[key];
+
+      if (Array.isArray(message)) {
+        message.forEach(errorMessage => {
+          invalidValues.push(`${errorMessage}: ${value}`);
+        });
+      } else {
+        recursiveExtract(message, value);
+      }
+    });
+  };
+  recursiveExtract(messages, payload);
+  return invalidValues;
+};
+
+export default function MarshmallowErrorMessage({
+  error,
+  // eslint-disable-next-line @typescript-eslint/no-unused-vars
+  source = 'crud',
+  subtitle,
+}: ErrorMessageComponentProps<MarshmallowErrorExtra>) {
+  const jsonTreeTheme = useJsonTreeTheme();
+  const { extra, message } = error;
+
+  return (
+    <div>
+      {subtitle && <h4>{subtitle}</h4>}
+
+      {message}
+
+      <StyledUl>
+        {extractInvalidValues(extra.messages, extra.payload).map(
+          (value, index) => (
+            <li key={index}>{value}</li>
+          ),
+        )}
+      </StyledUl>
+
+      <Collapse ghost css={collapseStyle}>
+        <Collapse.Panel header={t('Details')} key="details" css={collapseStyle}>
+          <JSONTree
+            data={extra.messages}
+            shouldExpandNode={() => true}
+            hideRoot
+            theme={jsonTreeTheme}
+          />
+        </Collapse.Panel>
+      </Collapse>
+    </div>
+  );
+}
diff --git a/superset-frontend/src/components/ErrorMessage/types.ts b/superset-frontend/src/components/ErrorMessage/types.ts
index d3fe5bfdf7..7c4c3fe94a 100644
--- a/superset-frontend/src/components/ErrorMessage/types.ts
+++ b/superset-frontend/src/components/ErrorMessage/types.ts
@@ -79,6 +79,7 @@ export const ErrorTypeEnum = {
   // API errors
   INVALID_PAYLOAD_FORMAT_ERROR: 'INVALID_PAYLOAD_FORMAT_ERROR',
   INVALID_PAYLOAD_SCHEMA_ERROR: 'INVALID_PAYLOAD_SCHEMA_ERROR',
+  MARSHMALLOW_ERROR: 'MARSHMALLOW_ERROR',
 } as const;
 
 type ValueOf<T> = T[keyof T];
@@ -88,7 +89,7 @@ export type ErrorType = ValueOf<typeof ErrorTypeEnum>;
 // Keep in sync with superset/views/errors.py
 export type ErrorLevel = 'info' | 'warning' | 'error';
 
-export type ErrorSource = 'dashboard' | 'explore' | 'sqllab';
+export type ErrorSource = 'dashboard' | 'explore' | 'sqllab' | 'crud';
 
 export type SupersetError<ExtraType = Record<string, any> | null> = {
   error_type: ErrorType;
diff --git a/superset-frontend/src/components/FilterableTable/index.tsx b/superset-frontend/src/components/FilterableTable/index.tsx
index 91fc1f4477..8e7d54ef9f 100644
--- a/superset-frontend/src/components/FilterableTable/index.tsx
+++ b/superset-frontend/src/components/FilterableTable/index.tsx
@@ -27,6 +27,7 @@ import {
   useTheme,
 } from '@superset-ui/core';
 import { useDebounceValue } from 'src/hooks/useDebounceValue';
+import { useJsonTreeTheme } from 'src/hooks/useJsonTreeTheme';
 import Button from '../Button';
 import CopyToClipboard from '../CopyToClipboard';
 import ModalTrigger from '../ModalTrigger';
@@ -183,32 +184,7 @@ const FilterableTable = ({
     return complexColumns[columnKey] ? truncated : content;
   };
 
-  const theme = useTheme();
-  const [jsonTreeTheme, setJsonTreeTheme] = useState<Record<string, string>>();
-
-  const getJsonTreeTheme = () => {
-    if (!jsonTreeTheme) {
-      setJsonTreeTheme({
-        base00: theme.colors.grayscale.dark2,
-        base01: theme.colors.grayscale.dark1,
-        base02: theme.colors.grayscale.base,
-        base03: theme.colors.grayscale.light1,
-        base04: theme.colors.grayscale.light2,
-        base05: theme.colors.grayscale.light3,
-        base06: theme.colors.grayscale.light4,
-        base07: theme.colors.grayscale.light5,
-        base08: theme.colors.error.base,
-        base09: theme.colors.error.light1,
-        base0A: theme.colors.error.light2,
-        base0B: theme.colors.success.base,
-        base0C: theme.colors.primary.light1,
-        base0D: theme.colors.primary.base,
-        base0E: theme.colors.primary.dark1,
-        base0F: theme.colors.error.dark1,
-      });
-    }
-    return jsonTreeTheme;
-  };
+  const jsonTreeTheme = useJsonTreeTheme();
 
   const getWidthsForColumns = () => {
     const PADDING = 50; // accounts for cell padding and width of sorting icon
@@ -293,7 +269,7 @@ const FilterableTable = ({
       modalBody={
         <JSONTree
           data={jsonObject}
-          theme={getJsonTreeTheme()}
+          theme={jsonTreeTheme}
           valueRenderer={renderBigIntStrToNumber}
         />
       }
diff --git a/superset-frontend/src/hooks/useJsonTreeTheme.ts b/superset-frontend/src/hooks/useJsonTreeTheme.ts
new file mode 100644
index 0000000000..a052e22a63
--- /dev/null
+++ b/superset-frontend/src/hooks/useJsonTreeTheme.ts
@@ -0,0 +1,41 @@
+/**
+ * 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 { useTheme } from '@superset-ui/core';
+
+export const useJsonTreeTheme = () => {
+  const theme = useTheme();
+  return {
+    base00: theme.colors.grayscale.dark2,
+    base01: theme.colors.grayscale.dark1,
+    base02: theme.colors.grayscale.base,
+    base03: theme.colors.grayscale.light1,
+    base04: theme.colors.grayscale.light2,
+    base05: theme.colors.grayscale.light3,
+    base06: theme.colors.grayscale.light4,
+    base07: theme.colors.grayscale.light5,
+    base08: theme.colors.error.base,
+    base09: theme.colors.error.light1,
+    base0A: theme.colors.error.light2,
+    base0B: theme.colors.success.base,
+    base0C: theme.colors.primary.light1,
+    base0D: theme.colors.primary.base,
+    base0E: theme.colors.primary.dark1,
+    base0F: theme.colors.error.dark1,
+  };
+};
diff --git a/superset-frontend/src/setup/setupErrorMessages.ts b/superset-frontend/src/setup/setupErrorMessages.ts
index bebb22b20c..59842f190a 100644
--- a/superset-frontend/src/setup/setupErrorMessages.ts
+++ b/superset-frontend/src/setup/setupErrorMessages.ts
@@ -20,6 +20,7 @@ import getErrorMessageComponentRegistry from 'src/components/ErrorMessage/getErr
 import { ErrorTypeEnum } from 'src/components/ErrorMessage/types';
 import TimeoutErrorMessage from 'src/components/ErrorMessage/TimeoutErrorMessage';
 import DatabaseErrorMessage from 'src/components/ErrorMessage/DatabaseErrorMessage';
+import MarshmallowErrorMessage from 'src/components/ErrorMessage/MarshmallowErrorMessage';
 import ParameterErrorMessage from 'src/components/ErrorMessage/ParameterErrorMessage';
 import DatasetNotFoundErrorMessage from 'src/components/ErrorMessage/DatasetNotFoundErrorMessage';
 
@@ -144,5 +145,9 @@ export default function setupErrorMessages() {
     ErrorTypeEnum.FAILED_FETCHING_DATASOURCE_INFO_ERROR,
     DatasetNotFoundErrorMessage,
   );
+  errorMessageComponentRegistry.registerValue(
+    ErrorTypeEnum.MARSHMALLOW_ERROR,
+    MarshmallowErrorMessage,
+  );
   setupErrorMessagesExtra();
 }
diff --git a/superset/datasets/api.py b/superset/datasets/api.py
index 5c722cc0df..e1d7e5a09e 100644
--- a/superset/datasets/api.py
+++ b/superset/datasets/api.py
@@ -332,7 +332,6 @@ class DatasetRestApi(BaseSupersetModelRestApi):
 
     @expose("/<pk>", methods=("PUT",))
     @protect()
-    @safe
     @statsd_metrics
     @event_logger.log_this_with_context(
         action=lambda self, *args, **kwargs: f"{self.__class__.__name__}.put",
diff --git a/superset/datasets/schemas.py b/superset/datasets/schemas.py
index 0b137e96a7..84f0453fb4 100644
--- a/superset/datasets/schemas.py
+++ b/superset/datasets/schemas.py
@@ -24,6 +24,7 @@ from marshmallow.validate import Length
 from marshmallow_sqlalchemy import SQLAlchemyAutoSchema
 
 from superset.datasets.models import Dataset
+from superset.exceptions import SupersetMarshmallowValidationError
 
 get_delete_ids_schema = {"type": "array", "items": {"type": "integer"}}
 get_export_ids_schema = {"type": "array", "items": {"type": "integer"}}
@@ -125,6 +126,17 @@ class DatasetPutSchema(Schema):
     is_managed_externally = fields.Boolean(allow_none=True, dump_default=False)
     external_url = fields.String(allow_none=True)
 
+    def handle_error(
+        self,
+        error: ValidationError,
+        data: dict[str, Any],
+        **kwargs: Any,
+    ) -> None:
+        """
+        Return SIP-40 error.
+        """
+        raise SupersetMarshmallowValidationError(error, data)
+
 
 class DatasetDuplicateSchema(Schema):
     base_model_id = fields.Integer(required=True)
diff --git a/superset/errors.py b/superset/errors.py
index a480ea3d28..87cdf77b99 100644
--- a/superset/errors.py
+++ b/superset/errors.py
@@ -90,6 +90,7 @@ class SupersetErrorType(StrEnum):
     # API errors
     INVALID_PAYLOAD_FORMAT_ERROR = "INVALID_PAYLOAD_FORMAT_ERROR"
     INVALID_PAYLOAD_SCHEMA_ERROR = "INVALID_PAYLOAD_SCHEMA_ERROR"
+    MARSHMALLOW_ERROR = "MARSHMALLOW_ERROR"
 
     # Report errors
     REPORT_NOTIFICATION_ERROR = "REPORT_NOTIFICATION_ERROR"
@@ -144,6 +145,7 @@ ISSUE_CODES = {
     1035: _("Failed to start remote query on a worker."),
     1036: _("The database was deleted."),
     1037: _("Custom SQL fields cannot contain sub-queries."),
+    1040: _("The submitted payload failed validation."),
 }
 
 
@@ -181,6 +183,7 @@ ERROR_TYPES_TO_ISSUE_CODES_MAPPING = {
     SupersetErrorType.ASYNC_WORKERS_ERROR: [1035],
     SupersetErrorType.DATABASE_NOT_FOUND_ERROR: [1011, 1036],
     SupersetErrorType.CONNECTION_DATABASE_TIMEOUT: [1001, 1009],
+    SupersetErrorType.MARSHMALLOW_ERROR: [1040],
 }
 
 
diff --git a/superset/exceptions.py b/superset/exceptions.py
index 5f1df73c86..3642a9279e 100644
--- a/superset/exceptions.py
+++ b/superset/exceptions.py
@@ -278,3 +278,20 @@ class QueryNotFoundException(SupersetException):
 
 class ColumnNotFoundException(SupersetException):
     status = 404
+
+
+class SupersetMarshmallowValidationError(SupersetErrorException):
+    """
+    Exception to be raised for Marshmallow validation errors.
+    """
+
+    status = 422
+
+    def __init__(self, exc: ValidationError, payload: dict[str, Any]):
+        error = SupersetError(
+            message=_("The schema of the submitted payload is invalid."),
+            error_type=SupersetErrorType.MARSHMALLOW_ERROR,
+            level=ErrorLevel.ERROR,
+            extra={"messages": exc.messages, "payload": payload},
+        )
+        super().__init__(error)


[superset] 03/05: Address comments.

Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch sc_71594
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 0a0627cfcf6c427a19d3b68592cd1de849240a15
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Fri Sep 15 12:12:40 2023 -0700

    Address comments.
---
 .../src/components/Datasource/DatasourceModal.test.jsx    |  2 +-
 .../src/components/Datasource/DatasourceModal.tsx         | 15 ++++++++-------
 superset-frontend/src/components/ErrorMessage/types.ts    |  9 +++++++++
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/superset-frontend/src/components/Datasource/DatasourceModal.test.jsx b/superset-frontend/src/components/Datasource/DatasourceModal.test.jsx
index 5bcb705b68..8f6948c25e 100644
--- a/superset-frontend/src/components/Datasource/DatasourceModal.test.jsx
+++ b/superset-frontend/src/components/Datasource/DatasourceModal.test.jsx
@@ -36,7 +36,7 @@ import { api } from 'src/hooks/apiResources/queryApi';
 const datasource = mockDatasource['7__table'];
 
 const SAVE_ENDPOINT = 'glob:*/api/v1/dataset/7';
-const SAVE_PAYLOAD = { new: 'data' };
+const SAVE_PAYLOAD = { json: () => ({ new: 'data' }) };
 const SAVE_DATASOURCE_ENDPOINT = 'glob:*/api/v1/dataset/7';
 const GET_DATASOURCE_ENDPOINT = SAVE_DATASOURCE_ENDPOINT;
 
diff --git a/superset-frontend/src/components/Datasource/DatasourceModal.tsx b/superset-frontend/src/components/Datasource/DatasourceModal.tsx
index 7cb5f630b6..fed45b43f2 100644
--- a/superset-frontend/src/components/Datasource/DatasourceModal.tsx
+++ b/superset-frontend/src/components/Datasource/DatasourceModal.tsx
@@ -31,7 +31,10 @@ import {
 
 import Modal from 'src/components/Modal';
 import AsyncEsmComponent from 'src/components/AsyncEsmComponent';
-import { SupersetError } from 'src/components/ErrorMessage/types';
+import {
+  genericSupersetError,
+  SupersetError,
+} from 'src/components/ErrorMessage/types';
 import ErrorMessageWithStackTrace from 'src/components/ErrorMessage/ErrorMessageWithStackTrace';
 import withToasts from 'src/components/MessageToasts/withToasts';
 import { useSelector } from 'react-redux';
@@ -68,10 +71,6 @@ interface DatasourceModalProps {
   show: boolean;
 }
 
-interface ErrorResponse {
-  errors: SupersetError[];
-}
-
 function buildExtraJsonObject(item: Record<string, unknown>) {
   const certification =
     item?.certified_by || item?.certification_details
@@ -208,13 +207,15 @@ const DatasourceModal: FunctionComponent<DatasourceModalProps> = ({
       })
       .catch(response => {
         setIsSaving(false);
-        response.json().then((errorJson: ErrorResponse) => {
+        response.json().then((errorJson: { errors: SupersetError[] }) => {
           modal.error({
             title: t('Error saving dataset'),
             okButtonProps: { danger: true, className: 'btn-danger' },
             content: (
               <ErrorMessageWithStackTrace
-                error={errorJson.errors[0]}
+                error={
+                  errorJson?.errors?.[0] || genericSupersetError(errorJson)
+                }
                 source="crud"
               />
             ),
diff --git a/superset-frontend/src/components/ErrorMessage/types.ts b/superset-frontend/src/components/ErrorMessage/types.ts
index 7c4c3fe94a..c32435d7f4 100644
--- a/superset-frontend/src/components/ErrorMessage/types.ts
+++ b/superset-frontend/src/components/ErrorMessage/types.ts
@@ -107,3 +107,12 @@ export type ErrorMessageComponentProps<ExtraType = Record<string, any> | null> =
 
 export type ErrorMessageComponent =
   React.ComponentType<ErrorMessageComponentProps>;
+
+/* Generic error to be returned when the backend returns an error response that is not
+ * SIP-41 compliant. */
+export const genericSupersetError = (extra: object) => ({
+  error_type: ErrorTypeEnum.GENERIC_BACKEND_ERROR,
+  extra,
+  level: 'error' as ErrorLevel,
+  message: 'An error occurred',
+});


[superset] 05/05: Add test

Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch sc_71594
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 66fc17e4732bc0e854a184cdcc321c2d347454ad
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Mon Oct 2 17:04:29 2023 -0700

    Add test
---
 .../ErrorMessage/MarshmallowErrorMessage.test.tsx  | 88 ++++++++++++++++++++++
 1 file changed, 88 insertions(+)

diff --git a/superset-frontend/src/components/ErrorMessage/MarshmallowErrorMessage.test.tsx b/superset-frontend/src/components/ErrorMessage/MarshmallowErrorMessage.test.tsx
new file mode 100644
index 0000000000..506c1a5cf6
--- /dev/null
+++ b/superset-frontend/src/components/ErrorMessage/MarshmallowErrorMessage.test.tsx
@@ -0,0 +1,88 @@
+/**
+ * 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 React from 'react';
+import { render, screen, fireEvent } from '@testing-library/react';
+import '@testing-library/jest-dom/extend-expect';
+import { ThemeProvider, supersetTheme } from '@superset-ui/core';
+import { ErrorLevel, ErrorTypeEnum } from 'src/components/ErrorMessage/types';
+import MarshmallowErrorMessage from './MarshmallowErrorMessage';
+
+describe('MarshmallowErrorMessage', () => {
+  const mockError = {
+    extra: {
+      messages: {
+        name: ["can't be blank"],
+        age: {
+          inner: ['is too low'],
+        },
+      },
+      payload: {
+        name: '',
+        age: {
+          inner: 10,
+        },
+      },
+      issue_codes: [],
+    },
+    message: 'Validation failed',
+    error_type: ErrorTypeEnum.MARSHMALLOW_ERROR,
+    level: 'error' as ErrorLevel,
+  };
+
+  test('renders without crashing', () => {
+    render(
+      <ThemeProvider theme={supersetTheme}>
+        <MarshmallowErrorMessage error={mockError} />
+      </ThemeProvider>,
+    );
+    expect(screen.getByText('Validation failed')).toBeInTheDocument();
+  });
+
+  test('renders the provided subtitle', () => {
+    render(
+      <ThemeProvider theme={supersetTheme}>
+        <MarshmallowErrorMessage error={mockError} subtitle="Error Alert" />
+      </ThemeProvider>,
+    );
+    expect(screen.getByText('Error Alert')).toBeInTheDocument();
+  });
+
+  test('renders extracted invalid values', () => {
+    render(
+      <ThemeProvider theme={supersetTheme}>
+        <MarshmallowErrorMessage error={mockError} />
+      </ThemeProvider>,
+    );
+    expect(screen.getByText("can't be blank:")).toBeInTheDocument();
+    expect(screen.getByText('is too low: 10')).toBeInTheDocument();
+  });
+
+  test('renders the JSONTree when details are expanded', () => {
+    render(
+      <ThemeProvider theme={supersetTheme}>
+        <MarshmallowErrorMessage error={mockError} />
+      </ThemeProvider>,
+    );
+    fireEvent.click(screen.getByText('Details'));
+    expect(
+      screen.getByText("can't be blank:", { exact: false }),
+    ).toBeInTheDocument();
+  });
+});


[superset] 04/05: Fix test

Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch sc_71594
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 27e71b6b64301d92105fbea8d4d3db1f01bd3705
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Mon Oct 2 16:41:56 2023 -0700

    Fix test
---
 superset-frontend/src/components/Datasource/DatasourceModal.test.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/superset-frontend/src/components/Datasource/DatasourceModal.test.jsx b/superset-frontend/src/components/Datasource/DatasourceModal.test.jsx
index 8f6948c25e..24536cac00 100644
--- a/superset-frontend/src/components/Datasource/DatasourceModal.test.jsx
+++ b/superset-frontend/src/components/Datasource/DatasourceModal.test.jsx
@@ -36,7 +36,7 @@ import { api } from 'src/hooks/apiResources/queryApi';
 const datasource = mockDatasource['7__table'];
 
 const SAVE_ENDPOINT = 'glob:*/api/v1/dataset/7';
-const SAVE_PAYLOAD = { json: () => ({ new: 'data' }) };
+const SAVE_PAYLOAD = { new: 'data' };
 const SAVE_DATASOURCE_ENDPOINT = 'glob:*/api/v1/dataset/7';
 const GET_DATASOURCE_ENDPOINT = SAVE_DATASOURCE_ENDPOINT;
 
@@ -96,7 +96,7 @@ describe('DatasourceModal', () => {
   it('saves on confirm', async () => {
     const callsP = fetchMock.post(SAVE_ENDPOINT, SAVE_PAYLOAD);
     fetchMock.put(SAVE_DATASOURCE_ENDPOINT, {});
-    fetchMock.get(GET_DATASOURCE_ENDPOINT, {});
+    fetchMock.get(GET_DATASOURCE_ENDPOINT, { result: {} });
     act(() => {
       wrapper
         .find('button[data-test="datasource-modal-save"]')