Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add modal to import dashboards #11924

Merged
merged 1 commit into from
Dec 8, 2020

Conversation

betodealmeida
Copy link
Member

SUMMARY

Identical to https://github.com/apache/incubator-superset/pull/11923/files, but for charts.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

2020-12-03-194846_772x242_scrot

TEST PLAN

Tested importing dashboard to an existing database/chart, as well as a dashboard to a new database, works as expected.

Also added tests.

ADDITIONAL INFORMATION

@codecov-io
Copy link

codecov-io commented Dec 4, 2020

Codecov Report

Merging #11924 (89bbdcf) into master (33325f9) will increase coverage by 0.00%.
The diff coverage is 65.78%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #11924   +/-   ##
=======================================
  Coverage   67.69%   67.70%           
=======================================
  Files         940      941    +1     
  Lines       45586    45658   +72     
  Branches     4378     4388   +10     
=======================================
+ Hits        30861    30911   +50     
- Misses      14622    14644   +22     
  Partials      103      103           
Flag Coverage Δ
cypress 54.75% <42.59%> (-0.02%) ⬇️
javascript 62.90% <60.65%> (-0.01%) ⬇️
python 64.25% <86.66%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/dashboards/commands/export.py 91.17% <0.00%> (ø)
...rontend/src/views/CRUD/dashboard/DashboardList.tsx 73.83% <41.66%> (-4.07%) ⬇️
...end/src/dashboard/components/ImportModal/index.tsx 65.30% <65.30%> (ø)
...erset/dashboards/commands/importers/v1/__init__.py 94.69% <85.71%> (-0.60%) ⬇️
superset/dashboards/api.py 86.46% <100.00%> (+0.11%) ⬆️
...perset/dashboards/commands/importers/dispatcher.py 80.64% <100.00%> (+1.33%) ⬆️
superset/dashboards/schemas.py 98.78% <100.00%> (ø)
...set-frontend/src/dashboard/util/getDropPosition.js 93.65% <0.00%> (+1.58%) ⬆️
...ntend/src/dashboard/components/PropertiesModal.jsx 84.82% <0.00%> (+1.78%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 33325f9...89bbdcf. Read the comment docs.

* under the License.
*/
import React from 'react';
import thunk from 'redux-thunk';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still need this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove in #11936

}

importResource(uploadFile, passwords).then(result => {
if (result) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit, but you could also check the passwordFields state here, right, instead of returning it in the result?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually no, if there's a validation error other than password needed the importResource will

  • show a danger toast
  • not set passwordFields
  • return false

So having an empty passwordFields does not guarantee success. This is because there's 3 states:

  1. Upload OK (returns true and passwordFields is empty)
  2. File validated but needs password (returns false and passwordFields is set)
  3. Validation failed in other ways (returns false and passwordFields is empty)

</div>
<input
name={`password-${fileName}`}
autoComplete="off"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this may not work for Chrome. You may want to try something like autoComplete="new-password"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, #TIL. I'll fix it in #11936

* specific language governing permissions and limitations
* under the License.
*/
export type DashboardObject = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just as an fyi, there are also some types in src/types. We may want to move everything there eventually.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I feel we should have a way of automatically generating these and schema.py from a single source of truth.

Copy link
Member

@eschutho eschutho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mostly left some notes, but looks good.

@betodealmeida betodealmeida changed the base branch from PISQL-2 to PISQL-2a December 8, 2020 02:34
@betodealmeida betodealmeida changed the base branch from PISQL-2a to master December 8, 2020 02:38
@pull-request-size pull-request-size bot added size/M and removed size/L labels Dec 8, 2020
@pull-request-size pull-request-size bot added size/L and removed size/M labels Dec 8, 2020
@betodealmeida betodealmeida merged commit 8f1ac7e into apache:master Dec 8, 2020
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.0.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L 🚢 1.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants