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

fix(dashboard): add toast if JSON metadata is invalid #20823

Merged
merged 1 commit into from
Jul 23, 2022

Conversation

stephenLYZ
Copy link
Member

SUMMARY

When the json metadata of the dashboard is not legal, the user clicks the save button without any response and no other prompt, this PR adds toast to inform the user.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

before

2022-07-22.5.42.59.mov

after

2022-07-22.5.41.31.mov

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Copy link
Member

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link

codecov bot commented Jul 22, 2022

Codecov Report

Merging #20823 (d272a7c) into master (9c7bcfc) will increase coverage by 0.01%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##           master   #20823      +/-   ##
==========================================
+ Coverage   66.30%   66.32%   +0.01%     
==========================================
  Files        1756     1757       +1     
  Lines       66735    66766      +31     
  Branches     7049     7059      +10     
==========================================
+ Hits        44251    44284      +33     
+ Misses      20688    20684       -4     
- Partials     1796     1798       +2     
Flag Coverage Δ
javascript 51.98% <66.66%> (+0.04%) ⬆️

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

Impacted Files Coverage Δ
...src/dashboard/components/PropertiesModal/index.tsx 62.82% <66.66%> (-0.17%) ⬇️
...t-frontend/src/dashboard/containers/SliceAdder.jsx 0.00% <0.00%> (-100.00%) ⬇️
...rontend/src/dashboard/containers/DashboardGrid.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/featureFlags.ts 66.66% <0.00%> (-33.34%) ⬇️
...c/dashboard/components/dnd/AddSliceDragPreview.jsx 50.00% <0.00%> (-10.00%) ⬇️
...t-frontend/src/dashboard/components/SliceAdder.jsx 62.66% <0.00%> (-9.34%) ⬇️
...rontend/src/dashboard/components/DashboardGrid.jsx 55.35% <0.00%> (-7.15%) ⬇️
superset-frontend/src/views/store.ts 65.00% <0.00%> (-3.75%) ⬇️
...set-frontend/src/explore/actions/hydrateExplore.ts 60.00% <0.00%> (-1.54%) ⬇️
superset-frontend/src/dashboard/constants.ts 100.00% <0.00%> (ø)
... and 34 more

Help us with your feedback. Take ten seconds to tell us how you rate us.

@zhaoyongjie zhaoyongjie merged commit 557cf4b into apache:master Jul 23, 2022
try {
metadata = JSON.parse(currentJsonMetadata);
} catch (error) {
addDangerToast(t('JSON metadata is invalid!'));
Copy link
Member

Choose a reason for hiding this comment

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

@zhaoyongjie shouldn't this re-throw the error (or at least return from the function) if we don't have valid metadata here so we don't try to save an invalid payload?

Copy link
Member

Choose a reason for hiding this comment

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

@etr2460 good point, let's try to make an invalid JSON to verify.

Copy link
Member

Choose a reason for hiding this comment

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

@zhaoyongjie is there any update regarding a fix for this?

Copy link
Member

Choose a reason for hiding this comment

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

@john-bodley @etr2460 add a new PR at here.

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 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/XS 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants