-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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: Added message flash when chart with missing dataset is accessed. #12468
Conversation
just one quick change - "datasource" to "dataset" in the message 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems legit, although it seems like the redirect wouldn't even be necessary here
superset/views/core.py
Outdated
@@ -702,7 +702,8 @@ def explore( # pylint: disable=too-many-locals,too-many-return-statements | |||
datasource_id, datasource_type = get_datasource_info( | |||
datasource_id, datasource_type, form_data | |||
) | |||
except SupersetException: | |||
except SupersetException as e: | |||
flash(e.message, "danger") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a good pattern in general :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's done 👍 |
@kkucharc I think changing the underlying exception message makes more sense. We're trying to go with "dataset" moving forward. Also please wrap messages in babel translation |
superset/views/core.py
Outdated
@@ -703,6 +703,7 @@ def explore( # pylint: disable=too-many-locals,too-many-return-statements | |||
datasource_id, datasource_type, form_data | |||
) | |||
except SupersetException: | |||
flash("The dataset associated with this chart no longer exists", "danger") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there could be other reasons for an exception, we should use the actual error message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And don't forget to add i18n:
_("Error occurred when opening the chart: %(error)", error=utils.error_msg_from_exception(ex))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kkucharc I think it's definitely worth creating a separate PR to change the naming for user-facing text and messages, not so sure about the code though.
What is the current behavior? User gets redirected to Explore and then sees an error message because the underlying datasource doesn't exist right? |
@zuzana-vej Now we have situation like on video - |
Codecov Report
@@ Coverage Diff @@
## master #12468 +/- ##
==========================================
- Coverage 66.81% 63.10% -3.72%
==========================================
Files 1015 485 -530
Lines 49548 29945 -19603
Branches 5080 0 -5080
==========================================
- Hits 33106 18897 -14209
+ Misses 16312 11048 -5264
+ Partials 130 0 -130
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
cb292a4
to
11b2430
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested, and i noticed charts got completely removed from the list after their underlying dataset is deleted, which is not expected behavior. @adam-stasiak @kkucharc
Expected for this particular change:
User receives a toast message of "The dataset associated with this chart no longer exists" when clicking on a chart which its dataset was deleted from Datasets.
the chart should still be visible on the Charts list view. but the Dataset column should be empty.
@junlincc Could you describe steps to reproduce - > I tried to delete datasets and charts remain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested again, LGTM. will merge with two code review approvals.
@kkucharc @adam-stasiak i didn't notice you force pushed. sorry about the confusion! 🙏
SUMMARY
Chart with deleted dataset is still available on charts list. While trying to access its explore view page redirects to charts list page. As discussed in issue #12464, I added flash notification message in right bottom corner.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
[Link to previous behaviour video] (https://user-images.githubusercontent.com/25153919/104351996-6655dd00-5506-11eb-929d-a7c1593098e0.mov)
After:
TEST PLAN
The datasource associated with this chart no longer exists
ADDITIONAL INFORMATION