You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/12/03 02:31:38 UTC
[GitHub] [incubator-superset] betodealmeida opened a new pull request #11910: feat: add modal to import datasets
betodealmeida opened a new pull request #11910:
URL: https://github.com/apache/incubator-superset/pull/11910
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
Similar to https://github.com/apache/incubator-superset/pull/11884, this adds a modal to import datasets.
If the database doesn't exist and needs a password the user will be prompted for it; see the screenshot below.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->

### TEST PLAN
<!--- What steps should be taken to verify the changes -->
Tested importing virtual and physical datasets, both with the database already there as well as importing the database together with the dataset.
Added tests as well.
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [X] Has associated issue: https://github.com/apache/incubator-superset/issues/11167
- [ ] Changes UI
- [ ] Requires DB Migration.
- [ ] Confirm DB Migration upgrade and downgrade tested.
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] codecov-io edited a comment on pull request #11910: feat: add modal to import datasets
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #11910:
URL: https://github.com/apache/incubator-superset/pull/11910#issuecomment-737639040
# [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=h1) Report
> Merging [#11910](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=desc) (f34a3d2) into [SO-1157](https://codecov.io/gh/apache/incubator-superset/commit/90569fdea80ac56e8dc879167876f66b36ac99d7?el=desc) (90569fd) will **increase** coverage by `0.37%`.
> The diff coverage is `72.22%`.
[](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## SO-1157 #11910 +/- ##
===========================================
+ Coverage 66.95% 67.32% +0.37%
===========================================
Files 932 918 -14
Lines 46215 44674 -1541
Branches 4749 4254 -495
===========================================
- Hits 30942 30079 -863
+ Misses 15171 14488 -683
- Partials 102 107 +5
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `54.23% <1.85%> (-0.85%)` | :arrow_down: |
| javascript | `62.82% <61.29%> (-0.01%)` | :arrow_down: |
| python | `64.02% <96.42%> (+0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...nd/src/views/CRUD/data/dataset/AddDatasetModal.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhc2V0L0FkZERhdGFzZXRNb2RhbC50c3g=) | `57.57% <ø> (ø)` | |
| [...ontend/src/views/CRUD/data/dataset/DatasetList.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhc2V0L0RhdGFzZXRMaXN0LnRzeA==) | `67.30% <46.15%> (+16.27%)` | :arrow_up: |
| [...nd/src/datasource/components/ImportModal/index.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2RhdGFzb3VyY2UvY29tcG9uZW50cy9JbXBvcnRNb2RhbC9pbmRleC50c3g=) | `65.30% <65.30%> (ø)` | |
| [...uperset/datasets/commands/importers/v1/\_\_init\_\_.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvaW1wb3J0ZXJzL3YxL19faW5pdF9fLnB5) | `92.20% <85.71%> (-0.65%)` | :arrow_down: |
| [...perset/databases/commands/importers/v1/\_\_init\_\_.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL2ltcG9ydGVycy92MS9fX2luaXRfXy5weQ==) | `97.22% <100.00%> (+0.07%)` | :arrow_up: |
| [superset/datasets/api.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvYXBpLnB5) | `92.05% <100.00%> (+0.07%)` | :arrow_up: |
| [superset/datasets/commands/importers/dispatcher.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvaW1wb3J0ZXJzL2Rpc3BhdGNoZXIucHk=) | `87.09% <100.00%> (+0.88%)` | :arrow_up: |
| [superset/datasets/commands/importers/v0.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvaW1wb3J0ZXJzL3YwLnB5) | `81.67% <100.00%> (ø)` | |
| [superset/datasets/schemas.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvc2NoZW1hcy5weQ==) | `96.39% <100.00%> (ø)` | |
| [...et-frontend/src/SqlLab/reducers/getInitialState.js](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9yZWR1Y2Vycy9nZXRJbml0aWFsU3RhdGUuanM=) | `33.33% <0.00%> (-16.67%)` | :arrow_down: |
| ... and [67 more](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=footer). Last update [90569fd...f34a3d2](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] hughhhh commented on a change in pull request #11910: feat: add modal to import datasets
Posted by GitBox <gi...@apache.org>.
hughhhh commented on a change in pull request #11910:
URL: https://github.com/apache/incubator-superset/pull/11910#discussion_r537714027
##########
File path: superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx
##########
@@ -114,6 +116,22 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
setDatasetCurrentlyEditing,
] = useState<Dataset | null>(null);
+ const [importingDataset, showImportModal] = useState<boolean>(false);
+ const [passwordFields, setPasswordFields] = useState<string[]>([]);
+
+ function openDatasetImportModal() {
Review comment:
use const format for functions
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] codecov-io commented on pull request #11910: feat: add modal to import datasets
Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #11910:
URL: https://github.com/apache/incubator-superset/pull/11910#issuecomment-737639040
# [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=h1) Report
> Merging [#11910](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=desc) (8de1508) into [SO-1157](https://codecov.io/gh/apache/incubator-superset/commit/4e7a189b3922e44e8ef3ca028952a277731a2c41?el=desc) (4e7a189) will **decrease** coverage by `5.08%`.
> The diff coverage is `58.33%`.
[](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## SO-1157 #11910 +/- ##
===========================================
- Coverage 67.89% 62.81% -5.09%
===========================================
Files 919 459 -460
Lines 45546 16505 -29041
Branches 4245 4256 +11
===========================================
- Hits 30923 10367 -20556
+ Misses 14520 5959 -8561
- Partials 103 179 +76
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `?` | |
| javascript | `62.81% <58.33%> (-0.02%)` | :arrow_down: |
| python | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...nd/src/views/CRUD/data/dataset/AddDatasetModal.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhc2V0L0FkZERhdGFzZXRNb2RhbC50c3g=) | `57.57% <ø> (ø)` | |
| [...ontend/src/views/CRUD/data/dataset/DatasetList.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhc2V0L0RhdGFzZXRMaXN0LnRzeA==) | `67.30% <46.15%> (-1.93%)` | :arrow_down: |
| [...nd/src/datasource/components/ImportModal/index.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2RhdGFzb3VyY2UvY29tcG9uZW50cy9JbXBvcnRNb2RhbC9pbmRleC50c3g=) | `61.70% <61.70%> (ø)` | |
| [superset-frontend/src/SqlLab/App.jsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9BcHAuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [superset-frontend/src/explore/App.jsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvQXBwLmpzeA==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [superset-frontend/src/dashboard/App.jsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9BcHAuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [superset-frontend/src/explore/index.jsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvaW5kZXguanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [superset-frontend/src/dashboard/index.jsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9pbmRleC5qc3g=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [superset-frontend/src/setup/setupColors.js](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3NldHVwL3NldHVwQ29sb3JzLmpz) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [superset-frontend/src/chart/ChartContainer.jsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NoYXJ0L0NoYXJ0Q29udGFpbmVyLmpzeA==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| ... and [625 more](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=footer). Last update [4e7a189...8de1508](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] codecov-io edited a comment on pull request #11910: feat: add modal to import datasets
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #11910:
URL: https://github.com/apache/incubator-superset/pull/11910#issuecomment-737639040
# [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=h1) Report
> Merging [#11910](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=desc) (f34a3d2) into [SO-1157](https://codecov.io/gh/apache/incubator-superset/commit/90569fdea80ac56e8dc879167876f66b36ac99d7?el=desc) (90569fd) will **decrease** coverage by `3.37%`.
> The diff coverage is `72.22%`.
[](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## SO-1157 #11910 +/- ##
===========================================
- Coverage 66.95% 63.57% -3.38%
===========================================
Files 932 918 -14
Lines 46215 44665 -1550
Branches 4749 4254 -495
===========================================
- Hits 30942 28395 -2547
- Misses 15171 16091 +920
- Partials 102 179 +77
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `?` | |
| javascript | `62.82% <61.29%> (-0.01%)` | :arrow_down: |
| python | `64.01% <96.42%> (+<0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...nd/src/views/CRUD/data/dataset/AddDatasetModal.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhc2V0L0FkZERhdGFzZXRNb2RhbC50c3g=) | `57.57% <ø> (ø)` | |
| [...ontend/src/views/CRUD/data/dataset/DatasetList.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhc2V0L0RhdGFzZXRMaXN0LnRzeA==) | `67.30% <46.15%> (+16.27%)` | :arrow_up: |
| [...nd/src/datasource/components/ImportModal/index.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2RhdGFzb3VyY2UvY29tcG9uZW50cy9JbXBvcnRNb2RhbC9pbmRleC50c3g=) | `65.30% <65.30%> (ø)` | |
| [...uperset/datasets/commands/importers/v1/\_\_init\_\_.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvaW1wb3J0ZXJzL3YxL19faW5pdF9fLnB5) | `92.20% <85.71%> (-0.65%)` | :arrow_down: |
| [...perset/databases/commands/importers/v1/\_\_init\_\_.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL2ltcG9ydGVycy92MS9fX2luaXRfXy5weQ==) | `97.22% <100.00%> (+0.07%)` | :arrow_up: |
| [superset/datasets/api.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvYXBpLnB5) | `92.05% <100.00%> (+0.07%)` | :arrow_up: |
| [superset/datasets/commands/importers/dispatcher.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvaW1wb3J0ZXJzL2Rpc3BhdGNoZXIucHk=) | `87.09% <100.00%> (+0.88%)` | :arrow_up: |
| [superset/datasets/commands/importers/v0.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvaW1wb3J0ZXJzL3YwLnB5) | `81.67% <100.00%> (ø)` | |
| [superset/datasets/schemas.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvc2NoZW1hcy5weQ==) | `96.39% <100.00%> (ø)` | |
| [superset-frontend/src/SqlLab/App.jsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9BcHAuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| ... and [210 more](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=footer). Last update [90569fd...f34a3d2](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] codecov-io edited a comment on pull request #11910: feat: add modal to import datasets
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #11910:
URL: https://github.com/apache/incubator-superset/pull/11910#issuecomment-737639040
# [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=h1) Report
> Merging [#11910](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=desc) (f34a3d2) into [SO-1157](https://codecov.io/gh/apache/incubator-superset/commit/90569fdea80ac56e8dc879167876f66b36ac99d7?el=desc) (90569fd) will **increase** coverage by `0.52%`.
> The diff coverage is `72.22%`.
[](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## SO-1157 #11910 +/- ##
===========================================
+ Coverage 66.95% 67.47% +0.52%
===========================================
Files 932 918 -14
Lines 46215 44674 -1541
Branches 4749 4254 -495
===========================================
- Hits 30942 30143 -799
+ Misses 15171 14428 -743
- Partials 102 103 +1
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `54.95% <1.85%> (-0.13%)` | :arrow_down: |
| javascript | `62.82% <61.29%> (-0.01%)` | :arrow_down: |
| python | `64.02% <96.42%> (+0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...nd/src/views/CRUD/data/dataset/AddDatasetModal.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhc2V0L0FkZERhdGFzZXRNb2RhbC50c3g=) | `57.57% <ø> (ø)` | |
| [...ontend/src/views/CRUD/data/dataset/DatasetList.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhc2V0L0RhdGFzZXRMaXN0LnRzeA==) | `67.30% <46.15%> (+16.27%)` | :arrow_up: |
| [...nd/src/datasource/components/ImportModal/index.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2RhdGFzb3VyY2UvY29tcG9uZW50cy9JbXBvcnRNb2RhbC9pbmRleC50c3g=) | `65.30% <65.30%> (ø)` | |
| [...uperset/datasets/commands/importers/v1/\_\_init\_\_.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvaW1wb3J0ZXJzL3YxL19faW5pdF9fLnB5) | `92.20% <85.71%> (-0.65%)` | :arrow_down: |
| [...perset/databases/commands/importers/v1/\_\_init\_\_.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL2ltcG9ydGVycy92MS9fX2luaXRfXy5weQ==) | `97.22% <100.00%> (+0.07%)` | :arrow_up: |
| [superset/datasets/api.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvYXBpLnB5) | `92.05% <100.00%> (+0.07%)` | :arrow_up: |
| [superset/datasets/commands/importers/dispatcher.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvaW1wb3J0ZXJzL2Rpc3BhdGNoZXIucHk=) | `87.09% <100.00%> (+0.88%)` | :arrow_up: |
| [superset/datasets/commands/importers/v0.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvaW1wb3J0ZXJzL3YwLnB5) | `81.67% <100.00%> (ø)` | |
| [superset/datasets/schemas.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvc2NoZW1hcy5weQ==) | `96.39% <100.00%> (ø)` | |
| [...hboard/components/filterscope/FilterScopeModal.jsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2ZpbHRlcnNjb3BlL0ZpbHRlclNjb3BlTW9kYWwuanN4) | `72.72% <0.00%> (-16.17%)` | :arrow_down: |
| ... and [56 more](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=footer). Last update [90569fd...f34a3d2](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] codecov-io edited a comment on pull request #11910: feat: add modal to import datasets
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #11910:
URL: https://github.com/apache/incubator-superset/pull/11910#issuecomment-737639040
# [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=h1) Report
> Merging [#11910](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=desc) (c7f0ce7) into [SO-1157](https://codecov.io/gh/apache/incubator-superset/commit/4e7a189b3922e44e8ef3ca028952a277731a2c41?el=desc) (4e7a189) will **decrease** coverage by `13.06%`.
> The diff coverage is `1.92%`.
[](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## SO-1157 #11910 +/- ##
============================================
- Coverage 67.89% 54.82% -13.07%
============================================
Files 919 413 -506
Lines 45546 14708 -30838
Branches 4245 3777 -468
============================================
- Hits 30923 8064 -22859
+ Misses 14520 6644 -7876
+ Partials 103 0 -103
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `54.82% <1.92%> (-0.17%)` | :arrow_down: |
| javascript | `?` | |
| python | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...nd/src/views/CRUD/data/dataset/AddDatasetModal.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhc2V0L0FkZERhdGFzZXRNb2RhbC50c3g=) | `12.00% <ø> (-45.58%)` | :arrow_down: |
| [...ontend/src/views/CRUD/data/dataset/DatasetList.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhc2V0L0RhdGFzZXRMaXN0LnRzeA==) | `2.22% <0.00%> (-67.01%)` | :arrow_down: |
| [...nd/src/datasource/components/ImportModal/index.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2RhdGFzb3VyY2UvY29tcG9uZW50cy9JbXBvcnRNb2RhbC9pbmRleC50c3g=) | `2.43% <2.43%> (ø)` | |
| [...uperset-frontend/src/dashboard/util/dnd-reorder.js](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2RuZC1yZW9yZGVyLmpz) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...rset-frontend/src/dashboard/util/getEmptyLayout.js](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldEVtcHR5TGF5b3V0Lmpz) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...dashboard/components/resizable/ResizableHandle.jsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL3Jlc2l6YWJsZS9SZXNpemFibGVIYW5kbGUuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [.../src/dashboard/util/getFilterScopeFromNodesTree.js](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldEZpbHRlclNjb3BlRnJvbU5vZGVzVHJlZS5qcw==) | `0.00% <0.00%> (-93.48%)` | :arrow_down: |
| [...src/dashboard/components/gridComponents/Header.jsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2dyaWRDb21wb25lbnRzL0hlYWRlci5qc3g=) | `10.52% <0.00%> (-86.85%)` | :arrow_down: |
| [...rc/dashboard/components/gridComponents/Divider.jsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2dyaWRDb21wb25lbnRzL0RpdmlkZXIuanN4) | `13.33% <0.00%> (-86.67%)` | :arrow_down: |
| [...ontend/src/dashboard/util/getDashboardFilterKey.ts](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldERhc2hib2FyZEZpbHRlcktleS50cw==) | `14.28% <0.00%> (-85.72%)` | :arrow_down: |
| ... and [762 more](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=footer). Last update [4e7a189...c7f0ce7](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] hughhhh commented on a change in pull request #11910: feat: add modal to import datasets
Posted by GitBox <gi...@apache.org>.
hughhhh commented on a change in pull request #11910:
URL: https://github.com/apache/incubator-superset/pull/11910#discussion_r537715507
##########
File path: superset-frontend/src/datasource/components/ImportModal/index.tsx
##########
@@ -0,0 +1,186 @@
+/**
+ * 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, useEffect, useRef, useState } from 'react';
+import { t } from '@superset-ui/core';
+
+import Modal from 'src/common/components/Modal';
+import {
+ StyledIcon,
+ StyledInputContainer,
+} from 'src/views/CRUD/data/database/DatabaseModal';
+import { useImportResource } from 'src/views/CRUD/hooks';
+import { DatasetObject } from 'src/views/CRUD/data/dataset/types';
+
+export interface ImportDatasetModalProps {
+ addDangerToast: (msg: string) => void;
+ addSuccessToast: (msg: string) => void;
+ onDatasetImport: () => void;
+ show: boolean;
+ onHide: () => void;
+ passwordFields?: string[];
+ setPasswordFields?: (passwordFields: string[]) => void;
+}
+
+const ImportDatasetModal: FunctionComponent<ImportDatasetModalProps> = ({
+ addDangerToast,
+ addSuccessToast,
+ onDatasetImport,
+ show,
+ onHide,
+ passwordFields = [],
+ setPasswordFields = () => {},
+}) => {
+ const [uploadFile, setUploadFile] = useState<File | null>(null);
+ const [isHidden, setIsHidden] = useState<boolean>(true);
+ const [passwords, setPasswords] = useState<Record<string, string>>({});
+ const fileInputRef = useRef<HTMLInputElement>(null);
+
+ const clearModal = () => {
+ setUploadFile(null);
+ setPasswordFields([]);
+ setPasswords({});
+ if (fileInputRef && fileInputRef.current) {
+ fileInputRef.current.value = '';
+ }
+ };
+
+ const handleErrorMsg = (msg: string) => {
+ clearModal();
+ addDangerToast(msg);
+ };
+
+ const {
+ state: { passwordsNeeded },
+ importResource,
+ } = useImportResource<DatasetObject>('dataset', t('dataset'), handleErrorMsg);
+
+ useEffect(() => {
+ setPasswordFields(passwordsNeeded);
+ }, [passwordsNeeded]);
+
+ // Functions
+ const hide = () => {
+ setIsHidden(true);
+ onHide();
+ };
+
+ const onUpload = () => {
+ if (uploadFile === null) {
+ return;
+ }
+
+ importResource(uploadFile, passwords).then(result => {
+ if (result) {
+ addSuccessToast(t('The datasets have been imported'));
+ clearModal();
+ onDatasetImport();
+ }
+ });
+ };
+
+ const changeFile = (event: React.ChangeEvent<HTMLInputElement>) => {
+ const { files } = event.target as HTMLInputElement;
+ setUploadFile((files && files[0]) || null);
+ };
+
+ const renderPasswordFields = () => {
+ if (passwordFields.length === 0) {
+ return null;
+ }
+
+ return (
+ <>
+ <h5>Database passwords</h5>
+ <StyledInputContainer>
+ <div className="helper">
+ {t(
+ 'The passwords for the databases below are needed in order to ' +
+ 'import them together with the datasets. Please note that the ' +
+ '"Secure Extra" and "Certificate" sections of ' +
+ 'the database configuration are not present in export files, and ' +
+ 'should be added manually after the import if they are needed.',
+ )}
+ </div>
+ </StyledInputContainer>
+ {passwordFields.map(fileName => (
+ <StyledInputContainer key={`password-for-${fileName}`}>
+ <div className="control-label">
+ {fileName}
+ <span className="required">*</span>
+ </div>
+ <input
+ name={`password-${fileName}`}
+ autoComplete="off"
+ type="password"
+ value={passwords[fileName]}
+ onChange={event =>
+ setPasswords({ ...passwords, [fileName]: event.target.value })
+ }
+ />
+ </StyledInputContainer>
+ ))}
+ </>
+ );
+ };
+
+ // Show/hide
+ if (isHidden && show) {
+ setIsHidden(false);
+ }
+
+ return (
+ <Modal
+ name="dataset"
+ className="dataset-modal"
Review comment:
nit: `import-datset-modal`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] codecov-io edited a comment on pull request #11910: feat: add modal to import datasets
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #11910:
URL: https://github.com/apache/incubator-superset/pull/11910#issuecomment-737639040
# [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=h1) Report
> Merging [#11910](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=desc) (f34a3d2) into [SO-1157](https://codecov.io/gh/apache/incubator-superset/commit/90569fdea80ac56e8dc879167876f66b36ac99d7?el=desc) (90569fd) will **increase** coverage by `0.50%`.
> The diff coverage is `72.22%`.
[](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## SO-1157 #11910 +/- ##
===========================================
+ Coverage 66.95% 67.45% +0.50%
===========================================
Files 932 918 -14
Lines 46215 44674 -1541
Branches 4749 4254 -495
===========================================
- Hits 30942 30135 -807
+ Misses 15171 14436 -735
- Partials 102 103 +1
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `54.82% <1.85%> (-0.26%)` | :arrow_down: |
| javascript | `62.82% <61.29%> (-0.01%)` | :arrow_down: |
| python | `64.02% <96.42%> (+0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...nd/src/views/CRUD/data/dataset/AddDatasetModal.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhc2V0L0FkZERhdGFzZXRNb2RhbC50c3g=) | `57.57% <ø> (ø)` | |
| [...ontend/src/views/CRUD/data/dataset/DatasetList.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhc2V0L0RhdGFzZXRMaXN0LnRzeA==) | `67.30% <46.15%> (+16.27%)` | :arrow_up: |
| [...nd/src/datasource/components/ImportModal/index.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2RhdGFzb3VyY2UvY29tcG9uZW50cy9JbXBvcnRNb2RhbC9pbmRleC50c3g=) | `65.30% <65.30%> (ø)` | |
| [...uperset/datasets/commands/importers/v1/\_\_init\_\_.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvaW1wb3J0ZXJzL3YxL19faW5pdF9fLnB5) | `92.20% <85.71%> (-0.65%)` | :arrow_down: |
| [...perset/databases/commands/importers/v1/\_\_init\_\_.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL2ltcG9ydGVycy92MS9fX2luaXRfXy5weQ==) | `97.22% <100.00%> (+0.07%)` | :arrow_up: |
| [superset/datasets/api.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvYXBpLnB5) | `92.05% <100.00%> (+0.07%)` | :arrow_up: |
| [superset/datasets/commands/importers/dispatcher.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvaW1wb3J0ZXJzL2Rpc3BhdGNoZXIucHk=) | `87.09% <100.00%> (+0.88%)` | :arrow_up: |
| [superset/datasets/commands/importers/v0.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvaW1wb3J0ZXJzL3YwLnB5) | `81.67% <100.00%> (ø)` | |
| [superset/datasets/schemas.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvc2NoZW1hcy5weQ==) | `96.39% <100.00%> (ø)` | |
| [...hboard/components/filterscope/FilterScopeModal.jsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2ZpbHRlcnNjb3BlL0ZpbHRlclNjb3BlTW9kYWwuanN4) | `72.72% <0.00%> (-16.17%)` | :arrow_down: |
| ... and [58 more](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=footer). Last update [90569fd...f34a3d2](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] betodealmeida commented on a change in pull request #11910: feat: add modal to import datasets
Posted by GitBox <gi...@apache.org>.
betodealmeida commented on a change in pull request #11910:
URL: https://github.com/apache/incubator-superset/pull/11910#discussion_r537886714
##########
File path: superset-frontend/src/datasource/components/ImportModal/index.tsx
##########
@@ -0,0 +1,186 @@
+/**
+ * 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, useEffect, useRef, useState } from 'react';
+import { t } from '@superset-ui/core';
+
+import Modal from 'src/common/components/Modal';
+import {
+ StyledIcon,
+ StyledInputContainer,
+} from 'src/views/CRUD/data/database/DatabaseModal';
+import { useImportResource } from 'src/views/CRUD/hooks';
+import { DatasetObject } from 'src/views/CRUD/data/dataset/types';
+
+export interface ImportDatasetModalProps {
+ addDangerToast: (msg: string) => void;
+ addSuccessToast: (msg: string) => void;
+ onDatasetImport: () => void;
+ show: boolean;
+ onHide: () => void;
+ passwordFields?: string[];
+ setPasswordFields?: (passwordFields: string[]) => void;
+}
+
+const ImportDatasetModal: FunctionComponent<ImportDatasetModalProps> = ({
+ addDangerToast,
+ addSuccessToast,
+ onDatasetImport,
+ show,
+ onHide,
+ passwordFields = [],
+ setPasswordFields = () => {},
+}) => {
+ const [uploadFile, setUploadFile] = useState<File | null>(null);
+ const [isHidden, setIsHidden] = useState<boolean>(true);
+ const [passwords, setPasswords] = useState<Record<string, string>>({});
+ const fileInputRef = useRef<HTMLInputElement>(null);
+
+ const clearModal = () => {
+ setUploadFile(null);
+ setPasswordFields([]);
+ setPasswords({});
+ if (fileInputRef && fileInputRef.current) {
+ fileInputRef.current.value = '';
+ }
+ };
+
+ const handleErrorMsg = (msg: string) => {
+ clearModal();
+ addDangerToast(msg);
+ };
+
+ const {
+ state: { passwordsNeeded },
+ importResource,
+ } = useImportResource<DatasetObject>('dataset', t('dataset'), handleErrorMsg);
+
+ useEffect(() => {
+ setPasswordFields(passwordsNeeded);
+ }, [passwordsNeeded]);
+
+ // Functions
+ const hide = () => {
+ setIsHidden(true);
+ onHide();
+ };
+
+ const onUpload = () => {
+ if (uploadFile === null) {
+ return;
+ }
+
+ importResource(uploadFile, passwords).then(result => {
+ if (result) {
+ addSuccessToast(t('The datasets have been imported'));
+ clearModal();
+ onDatasetImport();
+ }
+ });
+ };
+
+ const changeFile = (event: React.ChangeEvent<HTMLInputElement>) => {
+ const { files } = event.target as HTMLInputElement;
+ setUploadFile((files && files[0]) || null);
+ };
+
+ const renderPasswordFields = () => {
+ if (passwordFields.length === 0) {
+ return null;
+ }
+
+ return (
+ <>
+ <h5>Database passwords</h5>
+ <StyledInputContainer>
+ <div className="helper">
+ {t(
+ 'The passwords for the databases below are needed in order to ' +
+ 'import them together with the datasets. Please note that the ' +
+ '"Secure Extra" and "Certificate" sections of ' +
+ 'the database configuration are not present in export files, and ' +
+ 'should be added manually after the import if they are needed.',
+ )}
+ </div>
+ </StyledInputContainer>
+ {passwordFields.map(fileName => (
+ <StyledInputContainer key={`password-for-${fileName}`}>
+ <div className="control-label">
+ {fileName}
+ <span className="required">*</span>
+ </div>
+ <input
+ name={`password-${fileName}`}
+ autoComplete="off"
+ type="password"
+ value={passwords[fileName]}
+ onChange={event =>
+ setPasswords({ ...passwords, [fileName]: event.target.value })
+ }
+ />
+ </StyledInputContainer>
+ ))}
+ </>
+ );
+ };
+
+ // Show/hide
+ if (isHidden && show) {
+ setIsHidden(false);
+ }
+
+ return (
+ <Modal
+ name="dataset"
+ className="dataset-modal"
Review comment:
Will do in https://github.com/apache/incubator-superset/pull/11936
##########
File path: superset-frontend/src/datasource/components/ImportModal/index.tsx
##########
@@ -0,0 +1,186 @@
+/**
+ * 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, useEffect, useRef, useState } from 'react';
+import { t } from '@superset-ui/core';
+
+import Modal from 'src/common/components/Modal';
+import {
+ StyledIcon,
+ StyledInputContainer,
+} from 'src/views/CRUD/data/database/DatabaseModal';
+import { useImportResource } from 'src/views/CRUD/hooks';
+import { DatasetObject } from 'src/views/CRUD/data/dataset/types';
+
+export interface ImportDatasetModalProps {
+ addDangerToast: (msg: string) => void;
+ addSuccessToast: (msg: string) => void;
+ onDatasetImport: () => void;
+ show: boolean;
+ onHide: () => void;
+ passwordFields?: string[];
+ setPasswordFields?: (passwordFields: string[]) => void;
+}
+
+const ImportDatasetModal: FunctionComponent<ImportDatasetModalProps> = ({
+ addDangerToast,
+ addSuccessToast,
+ onDatasetImport,
+ show,
+ onHide,
+ passwordFields = [],
+ setPasswordFields = () => {},
+}) => {
+ const [uploadFile, setUploadFile] = useState<File | null>(null);
+ const [isHidden, setIsHidden] = useState<boolean>(true);
+ const [passwords, setPasswords] = useState<Record<string, string>>({});
+ const fileInputRef = useRef<HTMLInputElement>(null);
+
+ const clearModal = () => {
+ setUploadFile(null);
+ setPasswordFields([]);
+ setPasswords({});
+ if (fileInputRef && fileInputRef.current) {
+ fileInputRef.current.value = '';
+ }
+ };
+
+ const handleErrorMsg = (msg: string) => {
+ clearModal();
+ addDangerToast(msg);
+ };
+
+ const {
+ state: { passwordsNeeded },
+ importResource,
+ } = useImportResource<DatasetObject>('dataset', t('dataset'), handleErrorMsg);
+
+ useEffect(() => {
+ setPasswordFields(passwordsNeeded);
+ }, [passwordsNeeded]);
+
+ // Functions
+ const hide = () => {
+ setIsHidden(true);
+ onHide();
+ };
+
+ const onUpload = () => {
+ if (uploadFile === null) {
+ return;
+ }
+
+ importResource(uploadFile, passwords).then(result => {
+ if (result) {
+ addSuccessToast(t('The datasets have been imported'));
+ clearModal();
+ onDatasetImport();
+ }
+ });
+ };
+
+ const changeFile = (event: React.ChangeEvent<HTMLInputElement>) => {
+ const { files } = event.target as HTMLInputElement;
+ setUploadFile((files && files[0]) || null);
+ };
+
+ const renderPasswordFields = () => {
+ if (passwordFields.length === 0) {
+ return null;
+ }
+
+ return (
+ <>
+ <h5>Database passwords</h5>
+ <StyledInputContainer>
+ <div className="helper">
+ {t(
+ 'The passwords for the databases below are needed in order to ' +
+ 'import them together with the datasets. Please note that the ' +
+ '"Secure Extra" and "Certificate" sections of ' +
+ 'the database configuration are not present in export files, and ' +
+ 'should be added manually after the import if they are needed.',
+ )}
+ </div>
+ </StyledInputContainer>
+ {passwordFields.map(fileName => (
+ <StyledInputContainer key={`password-for-${fileName}`}>
+ <div className="control-label">
+ {fileName}
+ <span className="required">*</span>
+ </div>
+ <input
+ name={`password-${fileName}`}
+ autoComplete="off"
+ type="password"
+ value={passwords[fileName]}
+ onChange={event =>
Review comment:
Will do in https://github.com/apache/incubator-superset/pull/11936
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] codecov-io edited a comment on pull request #11910: feat: add modal to import datasets
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #11910:
URL: https://github.com/apache/incubator-superset/pull/11910#issuecomment-737639040
# [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=h1) Report
> Merging [#11910](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=desc) (f34a3d2) into [SO-1157](https://codecov.io/gh/apache/incubator-superset/commit/90569fdea80ac56e8dc879167876f66b36ac99d7?el=desc) (90569fd) will **decrease** coverage by `3.37%`.
> The diff coverage is `72.22%`.
[](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## SO-1157 #11910 +/- ##
===========================================
- Coverage 66.95% 63.57% -3.38%
===========================================
Files 932 918 -14
Lines 46215 44665 -1550
Branches 4749 4254 -495
===========================================
- Hits 30942 28398 -2544
- Misses 15171 16088 +917
- Partials 102 179 +77
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `?` | |
| javascript | `62.82% <61.29%> (-0.01%)` | :arrow_down: |
| python | `64.02% <96.42%> (+0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...nd/src/views/CRUD/data/dataset/AddDatasetModal.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhc2V0L0FkZERhdGFzZXRNb2RhbC50c3g=) | `57.57% <ø> (ø)` | |
| [...ontend/src/views/CRUD/data/dataset/DatasetList.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhc2V0L0RhdGFzZXRMaXN0LnRzeA==) | `67.30% <46.15%> (+16.27%)` | :arrow_up: |
| [...nd/src/datasource/components/ImportModal/index.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2RhdGFzb3VyY2UvY29tcG9uZW50cy9JbXBvcnRNb2RhbC9pbmRleC50c3g=) | `65.30% <65.30%> (ø)` | |
| [...uperset/datasets/commands/importers/v1/\_\_init\_\_.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvaW1wb3J0ZXJzL3YxL19faW5pdF9fLnB5) | `92.20% <85.71%> (-0.65%)` | :arrow_down: |
| [...perset/databases/commands/importers/v1/\_\_init\_\_.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL2ltcG9ydGVycy92MS9fX2luaXRfXy5weQ==) | `97.22% <100.00%> (+0.07%)` | :arrow_up: |
| [superset/datasets/api.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvYXBpLnB5) | `92.05% <100.00%> (+0.07%)` | :arrow_up: |
| [superset/datasets/commands/importers/dispatcher.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvaW1wb3J0ZXJzL2Rpc3BhdGNoZXIucHk=) | `87.09% <100.00%> (+0.88%)` | :arrow_up: |
| [superset/datasets/commands/importers/v0.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvaW1wb3J0ZXJzL3YwLnB5) | `81.67% <100.00%> (ø)` | |
| [superset/datasets/schemas.py](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvc2NoZW1hcy5weQ==) | `96.39% <100.00%> (ø)` | |
| [superset-frontend/src/SqlLab/App.jsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9BcHAuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| ... and [209 more](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=footer). Last update [90569fd...f34a3d2](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] betodealmeida commented on a change in pull request #11910: feat: add modal to import datasets
Posted by GitBox <gi...@apache.org>.
betodealmeida commented on a change in pull request #11910:
URL: https://github.com/apache/incubator-superset/pull/11910#discussion_r537833455
##########
File path: superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx
##########
@@ -114,6 +116,22 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
setDatasetCurrentlyEditing,
] = useState<Dataset | null>(null);
+ const [importingDataset, showImportModal] = useState<boolean>(false);
+ const [passwordFields, setPasswordFields] = useState<string[]>([]);
+
+ function openDatasetImportModal() {
Review comment:
Done, thanks!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] codecov-io edited a comment on pull request #11910: feat: add modal to import datasets
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #11910:
URL: https://github.com/apache/incubator-superset/pull/11910#issuecomment-737639040
# [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=h1) Report
> Merging [#11910](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=desc) (c7f0ce7) into [SO-1157](https://codecov.io/gh/apache/incubator-superset/commit/4e7a189b3922e44e8ef3ca028952a277731a2c41?el=desc) (4e7a189) will **decrease** coverage by `13.65%`.
> The diff coverage is `1.92%`.
[](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## SO-1157 #11910 +/- ##
============================================
- Coverage 67.89% 54.23% -13.66%
============================================
Files 919 413 -506
Lines 45546 14708 -30838
Branches 4245 3777 -468
============================================
- Hits 30923 7977 -22946
+ Misses 14520 6731 -7789
+ Partials 103 0 -103
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `54.23% <1.92%> (-0.76%)` | :arrow_down: |
| javascript | `?` | |
| python | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...nd/src/views/CRUD/data/dataset/AddDatasetModal.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhc2V0L0FkZERhdGFzZXRNb2RhbC50c3g=) | `12.00% <ø> (-45.58%)` | :arrow_down: |
| [...ontend/src/views/CRUD/data/dataset/DatasetList.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhc2V0L0RhdGFzZXRMaXN0LnRzeA==) | `2.22% <0.00%> (-67.01%)` | :arrow_down: |
| [...nd/src/datasource/components/ImportModal/index.tsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2RhdGFzb3VyY2UvY29tcG9uZW50cy9JbXBvcnRNb2RhbC9pbmRleC50c3g=) | `2.43% <2.43%> (ø)` | |
| [...uperset-frontend/src/dashboard/util/dnd-reorder.js](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2RuZC1yZW9yZGVyLmpz) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...rset-frontend/src/dashboard/util/getEmptyLayout.js](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldEVtcHR5TGF5b3V0Lmpz) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...dashboard/components/resizable/ResizableHandle.jsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL3Jlc2l6YWJsZS9SZXNpemFibGVIYW5kbGUuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [.../src/dashboard/util/getFilterScopeFromNodesTree.js](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldEZpbHRlclNjb3BlRnJvbU5vZGVzVHJlZS5qcw==) | `0.00% <0.00%> (-93.48%)` | :arrow_down: |
| [...src/dashboard/components/gridComponents/Header.jsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2dyaWRDb21wb25lbnRzL0hlYWRlci5qc3g=) | `10.52% <0.00%> (-86.85%)` | :arrow_down: |
| [...rc/dashboard/components/gridComponents/Divider.jsx](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2dyaWRDb21wb25lbnRzL0RpdmlkZXIuanN4) | `13.33% <0.00%> (-86.67%)` | :arrow_down: |
| [...ontend/src/dashboard/util/getDashboardFilterKey.ts](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldERhc2hib2FyZEZpbHRlcktleS50cw==) | `14.28% <0.00%> (-85.72%)` | :arrow_down: |
| ... and [763 more](https://codecov.io/gh/apache/incubator-superset/pull/11910/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=footer). Last update [4e7a189...c7f0ce7](https://codecov.io/gh/apache/incubator-superset/pull/11910?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] hughhhh commented on a change in pull request #11910: feat: add modal to import datasets
Posted by GitBox <gi...@apache.org>.
hughhhh commented on a change in pull request #11910:
URL: https://github.com/apache/incubator-superset/pull/11910#discussion_r537716059
##########
File path: superset-frontend/src/datasource/components/ImportModal/index.tsx
##########
@@ -0,0 +1,186 @@
+/**
+ * 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, useEffect, useRef, useState } from 'react';
+import { t } from '@superset-ui/core';
+
+import Modal from 'src/common/components/Modal';
+import {
+ StyledIcon,
+ StyledInputContainer,
+} from 'src/views/CRUD/data/database/DatabaseModal';
+import { useImportResource } from 'src/views/CRUD/hooks';
+import { DatasetObject } from 'src/views/CRUD/data/dataset/types';
+
+export interface ImportDatasetModalProps {
+ addDangerToast: (msg: string) => void;
+ addSuccessToast: (msg: string) => void;
+ onDatasetImport: () => void;
+ show: boolean;
+ onHide: () => void;
+ passwordFields?: string[];
+ setPasswordFields?: (passwordFields: string[]) => void;
+}
+
+const ImportDatasetModal: FunctionComponent<ImportDatasetModalProps> = ({
+ addDangerToast,
+ addSuccessToast,
+ onDatasetImport,
+ show,
+ onHide,
+ passwordFields = [],
+ setPasswordFields = () => {},
+}) => {
+ const [uploadFile, setUploadFile] = useState<File | null>(null);
+ const [isHidden, setIsHidden] = useState<boolean>(true);
+ const [passwords, setPasswords] = useState<Record<string, string>>({});
+ const fileInputRef = useRef<HTMLInputElement>(null);
+
+ const clearModal = () => {
+ setUploadFile(null);
+ setPasswordFields([]);
+ setPasswords({});
+ if (fileInputRef && fileInputRef.current) {
+ fileInputRef.current.value = '';
+ }
+ };
+
+ const handleErrorMsg = (msg: string) => {
+ clearModal();
+ addDangerToast(msg);
+ };
+
+ const {
+ state: { passwordsNeeded },
+ importResource,
+ } = useImportResource<DatasetObject>('dataset', t('dataset'), handleErrorMsg);
+
+ useEffect(() => {
+ setPasswordFields(passwordsNeeded);
+ }, [passwordsNeeded]);
+
+ // Functions
+ const hide = () => {
+ setIsHidden(true);
+ onHide();
+ };
+
+ const onUpload = () => {
+ if (uploadFile === null) {
+ return;
+ }
+
+ importResource(uploadFile, passwords).then(result => {
+ if (result) {
+ addSuccessToast(t('The datasets have been imported'));
+ clearModal();
+ onDatasetImport();
+ }
+ });
+ };
+
+ const changeFile = (event: React.ChangeEvent<HTMLInputElement>) => {
+ const { files } = event.target as HTMLInputElement;
+ setUploadFile((files && files[0]) || null);
+ };
+
+ const renderPasswordFields = () => {
+ if (passwordFields.length === 0) {
+ return null;
+ }
+
+ return (
+ <>
+ <h5>Database passwords</h5>
+ <StyledInputContainer>
+ <div className="helper">
+ {t(
+ 'The passwords for the databases below are needed in order to ' +
+ 'import them together with the datasets. Please note that the ' +
+ '"Secure Extra" and "Certificate" sections of ' +
+ 'the database configuration are not present in export files, and ' +
+ 'should be added manually after the import if they are needed.',
+ )}
+ </div>
+ </StyledInputContainer>
+ {passwordFields.map(fileName => (
+ <StyledInputContainer key={`password-for-${fileName}`}>
+ <div className="control-label">
+ {fileName}
+ <span className="required">*</span>
+ </div>
+ <input
+ name={`password-${fileName}`}
+ autoComplete="off"
+ type="password"
+ value={passwords[fileName]}
+ onChange={event =>
Review comment:
nit: put this into a handleStyleInputContainerChange func
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] betodealmeida merged pull request #11910: feat: add modal to import datasets
Posted by GitBox <gi...@apache.org>.
betodealmeida merged pull request #11910:
URL: https://github.com/apache/incubator-superset/pull/11910
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org