You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ly...@apache.org on 2023/01/19 16:35:54 UTC

[superset] branch lyndsi/enable-dataset-creation updated (91c6bb2ba5 -> 710644e44e)

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

lyndsi pushed a change to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git


    omit 91c6bb2ba5 Remove user-selected db from local storage when db is deleted
    omit bce77f5e73 Add filter by database ID to rison in queryParams
    omit 2255a6ce65 Change text on footer create button
    omit 5941d037e9 Add table_name query to /chart/add/ redirect
    omit c69dc5d64f Fix DatabaseModal test by mocking useHistory hook
    omit 09cc3bfa96 Add path back into error message
    omit 06363d9dd0 fix lint
    omit 786bcbfd91 Fix useEffect warnings and autosetting db from local storage, add translations, change window.location.href redirect to use history.push()
    omit f1b52e22af Fix lint
    omit 44fac6e4f3 Add dangerToasts to error handling
    omit 1d355b45dc Address Cody's review comments
    omit 155236b280 Use useHistory instead of window.location.href
    omit f45d4eac64 Fix tests
    omit 5aedd6626e Delete AddDatasetModal
    omit 49aff9e811 Create dataset returns user to dataset list
    omit 89bac926d0 Cancel now redirects to the previous page
    omit 834a889426 Change all add dataset entrances to use new create page
    omit 5753b33bda Make defaultPageSize a const and move emptyStateComponent into src/components/EmptyState
    omit d1f836fe35 Create dataset polish/bug fix
    omit 8253fe72a6 Remove console.log
    omit 72b921f0f0 optimized setDatasets call
     add 2ccdb72830 fix: Spacing in alert modal (#22709)
     add 8fa7a75a3b docs(caching): Restructure and improve caching docs (#22687)
     add aeb45ea779 docs(k8s): add note about authlib requirement to oauth setup example (#22710)
     add 90ae7cde93 docs(k8s): add note about database driver dependencies to k8s setup (#22712)
     add eed07410c7 docs: add Mainstrat to INTHEWILD.md (#22718)
     add 91850ebc57 fix: bootstraping frontend (#22720)
     add f5c404fc51 fix(explore): Restore missing dataset states (#22693)
     add 6d1bf92637 build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.45.0 to 5.48.1 in /superset-websocket (#22656)
     add bdf391b05f build(deps): bump json5 from 2.2.0 to 2.2.3 in /superset-websocket (#22576)
     add 892c0de454 build(deps): bump winston from 3.3.3 to 3.8.2 in /superset-websocket (#22655)
     add 863adca3b7 chore(deps): bump pre-commit from 2.14.0 to 2.20.0 in /requirements (#20820)
     add 3c5f75d4c2 chore(deps): bump parse-path and lerna in /superset-frontend (#21612)
     add 79b40bb979 docs: add Swile to users list (#22706)
     add 31e639318b chore(celery): update celery config variables names (#22499)
     add 46794013a0 chore: Adds 1.5.3 release to CHANGELOG.md and UPDATING.md (#22721)
     add f9972ad1ff docs(security): clarify CSP requirements and provide example TALISMAN_CONFIG (#22711)
     add 85da86dc81 fix(helm): remove config overrides for CSRF (#22716)
     add cd1f6d469b fix: remove whitespace from http_path for databricks (#22671)
     add f0d5800810 build(deps): bump json5 from 1.0.1 to 1.0.2 in /superset-frontend (#22578)
     add 910998a5ed build(deps): bump json5 from 2.1.3 to 2.2.3 in /superset-frontend/cypress-base (#22577)
     add 3e009bc71e build(deps): bump json5 from 1.0.1 to 1.0.2 in /superset-embedded-sdk (#22575)
     add 5137d58213 build(deps): bump jsonwebtoken from 8.5.1 to 9.0.0 in /superset-websocket (#22515)
     add eb66590b6a build(deps): bump jsonwebtoken from 8.5.1 to 9.0.0 in /superset-websocket/utils/client-ws-app (#22504)
     add 80b31130b4 fix(async-queries): make global async. queries cookie SameSite option configurable (#21185)
     add 3ed288d4ee chore: Migrate /superset/stop_query/ to API v1 (#22624)
     add 6d37e66cd1 chore: Use redis 7 on tests and pin on local dev and non-dev (#22742)
     add d2a355b2fb feat: Updates button styles of Modal pre-defined functions (#22737)
     add b53941fb3e feat(plugin-chart-echarts): supports sunburst chart v2 [WIP] (#21625)
     add cf3d4f720e build(deps): bump loader-utils from 1.4.0 to 1.4.2 in /superset-frontend (#22138)
     add 25bce881ef build(deps-dev): bump @typescript-eslint/parser from 5.47.0 to 5.48.1 in /superset-websocket (#22739)
     add ffa015887b build(deps): bump express and @applitools/eyes-storybook in /superset-frontend (#22731)
     add 18725bd01b build(deps-dev): bump prettier from 2.8.2 to 2.8.3 in /superset-websocket (#22740)
     add 3559bbfcbd build(deps): bump ws and @types/ws in /superset-websocket (#22738)
     add 2350e54f54 build(deps): bump minimatch from 3.0.4 to 3.1.2 in /superset-frontend/cypress-base (#22745)
     add b1239f276c build(deps-dev): bump @types/jsonwebtoken from 8.5.9 to 9.0.1 in /superset-websocket (#22752)
     add 1a7d262c8e build(deps-dev): bump eslint from 8.29.0 to 8.32.0 in /superset-websocket (#22751)
     add e5fdbf0dff build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.48.1 to 5.48.2 in /superset-websocket (#22750)
     add 02d4adfa2e build(deps): bump minimatch from 3.0.4 to 3.1.2 in /superset-embedded-sdk (#22748)
     add edcbf597f5 chore: re add upload tests (#22753)
     add 0a2fc9cdde fix: change order of webdriver timeout checks (#22698)
     add 08078753b7 fix: Report screenshot cut off on left and right sides (#22614)
     add c58dbf8b9c fix: pass in slack error messages properly (#22727)
     add c536f713d6 fix(ssh-tunnel): wrap pkey into StringIO buffer before creating the tunnel (#22763)
     add 0870a0b046 fix: Read MAPBOX_API_KEY from environment  (#16926)
     add e05ac858f4 chore: upgrade react-resize-detector (#22592)
     add c87f654901 feat: Enable new dataset creation flow (#22610)
     add ad758c0802 feat(ssh_tunnel): Rename allow_ssh_tunneling and change the default value to False (#22723)
     add 02c9242d68 feat: Select all for synchronous select (#22084)
     add e6271f0ca7 fix(ssh-tunnel): update fields for open tunnel with private + private key passwords (#22764)
     add aca2f1b201 chore: adding missing examples in the gallery for some chart types (#22766)
     add 5026da50e1 chore(translation): add missing Russian translation, add plural forms (#22415)
     add 39c96d0568 chore: Migrate .less styles to Emotion (#22474)
     add 577ac81686 chore(ci): fix numpy type errors and revert #22610 (#22782)
     new 3fae26672a optimized setDatasets call
     new af64212f73 Remove console.log
     new 20f9ec4d52 Create dataset polish/bug fix
     new 3fa8675e51 Make defaultPageSize a const and move emptyStateComponent into src/components/EmptyState
     new 95d7e90957 Change all add dataset entrances to use new create page
     new 556d79e2ac Cancel now redirects to the previous page
     new 94b3f7bc40 Create dataset returns user to dataset list
     new 3e45686805 Delete AddDatasetModal
     new ab577189da Fix tests
     new 66fce367be Use useHistory instead of window.location.href
     new 22cc8369d1 Address Cody's review comments
     new 302b902665 Add dangerToasts to error handling
     new 7115a9304c Fix lint
     new 50bd46d2df Fix useEffect warnings and autosetting db from local storage, add translations, change window.location.href redirect to use history.push()
     new a5ef057b36 fix lint
     new db3c69ecc5 Add path back into error message
     new 0d72171d9c Fix DatabaseModal test by mocking useHistory hook
     new bc91531e01 Add table_name query to /chart/add/ redirect
     new 62e701ad75 Change text on footer create button
     new 900d62784a Add filter by database ID to rison in queryParams
     new 710644e44e Remove user-selected db from local storage when db is deleted

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   (91c6bb2ba5)
            \
             N -- N -- N   refs/heads/lyndsi/enable-dataset-creation (710644e44e)

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 21 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/workflows/superset-applitool-cypress.yml   |     2 +-
 .github/workflows/superset-cli.yml                 |     2 +-
 .github/workflows/superset-e2e.yml                 |     2 +-
 .../workflows/superset-python-integrationtest.yml  |     6 +-
 .github/workflows/superset-python-presto-hive.yml  |     4 +-
 CHANGELOG.md                                       |    36 +-
 CONTRIBUTING.md                                    |     7 +-
 RESOURCES/INTHEWILD.md                             |     2 +
 UPDATING.md                                        |    11 +
 docker-compose-non-dev.yml                         |     4 +-
 docker-compose.yml                                 |     2 +-
 docker/.env                                        |     1 +
 docker/.env-non-dev                                |     1 +
 docker/docker-bootstrap.sh                         |     2 +-
 docker/pythonpath_dev/superset_config.py           |    13 +-
 docs/docs/frequently-asked-questions.mdx           |     2 +-
 docs/docs/installation/cache.mdx                   |    70 +-
 docs/docs/installation/running-on-kubernetes.mdx   |    25 +-
 docs/docs/security.mdx                             |    37 +
 docs/static/resources/openapi.json                 |  1258 +-
 helm/superset/Chart.yaml                           |     2 +-
 helm/superset/README.md                            |     2 +-
 helm/superset/templates/_helpers.tpl               |     6 -
 requirements/integration.txt                       |     2 +-
 setup.cfg                                          |     4 +-
 superset-embedded-sdk/package-lock.json            |    48 +-
 superset-frontend/.storybook/preview.jsx           |     8 +-
 .../integration/dashboard/nativeFilters.test.ts    |     4 +-
 .../cypress-base/cypress/support/directories.ts    |     7 +-
 superset-frontend/cypress-base/package-lock.json   |    30 +-
 superset-frontend/package-lock.json                | 15781 +++++++++++-----
 superset-frontend/package.json                     |     6 +-
 .../src/images/example1.jpg                        |   Bin 0 -> 62434 bytes
 .../src/images/example2.jpg                        |   Bin 0 -> 106374 bytes
 .../src/index.js                                   |     3 +
 .../src/images/example.jpg                         |   Bin 0 -> 44054 bytes
 .../legacy-plugin-chart-partition/src/index.js     |     2 +
 .../src/images/example.jpg                         |   Bin 0 -> 59676 bytes
 .../legacy-plugin-chart-pivot-table/src/index.js   |     2 +
 .../src/Compare/images/example.jpg                 |   Bin 0 -> 66360 bytes
 .../legacy-preset-chart-nvd3/src/Compare/index.js  |     2 +
 .../src/MixedTimeseries/images/example.jpg         |   Bin 0 -> 65380 bytes
 .../src/MixedTimeseries/index.ts                   |     2 +
 .../EchartsSunburst.tsx}                           |    85 +-
 .../src/{Funnel => Sunburst}/buildQuery.ts         |     0
 .../src/{Treemap => Sunburst}/controlPanel.tsx     |    87 +-
 .../src/Sunburst}/images/thumbnail.png             |   Bin
 .../src/{Tree => Sunburst}/index.ts                |    21 +-
 .../src/Sunburst/transformProps.ts                 |   362 +
 .../src/{Treemap => Sunburst}/types.ts             |    49 +-
 .../plugin-chart-echarts/src/Treemap/constants.ts  |     2 +-
 .../src/Treemap/transformProps.ts                  |   144 +-
 .../plugin-chart-echarts/src/Treemap/types.ts      |     7 +-
 .../plugins/plugin-chart-echarts/src/index.ts      |     2 +
 .../plugins/plugin-chart-echarts/src/types.ts      |     9 +-
 .../plugin-chart-echarts/src/utils/treeBuilder.ts  |    87 +
 .../test/utils/treeBuilder.test.ts                 |   274 +
 .../src/images/example.jpg                         |   Bin 0 -> 66959 bytes
 .../plugin-chart-pivot-table/src/plugin/index.ts   |     2 +
 .../plugin-chart-pivot-table/types/external.d.ts   |     2 +
 superset-frontend/src/GlobalStyles.tsx             |    33 +
 superset-frontend/src/SqlLab/App.jsx               |     3 +-
 .../SqlLabGlobalStyles.tsx}                        |    20 +-
 superset-frontend/src/SqlLab/actions/sqlLab.js     |     6 +-
 .../src/SqlLab/actions/sqlLab.test.js              |    11 +-
 .../SqlLab/components/AceEditorWrapper/index.tsx   |    26 +-
 .../src/SqlLab/components/App/index.jsx            |    69 +-
 .../components/EstimateQueryCostButton/index.tsx   |    23 +-
 .../QueryStateLabel/QueryStateLabel.test.jsx       |     5 +-
 .../SqlLab/components/QueryStateLabel/index.tsx    |    10 +-
 .../src/SqlLab/components/ResultSet/index.tsx      |    11 +-
 .../src/SqlLab/components/SqlEditor/index.jsx      |    62 +-
 .../SqlLab/components/SqlEditorLeftBar/index.tsx   |    19 +-
 .../SqlLab/components/SqlEditorTabHeader/index.tsx |    26 +-
 .../src/SqlLab/components/TabStatusIcon/index.tsx  |    39 +-
 .../TabbedSqlEditors/TabbedSqlEditors.test.jsx     |     4 +-
 .../SqlLab/components/TabbedSqlEditors/index.jsx   |    10 +-
 .../src/SqlLab/components/TableElement/index.tsx   |    41 +-
 superset-frontend/src/SqlLab/main.less             |   491 -
 .../src/assets/stylesheets/superset.less           |    18 +-
 superset-frontend/src/components/Chart/Chart.jsx   |     4 +
 .../src/components/Modal/Modal.stories.tsx         |    15 +
 superset-frontend/src/components/Modal/Modal.tsx   |    20 +-
 .../src/components/Select/AsyncSelect.tsx          |     4 +-
 .../src/components/Select/CustomTag.tsx            |    21 +-
 .../src/components/Select/Select.stories.tsx       |     8 +
 .../src/components/Select/Select.test.tsx          |   225 +-
 superset-frontend/src/components/Select/Select.tsx |   191 +-
 superset-frontend/src/components/Select/styles.tsx |    14 +-
 superset-frontend/src/components/Select/types.ts   |     3 +-
 superset-frontend/src/components/Select/utils.tsx  |     6 +
 .../src/dashboard/components/Dashboard.jsx         |     1 -
 .../DashboardBuilder/DashboardBuilder.test.tsx     |     4 +-
 .../DashboardBuilder/DashboardBuilder.tsx          |   437 +-
 .../src/dashboard/components/DashboardGrid.jsx     |    84 +-
 .../dashboard/components/DashboardGrid.test.jsx    |     7 -
 .../src/dashboard/components/SliceHeader/index.tsx |    69 +-
 .../components/SliceHeaderControls/index.tsx       |     8 +
 .../src/dashboard/components/dnd/DragDroppable.jsx |    63 +-
 .../components/dnd/DragDroppable.test.jsx          |     5 +-
 .../components/filterscope/FilterScopeSelector.jsx |   280 +-
 .../dashboard/components/gridComponents/Chart.jsx  |    13 +-
 .../components/gridComponents/ChartHolder.tsx      |    13 +-
 .../dashboard/components/gridComponents/Column.jsx |    87 +-
 .../components/gridComponents/Divider.jsx          |    28 +-
 .../dashboard/components/gridComponents/Header.jsx |    63 +-
 .../components/gridComponents/Markdown.jsx         |    37 +-
 .../dashboard/components/gridComponents/Row.jsx    |    84 +-
 .../gridComponents/new/DraggableNewComponent.jsx   |    66 +-
 .../new/DraggableNewComponent.test.jsx             |     6 +-
 .../components/menu/BackgroundStyleDropdown.tsx    |    53 +-
 .../dashboard/components/menu/WithPopoverMenu.tsx  |    70 +-
 .../FilterControls/FilterDivider.stories.tsx       |     1 -
 .../components/resizable/ResizableContainer.jsx    |    92 +-
 .../src/dashboard/containers/DashboardPage.tsx     |     4 +-
 superset-frontend/src/dashboard/styles.ts          |    33 +
 .../src/dashboard/stylesheets/builder.less         |    49 -
 .../dashboard/stylesheets/components/chart.less    |   150 -
 .../dashboard/stylesheets/components/column.less   |    64 -
 .../dashboard/stylesheets/components/divider.less  |    42 -
 .../dashboard/stylesheets/components/header.less   |    87 -
 .../dashboard/stylesheets/components/index.less    |    25 -
 .../dashboard/stylesheets/components/markdown.less |    57 -
 .../stylesheets/components/new-component.less      |    55 -
 .../src/dashboard/stylesheets/components/row.less  |    92 -
 .../src/dashboard/stylesheets/dashboard.less       |   164 -
 .../src/dashboard/stylesheets/dnd.less             |   130 -
 .../stylesheets/filter-scope-selector.less         |   259 -
 .../src/dashboard/stylesheets/grid.less            |    53 -
 .../src/dashboard/stylesheets/index.less           |    28 -
 .../src/dashboard/stylesheets/popover-menu.less    |   140 -
 .../src/dashboard/stylesheets/resizable.less       |   105 -
 .../DatasourceControl/DatasourceControl.test.tsx   |    32 +-
 .../controls/DatasourceControl/index.jsx           |    12 +-
 superset-frontend/src/explore/main.less            |   137 -
 .../components/Select/SelectFilterPlugin.tsx       |     3 -
 superset-frontend/src/middleware/asyncEvent.ts     |     2 +-
 .../src/views/CRUD/alert/AlertReportModal.tsx      |    32 +-
 .../data/database/DatabaseModal/index.test.tsx     |    18 +-
 .../CRUD/data/database/DatabaseModal/index.tsx     |     6 +-
 .../src/views/CRUD/data/database/types.ts          |     2 +-
 superset-frontend/src/views/components/Menu.tsx    |     2 +
 .../visualizations/TimeTable/images/example.jpg    |   Bin 0 -> 72275 bytes
 .../src/visualizations/TimeTable/index.ts          |     2 +
 superset-websocket/package-lock.json               |  1111 +-
 superset-websocket/package.json                    |    18 +-
 .../utils/client-ws-app/package-lock.json          |   162 +-
 .../utils/client-ws-app/package.json               |     2 +-
 superset/config.py                                 |     6 +-
 superset/constants.py                              |     1 +
 superset/databases/api.py                          |     2 +-
 superset/db_engine_specs/athena.py                 |     1 +
 superset/db_engine_specs/base.py                   |     6 +-
 superset/db_engine_specs/bigquery.py               |     1 +
 superset/db_engine_specs/databricks.py             |     5 +
 superset/db_engine_specs/gsheets.py                |     1 +
 superset/db_engine_specs/hive.py                   |     4 +-
 superset/db_engine_specs/postgres.py               |     1 -
 superset/exceptions.py                             |     4 +
 superset/extensions/ssh.py                         |     8 +-
 superset/queries/api.py                            |    78 +-
 superset/queries/dao.py                            |    27 +
 superset/queries/schemas.py                        |     8 +
 superset/reports/commands/alert.py                 |    10 +-
 superset/reports/notifications/slack.py            |    14 +-
 superset/result_set.py                             |    15 +-
 superset/translations/ru/LC_MESSAGES/messages.json |  7595 +++++---
 superset/translations/ru/LC_MESSAGES/messages.po   | 18149 +++++++++++--------
 superset/utils/async_query_manager.py              |     5 +-
 superset/utils/pandas_postprocessing/boxplot.py    |    10 +-
 superset/utils/pandas_postprocessing/flatten.py    |     2 +-
 superset/utils/pandas_postprocessing/utils.py      |     2 +-
 superset/utils/screenshots.py                      |     2 +-
 superset/utils/webdriver.py                        |    13 +-
 superset/views/core.py                             |     1 +
 tests/integration_tests/csv_upload_tests.py        |   327 +-
 tests/integration_tests/databases/api_tests.py     |    16 +-
 tests/integration_tests/datasets/api_tests.py      |    22 +-
 tests/integration_tests/queries/api_tests.py       |    52 +
 tests/integration_tests/reports/commands_tests.py  |    17 +-
 tests/integration_tests/thumbnails_tests.py        |     2 +-
 tests/unit_tests/dao/queries_test.py               |   165 +-
 .../unit_tests/db_engine_specs/test_databricks.py  |    22 +
 183 files changed, 32969 insertions(+), 18243 deletions(-)
 create mode 100644 superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/images/example1.jpg
 create mode 100644 superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/images/example2.jpg
 create mode 100644 superset-frontend/plugins/legacy-plugin-chart-partition/src/images/example.jpg
 create mode 100644 superset-frontend/plugins/legacy-plugin-chart-pivot-table/src/images/example.jpg
 create mode 100644 superset-frontend/plugins/legacy-preset-chart-nvd3/src/Compare/images/example.jpg
 create mode 100644 superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/images/example.jpg
 copy superset-frontend/plugins/plugin-chart-echarts/src/{Treemap/EchartsTreemap.tsx => Sunburst/EchartsSunburst.tsx} (63%)
 copy superset-frontend/plugins/plugin-chart-echarts/src/{Funnel => Sunburst}/buildQuery.ts (100%)
 copy superset-frontend/plugins/plugin-chart-echarts/src/{Treemap => Sunburst}/controlPanel.tsx (63%)
 copy superset-frontend/{packages/generator-superset/generators/plugin-chart/templates/src => plugins/plugin-chart-echarts/src/Sunburst}/images/thumbnail.png (100%)
 copy superset-frontend/plugins/plugin-chart-echarts/src/{Tree => Sunburst}/index.ts (68%)
 create mode 100644 superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/transformProps.ts
 copy superset-frontend/plugins/plugin-chart-echarts/src/{Treemap => Sunburst}/types.ts (57%)
 create mode 100644 superset-frontend/plugins/plugin-chart-echarts/src/utils/treeBuilder.ts
 create mode 100644 superset-frontend/plugins/plugin-chart-echarts/test/utils/treeBuilder.test.ts
 create mode 100644 superset-frontend/plugins/plugin-chart-pivot-table/src/images/example.jpg
 copy superset-frontend/src/{GlobalStyles.tsx => SqlLab/SqlLabGlobalStyles.tsx} (80%)
 delete mode 100644 superset-frontend/src/SqlLab/main.less
 delete mode 100644 superset-frontend/src/dashboard/stylesheets/builder.less
 delete mode 100644 superset-frontend/src/dashboard/stylesheets/components/chart.less
 delete mode 100644 superset-frontend/src/dashboard/stylesheets/components/column.less
 delete mode 100644 superset-frontend/src/dashboard/stylesheets/components/divider.less
 delete mode 100644 superset-frontend/src/dashboard/stylesheets/components/header.less
 delete mode 100644 superset-frontend/src/dashboard/stylesheets/components/index.less
 delete mode 100644 superset-frontend/src/dashboard/stylesheets/components/markdown.less
 delete mode 100644 superset-frontend/src/dashboard/stylesheets/components/new-component.less
 delete mode 100644 superset-frontend/src/dashboard/stylesheets/components/row.less
 delete mode 100644 superset-frontend/src/dashboard/stylesheets/dashboard.less
 delete mode 100644 superset-frontend/src/dashboard/stylesheets/dnd.less
 delete mode 100644 superset-frontend/src/dashboard/stylesheets/filter-scope-selector.less
 delete mode 100644 superset-frontend/src/dashboard/stylesheets/grid.less
 delete mode 100644 superset-frontend/src/dashboard/stylesheets/index.less
 delete mode 100644 superset-frontend/src/dashboard/stylesheets/popover-menu.less
 delete mode 100644 superset-frontend/src/dashboard/stylesheets/resizable.less
 delete mode 100644 superset-frontend/src/explore/main.less
 create mode 100644 superset-frontend/src/visualizations/TimeTable/images/example.jpg


[superset] 11/21: Address Cody's review comments

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 22cc8369d110570283ae87e9bee4e5d2a53846ed
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Wed Jan 11 12:57:38 2023 -0600

    Address Cody's review comments
---
 .../src/explore/components/DatasourcePanel/index.tsx          |  4 +---
 .../src/explore/components/ExploreChartPanel.jsx              |  4 +---
 .../controls/DndColumnSelectControl/ColumnSelectPopover.tsx   |  4 +++-
 .../controls/MetricControl/AdhocMetricEditPopover/index.jsx   |  2 +-
 .../src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx   |  3 +--
 .../views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx    | 11 +++++++++++
 6 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/superset-frontend/src/explore/components/DatasourcePanel/index.tsx b/superset-frontend/src/explore/components/DatasourcePanel/index.tsx
index e24d1100ac..dedffc1044 100644
--- a/superset-frontend/src/explore/components/DatasourcePanel/index.tsx
+++ b/superset-frontend/src/explore/components/DatasourcePanel/index.tsx
@@ -373,9 +373,7 @@ export default function DataSourcePanel({
                     <span
                       role="button"
                       tabIndex={0}
-                      onClick={() => {
-                        window.location.href = '/dataset/add/';
-                      }}
+                      onClick={() => setShowSaveDatasetModal(true)}
                       className="add-dataset-alert-description"
                     >
                       {t('Create a dataset')}
diff --git a/superset-frontend/src/explore/components/ExploreChartPanel.jsx b/superset-frontend/src/explore/components/ExploreChartPanel.jsx
index ac9de71682..03cda337bb 100644
--- a/superset-frontend/src/explore/components/ExploreChartPanel.jsx
+++ b/superset-frontend/src/explore/components/ExploreChartPanel.jsx
@@ -324,9 +324,7 @@ const ExploreChartPanel = ({
                 <span
                   role="button"
                   tabIndex={0}
-                  onClick={() => {
-                    window.location.href = '/dataset/add/';
-                  }}
+                  onClick={() => setShowDatasetModal(true)}
                   css={{ textDecoration: 'underline' }}
                 >
                   {t('Create a dataset')}
diff --git a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx
index 6ea5dbbb90..dbbc8fe948 100644
--- a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx
+++ b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx
@@ -231,7 +231,9 @@ const ColumnSelectPopover = ({
   }, []);
 
   const setDatasetAndClose = () => {
-    window.location.href = '/dataset/add/';
+    if (setDatasetModal) {
+      setDatasetModal(true);
+    }
     onClose();
   };
 
diff --git a/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover/index.jsx b/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover/index.jsx
index f749a5d09f..f49eb5b4f7 100644
--- a/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover/index.jsx
+++ b/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover/index.jsx
@@ -388,7 +388,7 @@ export default class AdhocMetricEditPopover extends React.PureComponent {
                       tabIndex={0}
                       role="button"
                       onClick={() => {
-                        window.location.href = '/dataset/add/';
+                        this.props.handleDatasetModal(true);
                         this.props.onClose();
                       }}
                     >
diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx
index beb250ebd2..bc6bbc1e48 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx
@@ -100,8 +100,7 @@ function Footer({
         if (typeof response === 'number') {
           logEvent(LOG_ACTIONS_DATASET_CREATION_SUCCESS, datasetObject);
           // When a dataset is created the response we get is its ID number
-          window.location.href =
-            '/tablemodelview/list/?pageIndex=0&sortColumn=changed_on_delta_humanized&sortOrder=desc';
+          history.push('/chart/add/');
         }
       });
     }
diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx
index 4f7dfca196..7e66fe59ea 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx
@@ -40,6 +40,7 @@ import {
   emptyStateComponent,
 } from 'src/components/EmptyState';
 import { useToasts } from 'src/components/MessageToasts/withToasts';
+import { LocalStorageKeys, getItem } from 'src/utils/localStorageHelpers';
 import { DatasetActionType } from '../types';
 
 interface LeftPanelProps {
@@ -211,6 +212,16 @@ export default function LeftPanel({
 
   const encodedSchema = schema ? encodeURIComponent(schema) : undefined;
 
+  useEffect(() => {
+    const currentUserSelectedDb = getItem(
+      LocalStorageKeys.db,
+      null,
+    ) as DatabaseObject;
+    if (currentUserSelectedDb) {
+      setDatabase(currentUserSelectedDb);
+    }
+  }, []);
+
   useEffect(() => {
     if (loadTables) {
       const endpoint = encodeURI(


[superset] 06/21: Cancel now redirects to the previous page

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 556d79e2ac8bda14d49c4f646c0f15b4c234f055
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Tue Jan 3 18:53:10 2023 -0600

    Cancel now redirects to the previous page
---
 .../src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx      | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx
index 5aecec0bb8..28e2f71a6f 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx
@@ -17,6 +17,7 @@
  * under the License.
  */
 import React from 'react';
+import { useHistory } from 'react-router-dom';
 import Button from 'src/components/Button';
 import { t } from '@superset-ui/core';
 import { useSingleViewResource } from 'src/views/CRUD/hooks';
@@ -49,12 +50,12 @@ const LOG_ACTIONS = [
 ];
 
 function Footer({
-  url,
   datasetObject,
   addDangerToast,
   hasColumns = false,
   datasets,
 }: FooterProps) {
+  const history = useHistory();
   const { createResource } = useSingleViewResource<Partial<DatasetObject>>(
     'dataset',
     t('dataset'),
@@ -72,11 +73,7 @@ function Footer({
 
     return LOG_ACTIONS[value];
   };
-  const goToPreviousUrl = () => {
-    // this is a placeholder url until the final feature gets implemented
-    // at that point we will be passing in the url of the previous location.
-    window.location.href = url;
-  };
+  const goToPreviousUrl = () => history.goBack();
 
   const cancelButtonOnClick = () => {
     if (!datasetObject) {


[superset] 18/21: Add table_name query to /chart/add/ redirect

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit bc91531e01e5884ac13c6fe78356a567e695997e
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Thu Jan 12 18:45:59 2023 -0600

    Add table_name query to /chart/add/ redirect
---
 .../src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx             | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx
index bc6bbc1e48..12fe94d491 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx
@@ -100,7 +100,7 @@ function Footer({
         if (typeof response === 'number') {
           logEvent(LOG_ACTIONS_DATASET_CREATION_SUCCESS, datasetObject);
           // When a dataset is created the response we get is its ID number
-          history.push('/chart/add/');
+          history.push(`/chart/add/?dataset=${datasetObject.table_name}`);
         }
       });
     }


[superset] 16/21: Add path back into error message

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit db3c69ecc5cea69c02c2301d298bd94078d4ebe6
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Thu Jan 12 17:09:03 2023 -0600

    Add path back into error message
---
 .../src/views/CRUD/data/dataset/AddDataset/DatasetPanel/index.tsx       | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/index.tsx
index 1095f044a0..73bea70b41 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/index.tsx
@@ -98,11 +98,13 @@ const DatasetPanelWrapper = ({
         addDangerToast(
           t(
             'The API response from %s does not match the IDatabaseTable interface.',
+            path,
           ),
         );
         logging.error(
           t(
             'The API response from %s does not match the IDatabaseTable interface.',
+            path,
           ),
         );
       }


[superset] 10/21: Use useHistory instead of window.location.href

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 66fce367be3a37042a50dfba0cd79e815878d26b
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Mon Jan 9 10:45:55 2023 -0600

    Use useHistory instead of window.location.href
---
 superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx
index 7c73b54339..0906776506 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx
@@ -23,6 +23,7 @@ import React, {
   useMemo,
   useCallback,
 } from 'react';
+import { useHistory } from 'react-router-dom';
 import rison from 'rison';
 import {
   createFetchRelated,
@@ -135,6 +136,7 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
   addSuccessToast,
   user,
 }) => {
+  const history = useHistory();
   const {
     state: {
       loading,
@@ -598,7 +600,7 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
         </>
       ),
       onClick: () => {
-        window.location.href = '/dataset/add/';
+        history.push('/dataset/add/');
       },
       buttonStyle: 'primary',
     });


[superset] 01/21: optimized setDatasets call

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 3fae26672a4983774b69cf40c56c3ad0750e23b8
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Mon Nov 21 22:52:47 2022 -0600

    optimized setDatasets call
---
 superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx | 1 +
 1 file changed, 1 insertion(+)

diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx
index e4dbaa9a69..419db0dfe6 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx
@@ -77,6 +77,7 @@ export default function AddDataset() {
   >(datasetReducer, null);
   const [hasColumns, setHasColumns] = useState(false);
   const [datasets, setDatasets] = useState<DatasetObject[]>([]);
+  console.log(datasets);
   const datasetNames = datasets.map(dataset => dataset.table_name);
   const encodedSchema = dataset?.schema
     ? encodeURIComponent(dataset?.schema)


[superset] 17/21: Fix DatabaseModal test by mocking useHistory hook

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 0d72171d9cf68e8427d881a43029128c2e98d899
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Thu Jan 12 18:28:36 2023 -0600

    Fix DatabaseModal test by mocking useHistory hook
---
 .../src/views/CRUD/data/database/DatabaseModal/index.test.tsx     | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx
index ebc20eb388..9542450f44 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx
@@ -43,6 +43,14 @@ jest.mock('@superset-ui/core', () => ({
   isFeatureEnabled: () => true,
 }));
 
+const mockHistoryPush = jest.fn();
+jest.mock('react-router-dom', () => ({
+  ...jest.requireActual('react-router-dom'),
+  useHistory: () => ({
+    push: mockHistoryPush,
+  }),
+}));
+
 const dbProps = {
   show: true,
   database_name: 'my database',


[superset] 19/21: Change text on footer create button

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 62e701ad753fedd14954e4358170f9653582c0b3
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Fri Jan 13 14:24:57 2023 -0600

    Change text on footer create button
---
 .../src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx             | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx
index 12fe94d491..7f6717857f 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx
@@ -106,7 +106,7 @@ function Footer({
     }
   };
 
-  const CREATE_DATASET_TEXT = t('Create Dataset');
+  const CREATE_DATASET_TEXT = t('Create Dataset and Create Chart');
   const disabledCheck =
     !datasetObject?.table_name ||
     !hasColumns ||


[superset] 15/21: fix lint

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit a5ef057b36d175ee93cc0ea7d4e42ce2a8abb73f
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Thu Jan 12 17:03:54 2023 -0600

    fix lint
---
 .../data/dataset/AddDataset/DatasetPanel/fixtures.ts |  1 +
 .../dataset/AddDataset/LeftPanel/LeftPanel.test.tsx  | 20 +++++++++-----------
 .../src/views/CRUD/data/dataset/AddDataset/types.tsx |  2 +-
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/fixtures.ts b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/fixtures.ts
index d3ee58da14..5c09188c61 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/fixtures.ts
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/fixtures.ts
@@ -40,6 +40,7 @@ export const exampleDataset: DatasetObject[] = [
       id: 1,
       database_name: 'test_database',
       owners: [1],
+      backend: 'test_backend',
     },
     schema: 'test_schema',
     dataset_name: 'example_dataset',
diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/LeftPanel.test.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/LeftPanel.test.tsx
index 7457f0c250..bc8c1d03de 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/LeftPanel.test.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/LeftPanel.test.tsx
@@ -21,6 +21,7 @@ import fetchMock from 'fetch-mock';
 import userEvent from '@testing-library/user-event';
 import { render, screen, waitFor } from 'spec/helpers/testing-library';
 import LeftPanel from 'src/views/CRUD/data/dataset/AddDataset/LeftPanel';
+import { exampleDataset } from 'src/views/CRUD/data/dataset/AddDataset/DatasetPanel/fixtures';
 
 const databasesEndpoint = 'glob:*/api/v1/database/?q*';
 const schemasEndpoint = 'glob:*/api/v1/database/*/schemas*';
@@ -181,7 +182,7 @@ test('does not render blank state if there is nothing selected', async () => {
 });
 
 test('renders list of options when user clicks on schema', async () => {
-  render(<LeftPanel setDataset={mockFun} schema="schema_a" dbId={1} />, {
+  render(<LeftPanel setDataset={mockFun} dataset={exampleDataset[0]} />, {
     useRedux: true,
   });
 
@@ -189,23 +190,21 @@ test('renders list of options when user clicks on schema', async () => {
   const databaseSelect = screen.getByRole('combobox', {
     name: 'Select database or type database name',
   });
-  // Schema select should be disabled until database is selected
-  const schemaSelect = screen.getByRole('combobox', {
-    name: /select schema or type schema name/i,
-  });
   userEvent.click(databaseSelect);
   expect(await screen.findByText('test-postgres')).toBeInTheDocument();
-  expect(schemaSelect).toBeDisabled();
   userEvent.click(screen.getByText('test-postgres'));
 
-  // Wait for schema field to be enabled
+  // Schema select will be automatically populated if there is only one schema
+  const schemaSelect = screen.getByRole('combobox', {
+    name: /select schema or type schema name/i,
+  });
   await waitFor(() => {
     expect(schemaSelect).toBeEnabled();
   });
 });
 
 test('searches for a table name', async () => {
-  render(<LeftPanel setDataset={mockFun} schema="schema_a" dbId={1} />, {
+  render(<LeftPanel setDataset={mockFun} dataset={exampleDataset[0]} />, {
     useRedux: true,
   });
 
@@ -245,9 +244,8 @@ test('renders a warning icon when a table name has a pre-existing dataset', asyn
   render(
     <LeftPanel
       setDataset={mockFun}
-      schema="schema_a"
-      dbId={1}
-      datasets={['Sheet2']}
+      dataset={exampleDataset[0]}
+      datasetNames={['Sheet2']}
     />,
     {
       useRedux: true,
diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/types.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/types.tsx
index 9fc1bf3e70..89473e5426 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/types.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/types.tsx
@@ -26,7 +26,7 @@ export enum DatasetActionType {
 }
 
 export interface DatasetObject {
-  db: DatabaseObject;
+  db: DatabaseObject & { owners: [number] };
   schema?: string | null;
   dataset_name: string;
   table_name?: string | null;


[superset] 07/21: Create dataset returns user to dataset list

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 94b3f7bc4020b3080fece8a9ae9e9f10fbbe5802
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Thu Jan 5 14:53:22 2023 -0600

    Create dataset returns user to dataset list
---
 .../src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx         | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx
index 28e2f71a6f..beb250ebd2 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx
@@ -73,7 +73,6 @@ function Footer({
 
     return LOG_ACTIONS[value];
   };
-  const goToPreviousUrl = () => history.goBack();
 
   const cancelButtonOnClick = () => {
     if (!datasetObject) {
@@ -82,7 +81,7 @@ function Footer({
       const logAction = createLogAction(datasetObject);
       logEvent(logAction, datasetObject);
     }
-    goToPreviousUrl();
+    history.goBack();
   };
 
   const tooltipText = t('Select a database table.');
@@ -101,7 +100,8 @@ function Footer({
         if (typeof response === 'number') {
           logEvent(LOG_ACTIONS_DATASET_CREATION_SUCCESS, datasetObject);
           // When a dataset is created the response we get is its ID number
-          goToPreviousUrl();
+          window.location.href =
+            '/tablemodelview/list/?pageIndex=0&sortColumn=changed_on_delta_humanized&sortOrder=desc';
         }
       });
     }


[superset] 08/21: Delete AddDatasetModal

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 3e4568680558b5146e5f48b1bf1b9a7c36cf24a9
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Thu Jan 5 16:06:09 2023 -0600

    Delete AddDatasetModal
---
 .../views/CRUD/data/dataset/AddDatasetModal.tsx    | 172 ---------------------
 .../src/views/components/RightMenu.test.tsx        |   3 -
 2 files changed, 175 deletions(-)

diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDatasetModal.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDatasetModal.tsx
deleted file mode 100644
index d4b1470f38..0000000000
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDatasetModal.tsx
+++ /dev/null
@@ -1,172 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-import React, { FunctionComponent, useState, useEffect } from 'react';
-import { styled, t } from '@superset-ui/core';
-import { useSingleViewResource } from 'src/views/CRUD/hooks';
-import Modal from 'src/components/Modal';
-import TableSelector from 'src/components/TableSelector';
-import withToasts from 'src/components/MessageToasts/withToasts';
-import { DatabaseObject } from 'src/components/DatabaseSelector';
-import {
-  getItem,
-  LocalStorageKeys,
-  setItem,
-} from 'src/utils/localStorageHelpers';
-import { isEmpty } from 'lodash';
-
-type DatasetAddObject = {
-  id: number;
-  database: number;
-  schema: string;
-  table_name: string;
-};
-interface DatasetModalProps {
-  addDangerToast: (msg: string) => void;
-  addSuccessToast: (msg: string) => void;
-  onDatasetAdd?: (dataset: DatasetAddObject) => void;
-  onHide: () => void;
-  show: boolean;
-  history?: any; // So we can render the modal when not using SPA
-}
-
-const TableSelectorContainer = styled.div`
-  padding-bottom: 340px;
-  width: 65%;
-`;
-
-const DatasetModal: FunctionComponent<DatasetModalProps> = ({
-  addDangerToast,
-  onDatasetAdd,
-  onHide,
-  show,
-  history,
-}) => {
-  const [currentDatabase, setCurrentDatabase] = useState<
-    DatabaseObject | undefined
-  >();
-  const [currentSchema, setSchema] = useState<string | undefined>('');
-  const [currentTableName, setTableName] = useState('');
-  const [disableSave, setDisableSave] = useState(true);
-  const {
-    createResource,
-    state: { loading },
-  } = useSingleViewResource<Partial<DatasetAddObject>>(
-    'dataset',
-    t('dataset'),
-    addDangerToast,
-  );
-
-  useEffect(() => {
-    setDisableSave(currentDatabase === undefined || currentTableName === '');
-  }, [currentTableName, currentDatabase]);
-
-  useEffect(() => {
-    const currentUserSelectedDb = getItem(
-      LocalStorageKeys.db,
-      null,
-    ) as DatabaseObject;
-    if (currentUserSelectedDb) setCurrentDatabase(currentUserSelectedDb);
-  }, []);
-
-  const onDbChange = (db: DatabaseObject) => {
-    setCurrentDatabase(db);
-  };
-
-  const onSchemaChange = (schema?: string) => {
-    setSchema(schema);
-  };
-
-  const onTableChange = (tableName: string) => {
-    setTableName(tableName);
-  };
-
-  const clearModal = () => {
-    setSchema('');
-    setTableName('');
-    setCurrentDatabase(undefined);
-    setDisableSave(true);
-  };
-
-  const cleanup = () => {
-    clearModal();
-    setItem(LocalStorageKeys.db, null);
-  };
-
-  const hide = () => {
-    cleanup();
-    onHide();
-  };
-
-  const onSave = () => {
-    if (currentDatabase === undefined) {
-      return;
-    }
-    const data = {
-      database: currentDatabase.id,
-      ...(currentSchema ? { schema: currentSchema } : {}),
-      table_name: currentTableName,
-    };
-    createResource(data).then(response => {
-      if (!response) {
-        return;
-      }
-      if (onDatasetAdd) {
-        onDatasetAdd({ id: response.id, ...response });
-      }
-      // We need to be able to work with no SPA routes opening the modal
-      // So useHistory wont be available always thus we check for it
-      if (!isEmpty(history)) {
-        history?.push(`/chart/add?dataset=${currentTableName}`);
-        cleanup();
-      } else {
-        window.location.href = `/chart/add?dataset=${currentTableName}`;
-        cleanup();
-        onHide();
-      }
-    });
-  };
-
-  return (
-    <Modal
-      disablePrimaryButton={disableSave}
-      primaryButtonLoading={loading}
-      onHandledPrimaryAction={onSave}
-      onHide={hide}
-      primaryButtonName={t('Add Dataset and Create Chart')}
-      show={show}
-      title={t('Add dataset')}
-    >
-      <TableSelectorContainer>
-        <TableSelector
-          clearable={false}
-          formMode
-          database={currentDatabase}
-          schema={currentSchema}
-          tableValue={currentTableName}
-          onDbChange={onDbChange}
-          onSchemaChange={onSchemaChange}
-          onTableSelectChange={onTableChange}
-          handleError={addDangerToast}
-        />
-      </TableSelectorContainer>
-    </Modal>
-  );
-};
-
-export default withToasts(DatasetModal);
diff --git a/superset-frontend/src/views/components/RightMenu.test.tsx b/superset-frontend/src/views/components/RightMenu.test.tsx
index ec12e644db..907c305ff6 100644
--- a/superset-frontend/src/views/components/RightMenu.test.tsx
+++ b/superset-frontend/src/views/components/RightMenu.test.tsx
@@ -30,9 +30,6 @@ jest.mock('react-redux', () => ({
 }));
 
 jest.mock('src/views/CRUD/data/database/DatabaseModal', () => () => <span />);
-jest.mock('src/views/CRUD/data/dataset/AddDatasetModal.tsx', () => () => (
-  <span />
-));
 
 const dropdownItems = [
   {


[superset] 09/21: Fix tests

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit ab577189da0fc8a4784e184d1640ca895df4d505
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Thu Jan 5 17:42:51 2023 -0600

    Fix tests
---
 .../DatasourcePanel/DatasourcePanel.test.tsx        | 21 ---------------------
 .../data/dataset/AddDataset/AddDataset.test.tsx     |  8 ++++++++
 .../data/dataset/AddDataset/Footer/Footer.test.tsx  |  8 ++++++++
 .../dataset/DatasetLayout/DatasetLayout.test.tsx    |  8 ++++++++
 4 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/superset-frontend/src/explore/components/DatasourcePanel/DatasourcePanel.test.tsx b/superset-frontend/src/explore/components/DatasourcePanel/DatasourcePanel.test.tsx
index eedc2fb101..95258f443e 100644
--- a/superset-frontend/src/explore/components/DatasourcePanel/DatasourcePanel.test.tsx
+++ b/superset-frontend/src/explore/components/DatasourcePanel/DatasourcePanel.test.tsx
@@ -186,27 +186,6 @@ test('should render a create dataset infobox', async () => {
   expect(infoboxText).toBeVisible();
 });
 
-test('should render a save dataset modal when "Create a dataset" is clicked', async () => {
-  const newProps = {
-    ...props,
-    datasource: {
-      ...datasource,
-      type: DatasourceType.Query,
-    },
-  };
-  render(<DatasourcePanel {...newProps} />, { useRedux: true, useDnd: true });
-
-  const createButton = await screen.findByRole('button', {
-    name: /create a dataset/i,
-  });
-
-  userEvent.click(createButton);
-
-  const saveDatasetModalTitle = screen.getByText(/save or overwrite dataset/i);
-
-  expect(saveDatasetModalTitle).toBeVisible();
-});
-
 test('should not render a save dataset modal when datasource is not query or dataset', async () => {
   const newProps = {
     ...props,
diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/AddDataset.test.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/AddDataset.test.tsx
index 39fb2b295b..7e5a7de12a 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/AddDataset.test.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/AddDataset.test.tsx
@@ -20,6 +20,14 @@ import React from 'react';
 import { render, screen } from 'spec/helpers/testing-library';
 import AddDataset from 'src/views/CRUD/data/dataset/AddDataset';
 
+const mockHistoryPush = jest.fn();
+jest.mock('react-router-dom', () => ({
+  ...jest.requireActual('react-router-dom'),
+  useHistory: () => ({
+    push: mockHistoryPush,
+  }),
+}));
+
 describe('AddDataset', () => {
   it('renders a blank state AddDataset', async () => {
     render(<AddDataset />, { useRedux: true });
diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/Footer.test.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/Footer.test.tsx
index 8fcbd83b15..a1818cdf22 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/Footer.test.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/Footer.test.tsx
@@ -20,6 +20,14 @@ import React from 'react';
 import { render, screen } from 'spec/helpers/testing-library';
 import Footer from 'src/views/CRUD/data/dataset/AddDataset/Footer';
 
+const mockHistoryPush = jest.fn();
+jest.mock('react-router-dom', () => ({
+  ...jest.requireActual('react-router-dom'),
+  useHistory: () => ({
+    push: mockHistoryPush,
+  }),
+}));
+
 const mockedProps = {
   url: 'realwebsite.com',
 };
diff --git a/superset-frontend/src/views/CRUD/data/dataset/DatasetLayout/DatasetLayout.test.tsx b/superset-frontend/src/views/CRUD/data/dataset/DatasetLayout/DatasetLayout.test.tsx
index 35375a52b4..a1939761aa 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/DatasetLayout/DatasetLayout.test.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/DatasetLayout/DatasetLayout.test.tsx
@@ -25,6 +25,14 @@ import DatasetPanel from 'src/views/CRUD/data/dataset/AddDataset/DatasetPanel';
 import RightPanel from 'src/views/CRUD/data/dataset/AddDataset/RightPanel';
 import Footer from 'src/views/CRUD/data/dataset/AddDataset/Footer';
 
+const mockHistoryPush = jest.fn();
+jest.mock('react-router-dom', () => ({
+  ...jest.requireActual('react-router-dom'),
+  useHistory: () => ({
+    push: mockHistoryPush,
+  }),
+}));
+
 describe('DatasetLayout', () => {
   it('renders nothing when no components are passed in', () => {
     render(<DatasetLayout />);


[superset] 05/21: Change all add dataset entrances to use new create page

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 95d7e9095714bc82015f2c9a5c71aff6b7ec6218
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Tue Jan 3 15:49:55 2023 -0600

    Change all add dataset entrances to use new create page
---
 .../explore/components/DatasourcePanel/index.tsx   |  4 +-
 .../src/explore/components/ExploreChartPanel.jsx   |  4 +-
 .../DndColumnSelectControl/ColumnSelectPopover.tsx |  2 +-
 .../MetricControl/AdhocMetricEditPopover/index.jsx |  2 +-
 .../src/pages/ChartCreation/index.tsx              |  5 +--
 .../CRUD/data/database/DatabaseModal/index.tsx     |  2 +-
 .../src/views/CRUD/data/dataset/DatasetList.tsx    | 43 ++--------------------
 .../src/views/components/RightMenu.tsx             | 17 +--------
 superset/views/datasource/views.py                 |  5 +--
 9 files changed, 15 insertions(+), 69 deletions(-)

diff --git a/superset-frontend/src/explore/components/DatasourcePanel/index.tsx b/superset-frontend/src/explore/components/DatasourcePanel/index.tsx
index dedffc1044..e24d1100ac 100644
--- a/superset-frontend/src/explore/components/DatasourcePanel/index.tsx
+++ b/superset-frontend/src/explore/components/DatasourcePanel/index.tsx
@@ -373,7 +373,9 @@ export default function DataSourcePanel({
                     <span
                       role="button"
                       tabIndex={0}
-                      onClick={() => setShowSaveDatasetModal(true)}
+                      onClick={() => {
+                        window.location.href = '/dataset/add/';
+                      }}
                       className="add-dataset-alert-description"
                     >
                       {t('Create a dataset')}
diff --git a/superset-frontend/src/explore/components/ExploreChartPanel.jsx b/superset-frontend/src/explore/components/ExploreChartPanel.jsx
index 03cda337bb..ac9de71682 100644
--- a/superset-frontend/src/explore/components/ExploreChartPanel.jsx
+++ b/superset-frontend/src/explore/components/ExploreChartPanel.jsx
@@ -324,7 +324,9 @@ const ExploreChartPanel = ({
                 <span
                   role="button"
                   tabIndex={0}
-                  onClick={() => setShowDatasetModal(true)}
+                  onClick={() => {
+                    window.location.href = '/dataset/add/';
+                  }}
                   css={{ textDecoration: 'underline' }}
                 >
                   {t('Create a dataset')}
diff --git a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx
index fee2eb941f..6ea5dbbb90 100644
--- a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx
+++ b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx
@@ -231,7 +231,7 @@ const ColumnSelectPopover = ({
   }, []);
 
   const setDatasetAndClose = () => {
-    if (setDatasetModal) setDatasetModal(true);
+    window.location.href = '/dataset/add/';
     onClose();
   };
 
diff --git a/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover/index.jsx b/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover/index.jsx
index f49eb5b4f7..f749a5d09f 100644
--- a/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover/index.jsx
+++ b/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover/index.jsx
@@ -388,7 +388,7 @@ export default class AdhocMetricEditPopover extends React.PureComponent {
                       tabIndex={0}
                       role="button"
                       onClick={() => {
-                        this.props.handleDatasetModal(true);
+                        window.location.href = '/dataset/add/';
                         this.props.onClose();
                       }}
                     >
diff --git a/superset-frontend/src/pages/ChartCreation/index.tsx b/superset-frontend/src/pages/ChartCreation/index.tsx
index 4aeb7aeed4..bea530fd3a 100644
--- a/superset-frontend/src/pages/ChartCreation/index.tsx
+++ b/superset-frontend/src/pages/ChartCreation/index.tsx
@@ -337,10 +337,7 @@ export class ChartCreation extends React.PureComponent<
     const isButtonDisabled = this.isBtnDisabled();
     const datasetHelpText = this.state.canCreateDataset ? (
       <span data-test="dataset-write">
-        <Link
-          to="/tablemodelview/list/#create"
-          data-test="add-chart-new-dataset"
-        >
+        <Link to="/dataset/add/" data-test="add-chart-new-dataset">
           {t('Add a dataset')}
         </Link>
         {` ${t('or')} `}
diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
index 603f449fec..c3500839d7 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
@@ -1295,7 +1295,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
         onClick={() => {
           setLoading(true);
           fetchAndSetDB();
-          window.location.href = '/tablemodelview/list#create';
+          window.location.href = '/dataset/add/';
         }}
       >
         {t('CREATE DATASET')}
diff --git a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx
index 68c65a7ad1..7c73b54339 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx
@@ -22,16 +22,13 @@ import React, {
   useState,
   useMemo,
   useCallback,
-  useEffect,
 } from 'react';
 import rison from 'rison';
-import { useHistory, useLocation } from 'react-router-dom';
 import {
   createFetchRelated,
   createFetchDistinct,
   createErrorHandler,
 } from 'src/views/CRUD/utils';
-import { getItem, LocalStorageKeys } from 'src/utils/localStorageHelpers';
 import { ColumnObject } from 'src/views/CRUD/data/dataset/types';
 import { useListViewResource } from 'src/views/CRUD/hooks';
 import ConfirmStatusChange from 'src/components/ConfirmStatusChange';
@@ -60,7 +57,6 @@ import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
 import WarningIconWithTooltip from 'src/components/WarningIconWithTooltip';
 import { isUserAdmin } from 'src/dashboard/util/permissionUtils';
 import { GenericLink } from 'src/components/GenericLink/GenericLink';
-import AddDatasetModal from './AddDatasetModal';
 
 import {
   PAGE_SIZE,
@@ -152,9 +148,6 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
     refreshData,
   } = useListViewResource<Dataset>('dataset', t('dataset'), addDangerToast);
 
-  const [datasetAddModalOpen, setDatasetAddModalOpen] =
-    useState<boolean>(false);
-
   const [datasetCurrentlyDeleting, setDatasetCurrentlyDeleting] = useState<
     (Dataset & { chart_count: number; dashboard_count: number }) | null
   >(null);
@@ -191,12 +184,6 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
     hasPerm('can_export') && isFeatureEnabled(FeatureFlag.VERSIONED_EXPORT);
 
   const initialSort = SORT_BY;
-  useEffect(() => {
-    const db = getItem(LocalStorageKeys.db, null);
-    if (!loading && db) {
-      setDatasetAddModalOpen(true);
-    }
-  }, [loading]);
 
   const openDatasetEditModal = useCallback(
     ({ id }: Dataset) => {
@@ -603,26 +590,6 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
     });
   }
 
-  const CREATE_HASH = '#create';
-  const location = useLocation();
-  const history = useHistory();
-
-  //  Sync Dataset Add modal with #create hash
-  useEffect(() => {
-    const modalOpen = location.hash === CREATE_HASH && canCreate;
-    setDatasetAddModalOpen(modalOpen);
-  }, [canCreate, location.hash]);
-
-  //  Add #create hash
-  const openDatasetAddModal = useCallback(() => {
-    history.replace(`${location.pathname}${location.search}${CREATE_HASH}`);
-  }, [history, location.pathname, location.search]);
-
-  //  Remove #create hash
-  const closeDatasetAddModal = useCallback(() => {
-    history.replace(`${location.pathname}${location.search}`);
-  }, [history, location.pathname, location.search]);
-
   if (canCreate) {
     buttonArr.push({
       name: (
@@ -630,7 +597,9 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
           <i className="fa fa-plus" /> {t('Dataset')}{' '}
         </>
       ),
-      onClick: openDatasetAddModal,
+      onClick: () => {
+        window.location.href = '/dataset/add/';
+      },
       buttonStyle: 'primary',
     });
 
@@ -727,12 +696,6 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
   return (
     <>
       <SubMenu {...menuData} />
-      <AddDatasetModal
-        show={datasetAddModalOpen}
-        onHide={closeDatasetAddModal}
-        onDatasetAdd={refreshData}
-        history={history}
-      />
       {datasetCurrentlyDeleting && (
         <DeleteModal
           description={t(
diff --git a/superset-frontend/src/views/components/RightMenu.tsx b/superset-frontend/src/views/components/RightMenu.tsx
index 59e7f7f448..1957060502 100644
--- a/superset-frontend/src/views/components/RightMenu.tsx
+++ b/superset-frontend/src/views/components/RightMenu.tsx
@@ -51,7 +51,6 @@ import {
   GlobalMenuDataOptions,
   RightMenuProps,
 } from './types';
-import AddDatasetModal from '../CRUD/data/dataset/AddDatasetModal';
 
 const extensionsRegistry = getExtensionsRegistry();
 
@@ -143,7 +142,6 @@ const RightMenu = ({
     HAS_GSHEETS_INSTALLED,
   } = useSelector<any, ExtentionConfigs>(state => state.common.conf);
   const [showDatabaseModal, setShowDatabaseModal] = useState<boolean>(false);
-  const [showDatasetModal, setShowDatasetModal] = useState<boolean>(false);
   const [engine, setEngine] = useState<string>('');
   const canSql = findPermission('can_sqllab', 'Superset', roles);
   const canDashboard = findPermission('can_write', 'Dashboard', roles);
@@ -179,6 +177,7 @@ const RightMenu = ({
         {
           label: t('Create dataset'),
           name: GlobalMenuDataOptions.DATASET_CREATION,
+          url: '/dataset/add/',
           perm: canDataset && nonExamplesDBConnected,
         },
         {
@@ -286,8 +285,6 @@ const RightMenu = ({
     } else if (itemChose.key === GlobalMenuDataOptions.GOOGLE_SHEETS) {
       setShowDatabaseModal(true);
       setEngine('Google Sheets');
-    } else if (itemChose.key === GlobalMenuDataOptions.DATASET_CREATION) {
-      setShowDatasetModal(true);
     }
   };
 
@@ -296,10 +293,6 @@ const RightMenu = ({
     setShowDatabaseModal(false);
   };
 
-  const handleOnHideDatasetModalModal = () => {
-    setShowDatasetModal(false);
-  };
-
   const isDisabled = isAdmin && !allowUploads;
 
   const tooltipText = t(
@@ -344,7 +337,6 @@ const RightMenu = ({
   );
 
   const handleDatabaseAdd = () => setQuery({ databaseAdded: true });
-  const handleDatasetAdd = () => setQuery({ datasetAdded: true });
 
   const theme = useTheme();
 
@@ -358,13 +350,6 @@ const RightMenu = ({
           onDatabaseAdd={handleDatabaseAdd}
         />
       )}
-      {canDataset && (
-        <AddDatasetModal
-          onHide={handleOnHideDatasetModalModal}
-          show={showDatasetModal}
-          onDatasetAdd={handleDatasetAdd}
-        />
-      )}
       {environmentTag?.text && (
         <Label
           css={{ borderRadius: `${theme.gridUnit * 125}px` }}
diff --git a/superset/views/datasource/views.py b/superset/views/datasource/views.py
index c2db174cb1..4f158e8369 100644
--- a/superset/views/datasource/views.py
+++ b/superset/views/datasource/views.py
@@ -228,10 +228,7 @@ class DatasetEditor(BaseSupersetView):
     @has_access
     @permission_name("read")
     def root(self) -> FlaskResponse:
-        dev = request.args.get("testing")
-        if dev is not None:
-            return super().render_app_template()
-        return redirect("/")
+        return super().render_app_template()
 
     @expose("/<pk>", methods=["GET"])
     @has_access


[superset] 21/21: Remove user-selected db from local storage when db is deleted

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 710644e44eb3b52f47c170b78b8e1c3ac46a7df4
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Tue Jan 17 16:33:53 2023 -0600

    Remove user-selected db from local storage when db is deleted
---
 superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx
index 744edb51b1..0e3642493a 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseList.tsx
@@ -21,6 +21,7 @@ import React, { useState, useMemo, useEffect } from 'react';
 import rison from 'rison';
 import { useSelector } from 'react-redux';
 import { useQueryParams, BooleanParam } from 'use-query-params';
+import { LocalStorageKeys, setItem } from 'src/utils/localStorageHelpers';
 
 import Loading from 'src/components/Loading';
 import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
@@ -157,6 +158,9 @@ function DatabaseList({ addDangerToast, addSuccessToast }: DatabaseListProps) {
         refreshData();
         addSuccessToast(t('Deleted: %s', dbName));
 
+        // Delete user-selected db from local storage
+        setItem(LocalStorageKeys.db, null);
+
         // Close delete modal
         setDatabaseCurrentlyDeleting(null);
       },


[superset] 04/21: Make defaultPageSize a const and move emptyStateComponent into src/components/EmptyState

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 3fa8675e517ac992dddc5cb74266aced9e46f99c
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Mon Dec 19 09:31:43 2022 -0600

    Make defaultPageSize a const and move emptyStateComponent into src/components/EmptyState
---
 .../src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx           | 1 -
 1 file changed, 1 deletion(-)

diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx
index f11b476195..4f7dfca196 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx
@@ -40,7 +40,6 @@ import {
   emptyStateComponent,
 } from 'src/components/EmptyState';
 import { useToasts } from 'src/components/MessageToasts/withToasts';
-import { emptyStateComponent } from 'src/SqlLab/components/SqlEditorLeftBar';
 import { DatasetActionType } from '../types';
 
 interface LeftPanelProps {


[superset] 02/21: Remove console.log

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit af64212f73689e52d8765b77bcf4833c2e3abca0
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Tue Nov 22 10:11:16 2022 -0600

    Remove console.log
---
 superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx | 1 -
 1 file changed, 1 deletion(-)

diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx
index 419db0dfe6..e4dbaa9a69 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx
@@ -77,7 +77,6 @@ export default function AddDataset() {
   >(datasetReducer, null);
   const [hasColumns, setHasColumns] = useState(false);
   const [datasets, setDatasets] = useState<DatasetObject[]>([]);
-  console.log(datasets);
   const datasetNames = datasets.map(dataset => dataset.table_name);
   const encodedSchema = dataset?.schema
     ? encodeURIComponent(dataset?.schema)


[superset] 03/21: Create dataset polish/bug fix

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 20f9ec4d523d09506126bce6455529fc096a083f
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Tue Nov 29 10:02:33 2022 -0600

    Create dataset polish/bug fix
---
 .../src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx           | 1 +
 1 file changed, 1 insertion(+)

diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx
index 4f7dfca196..f11b476195 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx
@@ -40,6 +40,7 @@ import {
   emptyStateComponent,
 } from 'src/components/EmptyState';
 import { useToasts } from 'src/components/MessageToasts/withToasts';
+import { emptyStateComponent } from 'src/SqlLab/components/SqlEditorLeftBar';
 import { DatasetActionType } from '../types';
 
 interface LeftPanelProps {


[superset] 12/21: Add dangerToasts to error handling

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 302b902665355a255eafc7694ce53412bdcd7b50
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Wed Jan 11 13:40:15 2023 -0600

    Add dangerToasts to error handling
---
 .../views/CRUD/data/dataset/AddDataset/DatasetPanel/index.tsx    | 9 ++++++---
 .../src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx   | 8 +++++---
 .../src/views/CRUD/data/dataset/AddDataset/index.tsx             | 8 +++++---
 superset-frontend/src/views/CRUD/data/hooks.ts                   | 8 +++++---
 4 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/index.tsx
index 15e6225e56..56939258e1 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/index.tsx
@@ -17,8 +17,9 @@
  * under the License.
  */
 import React, { useEffect, useState, useRef } from 'react';
-import { SupersetClient } from '@superset-ui/core';
+import { SupersetClient, logging } from '@superset-ui/core';
 import { DatasetObject } from 'src/views/CRUD/data/dataset/AddDataset/types';
+import { addDangerToast } from 'src/components/MessageToasts/actions';
 import DatasetPanel from './DatasetPanel';
 import { ITableColumn, IDatabaseTable, isIDatabaseTable } from './types';
 
@@ -94,8 +95,10 @@ const DatasetPanelWrapper = ({
         setColumnList([]);
         setHasColumns?.(false);
         setHasError(true);
-        // eslint-disable-next-line no-console
-        console.error(
+        addDangerToast(
+          `The API response from ${path} does not match the IDatabaseTable interface.`,
+        );
+        logging.error(
           `The API response from ${path} does not match the IDatabaseTable interface.`,
         );
       }
diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx
index 7e66fe59ea..50cfb30948 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx
@@ -41,6 +41,7 @@ import {
 } from 'src/components/EmptyState';
 import { useToasts } from 'src/components/MessageToasts/withToasts';
 import { LocalStorageKeys, getItem } from 'src/utils/localStorageHelpers';
+import { addDangerToast } from 'src/components/MessageToasts/actions';
 import { DatasetActionType } from '../types';
 
 interface LeftPanelProps {
@@ -193,9 +194,10 @@ export default function LeftPanel({
         setResetTables(false);
         setRefresh(false);
       })
-      .catch(error =>
-        logging.error('There was an error fetching tables', error),
-      );
+      .catch(error => {
+        addDangerToast('There was an error fetching tables');
+        logging.error('There was an error fetching tables', error);
+      });
   };
 
   const setSchema = (schema: string) => {
diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx
index e4dbaa9a69..005e654627 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx
@@ -20,6 +20,7 @@ import React, { useReducer, Reducer, useEffect, useState } from 'react';
 import { logging } from '@superset-ui/core';
 import { UseGetDatasetsList } from 'src/views/CRUD/data/hooks';
 import rison from 'rison';
+import { addDangerToast } from 'src/components/MessageToasts/actions';
 import Header from './Header';
 import DatasetPanel from './DatasetPanel';
 import LeftPanel from './LeftPanel';
@@ -96,9 +97,10 @@ export default function AddDataset() {
       .then(json => {
         setDatasets(json?.result);
       })
-      .catch(error =>
-        logging.error('There was an error fetching dataset', error),
-      );
+      .catch(error => {
+        addDangerToast('There was an error fetching dataset');
+        logging.error('There was an error fetching dataset', error);
+      });
   };
 
   useEffect(() => {
diff --git a/superset-frontend/src/views/CRUD/data/hooks.ts b/superset-frontend/src/views/CRUD/data/hooks.ts
index 2f2bdd9a2c..82c63bb320 100644
--- a/superset-frontend/src/views/CRUD/data/hooks.ts
+++ b/superset-frontend/src/views/CRUD/data/hooks.ts
@@ -18,6 +18,7 @@
  */
 import { useState, useEffect } from 'react';
 import { SupersetClient, logging } from '@superset-ui/core';
+import { addDangerToast } from 'src/components/MessageToasts/actions';
 
 type BaseQueryObject = {
   id: number;
@@ -80,6 +81,7 @@ export const UseGetDatasetsList = (queryParams: string | undefined) =>
     endpoint: `/api/v1/dataset/?q=${queryParams}`,
   })
     .then(({ json }) => json)
-    .catch(error =>
-      logging.error('There was an error fetching dataset', error),
-    );
+    .catch(error => {
+      addDangerToast('There was an error fetching dataset');
+      logging.error('There was an error fetching dataset', error);
+    });


[superset] 14/21: Fix useEffect warnings and autosetting db from local storage, add translations, change window.location.href redirect to use history.push()

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 50bd46d2dfcd74576e5e5467d78ae04265f55243
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Thu Jan 12 13:28:53 2023 -0600

    Fix useEffect warnings and autosetting db from local storage, add translations, change window.location.href redirect to use history.push()
---
 .../CRUD/data/database/DatabaseModal/index.tsx     |  6 +-
 .../data/dataset/AddDataset/DatasetPanel/index.tsx | 10 ++-
 .../data/dataset/AddDataset/LeftPanel/index.tsx    | 98 +++++++++++++---------
 .../views/CRUD/data/dataset/AddDataset/index.tsx   | 25 +++---
 .../views/CRUD/data/dataset/AddDataset/types.tsx   |  8 +-
 superset-frontend/src/views/CRUD/data/hooks.ts     |  6 +-
 6 files changed, 89 insertions(+), 64 deletions(-)

diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
index c3500839d7..5f85ae0985 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
@@ -31,6 +31,7 @@ import React, {
   useReducer,
   Reducer,
 } from 'react';
+import { useHistory } from 'react-router-dom';
 import { setItem, LocalStorageKeys } from 'src/utils/localStorageHelpers';
 import { UploadChangeParam, UploadFile } from 'antd/lib/upload/interface';
 import Tabs from 'src/components/Tabs';
@@ -518,6 +519,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
     t('database'),
     addDangerToast,
   );
+  const history = useHistory();
 
   const [tabKey, setTabKey] = useState<string>(DEFAULT_TAB_KEY);
   const [availableDbs, getAvailableDbs] = useAvailableDatabases();
@@ -1295,7 +1297,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
         onClick={() => {
           setLoading(true);
           fetchAndSetDB();
-          window.location.href = '/dataset/add/';
+          history.push('/dataset/add/');
         }}
       >
         {t('CREATE DATASET')}
@@ -1306,7 +1308,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
         onClick={() => {
           setLoading(true);
           fetchAndSetDB();
-          window.location.href = `/superset/sqllab/?db=true`;
+          history.push(`/superset/sqllab/?db=true`);
         }}
       >
         {t('QUERY DATA IN SQL LAB')}
diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/index.tsx
index 56939258e1..1095f044a0 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/DatasetPanel/index.tsx
@@ -17,7 +17,7 @@
  * under the License.
  */
 import React, { useEffect, useState, useRef } from 'react';
-import { SupersetClient, logging } from '@superset-ui/core';
+import { SupersetClient, logging, t } from '@superset-ui/core';
 import { DatasetObject } from 'src/views/CRUD/data/dataset/AddDataset/types';
 import { addDangerToast } from 'src/components/MessageToasts/actions';
 import DatasetPanel from './DatasetPanel';
@@ -96,10 +96,14 @@ const DatasetPanelWrapper = ({
         setHasColumns?.(false);
         setHasError(true);
         addDangerToast(
-          `The API response from ${path} does not match the IDatabaseTable interface.`,
+          t(
+            'The API response from %s does not match the IDatabaseTable interface.',
+          ),
         );
         logging.error(
-          `The API response from ${path} does not match the IDatabaseTable interface.`,
+          t(
+            'The API response from %s does not match the IDatabaseTable interface.',
+          ),
         );
       }
     } catch (error) {
diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx
index be9181c70a..14dd7dca4b 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx
@@ -16,7 +16,13 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import React, { useEffect, useState, SetStateAction, Dispatch } from 'react';
+import React, {
+  useEffect,
+  useState,
+  SetStateAction,
+  Dispatch,
+  useCallback,
+} from 'react';
 import {
   SupersetClient,
   t,
@@ -41,13 +47,15 @@ import {
 } from 'src/components/EmptyState';
 import { useToasts } from 'src/components/MessageToasts/withToasts';
 import { LocalStorageKeys, getItem } from 'src/utils/localStorageHelpers';
-import { DatasetActionType } from '../types';
+import {
+  DatasetActionType,
+  DatasetObject,
+} from 'src/views/CRUD/data/dataset/AddDataset/types';
 
 interface LeftPanelProps {
   setDataset: Dispatch<SetStateAction<object>>;
-  schema?: string | null | undefined;
-  dbId?: number;
-  datasets?: (string | null | undefined)[] | undefined;
+  dataset?: Partial<DatasetObject> | null;
+  datasetNames?: (string | null | undefined)[] | undefined;
 }
 
 const SearchIcon = styled(Icons.Search)`
@@ -146,9 +154,8 @@ const LeftPanelStyle = styled.div`
 
 export default function LeftPanel({
   setDataset,
-  schema,
-  dbId,
-  datasets,
+  dataset,
+  datasetNames,
 }: LeftPanelProps) {
   const theme = useTheme();
 
@@ -161,11 +168,14 @@ export default function LeftPanel({
 
   const { addDangerToast } = useToasts();
 
-  const setDatabase = (db: Partial<DatabaseObject>) => {
-    setDataset({ type: DatasetActionType.selectDatabase, payload: { db } });
-    setSelectedTable(null);
-    setResetTables(true);
-  };
+  const setDatabase = useCallback(
+    (db: Partial<DatabaseObject>) => {
+      setDataset({ type: DatasetActionType.selectDatabase, payload: { db } });
+      setSelectedTable(null);
+      setResetTables(true);
+    },
+    [setDataset],
+  );
 
   const setTable = (tableName: string, index: number) => {
     setSelectedTable(index);
@@ -175,29 +185,32 @@ export default function LeftPanel({
     });
   };
 
-  const getTablesList = (url: string) => {
-    SupersetClient.get({ url })
-      .then(({ json }) => {
-        const options: TableOption[] = json.options.map((table: Table) => {
-          const option: TableOption = {
-            value: table.value,
-            label: <TableOption table={table} />,
-            text: table.label,
-          };
+  const getTablesList = useCallback(
+    (url: string) => {
+      SupersetClient.get({ url })
+        .then(({ json }) => {
+          const options: TableOption[] = json.options.map((table: Table) => {
+            const option: TableOption = {
+              value: table.value,
+              label: <TableOption table={table} />,
+              text: table.label,
+            };
 
-          return option;
-        });
+            return option;
+          });
 
-        setTableOptions(options);
-        setLoadTables(false);
-        setResetTables(false);
-        setRefresh(false);
-      })
-      .catch(error => {
-        addDangerToast('There was an error fetching tables');
-        logging.error('There was an error fetching tables', error);
-      });
-  };
+          setTableOptions(options);
+          setLoadTables(false);
+          setResetTables(false);
+          setRefresh(false);
+        })
+        .catch(error => {
+          addDangerToast(t('There was an error fetching tables'));
+          logging.error(t('There was an error fetching tables'), error);
+        });
+    },
+    [addDangerToast],
+  );
 
   const setSchema = (schema: string) => {
     if (schema) {
@@ -211,7 +224,9 @@ export default function LeftPanel({
     setResetTables(true);
   };
 
-  const encodedSchema = schema ? encodeURIComponent(schema) : undefined;
+  const encodedSchema = dataset?.schema
+    ? encodeURIComponent(dataset?.schema)
+    : undefined;
 
   useEffect(() => {
     const currentUserSelectedDb = getItem(
@@ -221,16 +236,16 @@ export default function LeftPanel({
     if (currentUserSelectedDb) {
       setDatabase(currentUserSelectedDb);
     }
-  }, []);
+  }, [setDatabase]);
 
   useEffect(() => {
     if (loadTables) {
       const endpoint = encodeURI(
-        `/superset/tables/${dbId}/${encodedSchema}/${refresh}/`,
+        `/superset/tables/${dataset?.db?.id}/${encodedSchema}/${refresh}/`,
       );
       getTablesList(endpoint);
     }
-  }, [loadTables]);
+  }, [loadTables, dataset?.db?.id, encodedSchema, getTablesList, refresh]);
 
   useEffect(() => {
     if (resetTables) {
@@ -274,6 +289,7 @@ export default function LeftPanel({
         {SELECT_DATABASE_AND_SCHEMA_TEXT}
       </p>
       <DatabaseSelector
+        db={dataset?.db}
         handleError={addDangerToast}
         onDbChange={setDatabase}
         onSchemaChange={setSchema}
@@ -281,7 +297,7 @@ export default function LeftPanel({
         onEmptyResults={onEmptyResults}
       />
       {loadTables && !refresh && Loader(TABLE_LOADING_TEXT)}
-      {schema && !loadTables && !tableOptions.length && !searchVal && (
+      {dataset?.schema && !loadTables && !tableOptions.length && !searchVal && (
         <div className="emptystate">
           <EmptyStateMedium
             image="empty-table.svg"
@@ -291,7 +307,7 @@ export default function LeftPanel({
         </div>
       )}
 
-      {schema && (tableOptions.length > 0 || searchVal.length > 0) && (
+      {dataset?.schema && (tableOptions.length > 0 || searchVal.length > 0) && (
         <>
           <Form>
             <p className="table-title">{SELECT_DATABASE_TABLE_TEXT}</p>
@@ -335,7 +351,7 @@ export default function LeftPanel({
                   onClick={() => setTable(option.value, i)}
                 >
                   {option.label}
-                  {datasets?.includes(option.value) && (
+                  {datasetNames?.includes(option.value) && (
                     <Icons.Warning
                       iconColor={
                         selectedTable === i
diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx
index 005e654627..05ffc3a343 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx
@@ -16,8 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import React, { useReducer, Reducer, useEffect, useState } from 'react';
-import { logging } from '@superset-ui/core';
+import React, {
+  useReducer,
+  Reducer,
+  useEffect,
+  useState,
+  useCallback,
+} from 'react';
+import { logging, t } from '@superset-ui/core';
 import { UseGetDatasetsList } from 'src/views/CRUD/data/hooks';
 import rison from 'rison';
 import { addDangerToast } from 'src/components/MessageToasts/actions';
@@ -92,22 +98,22 @@ export default function AddDataset() {
       })
     : undefined;
 
-  const getDatasetsList = async () => {
+  const getDatasetsList = useCallback(async () => {
     await UseGetDatasetsList(queryParams)
       .then(json => {
         setDatasets(json?.result);
       })
       .catch(error => {
-        addDangerToast('There was an error fetching dataset');
-        logging.error('There was an error fetching dataset', error);
+        addDangerToast(t('There was an error fetching dataset'));
+        logging.error(t('There was an error fetching dataset'), error);
       });
-  };
+  }, [queryParams]);
 
   useEffect(() => {
     if (dataset?.schema) {
       getDatasetsList();
     }
-  }, [dataset?.schema]);
+  }, [dataset?.schema, getDatasetsList]);
 
   const HeaderComponent = () => (
     <Header setDataset={setDataset} title={dataset?.table_name} />
@@ -116,9 +122,8 @@ export default function AddDataset() {
   const LeftPanelComponent = () => (
     <LeftPanel
       setDataset={setDataset}
-      schema={dataset?.schema}
-      dbId={dataset?.db?.id}
-      datasets={datasetNames}
+      dataset={dataset}
+      datasetNames={datasetNames}
     />
   );
 
diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/types.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/types.tsx
index dbeef93ead..9fc1bf3e70 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/types.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/types.tsx
@@ -16,6 +16,8 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+import { DatabaseObject } from 'src/components/DatabaseSelector';
+
 export enum DatasetActionType {
   selectDatabase,
   selectSchema,
@@ -24,11 +26,7 @@ export enum DatasetActionType {
 }
 
 export interface DatasetObject {
-  db: {
-    id: number;
-    database_name?: string;
-    owners?: number[];
-  };
+  db: DatabaseObject;
   schema?: string | null;
   dataset_name: string;
   table_name?: string | null;
diff --git a/superset-frontend/src/views/CRUD/data/hooks.ts b/superset-frontend/src/views/CRUD/data/hooks.ts
index 82c63bb320..e15e4be957 100644
--- a/superset-frontend/src/views/CRUD/data/hooks.ts
+++ b/superset-frontend/src/views/CRUD/data/hooks.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 import { useState, useEffect } from 'react';
-import { SupersetClient, logging } from '@superset-ui/core';
+import { SupersetClient, logging, t } from '@superset-ui/core';
 import { addDangerToast } from 'src/components/MessageToasts/actions';
 
 type BaseQueryObject = {
@@ -82,6 +82,6 @@ export const UseGetDatasetsList = (queryParams: string | undefined) =>
   })
     .then(({ json }) => json)
     .catch(error => {
-      addDangerToast('There was an error fetching dataset');
-      logging.error('There was an error fetching dataset', error);
+      addDangerToast(t('There was an error fetching dataset'));
+      logging.error(t('There was an error fetching dataset'), error);
     });


[superset] 13/21: Fix lint

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 7115a9304c95de5f135750996f83e00eab354935
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Wed Jan 11 13:49:22 2023 -0600

    Fix lint
---
 .../src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx           | 1 -
 1 file changed, 1 deletion(-)

diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx
index 50cfb30948..be9181c70a 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/LeftPanel/index.tsx
@@ -41,7 +41,6 @@ import {
 } from 'src/components/EmptyState';
 import { useToasts } from 'src/components/MessageToasts/withToasts';
 import { LocalStorageKeys, getItem } from 'src/utils/localStorageHelpers';
-import { addDangerToast } from 'src/components/MessageToasts/actions';
 import { DatasetActionType } from '../types';
 
 interface LeftPanelProps {


[superset] 20/21: Add filter by database ID to rison in queryParams

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

lyndsi pushed a commit to branch lyndsi/enable-dataset-creation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 900d62784a88a52f48d30aa25679023f7c5a9e64
Author: lyndsiWilliams <kc...@gmail.com>
AuthorDate: Tue Jan 17 15:57:37 2023 -0600

    Add filter by database ID to rison in queryParams
---
 superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx | 1 +
 1 file changed, 1 insertion(+)

diff --git a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx
index 05ffc3a343..1cb4b0d5ae 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/AddDataset/index.tsx
@@ -92,6 +92,7 @@ export default function AddDataset() {
   const queryParams = dataset?.schema
     ? rison.encode_uri({
         filters: [
+          { col: 'database', opr: 'rel_o_m', value: dataset?.db?.id },
           { col: 'schema', opr: 'eq', value: encodedSchema },
           { col: 'sql', opr: 'dataset_is_null_or_empty', value: '!t' },
         ],