-
Notifications
You must be signed in to change notification settings - Fork 16.5k
feat(explore): allow opening charts with missing dataset #12705
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
Conversation
a65f780 to
2d58d3f
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.
Wanted to use Antd Alert, but it looks inconsistent with the error box in chart container.
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.
Bycatch: reuse typing from @superset-ui/chart-controls.
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.
Datasource ID is null when it is unavailable.
superset/views/core.py
Outdated
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.
Adding a dummy datasource is easier than fixing countless places on the frontend where it's expected to exist.
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.
handle_api_exception will be able to render the error properly.
superset/views/datasource.py
Outdated
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.
handle_api_exception will be able to render the error properly.
superset/utils/core.py
Outdated
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.
Make sure translations can be properly outputted in json API response.
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.
Move to reduce the change of circular imports.
Codecov Report
@@ Coverage Diff @@
## master #12705 +/- ##
==========================================
- Coverage 66.89% 59.17% -7.72%
==========================================
Files 1022 965 -57
Lines 49994 47218 -2776
Branches 4892 4405 -487
==========================================
- Hits 33442 27942 -5500
- Misses 16427 19276 +2849
+ Partials 125 0 -125
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
4b6409f to
41b3192
Compare
41b3192 to
bc75a7c
Compare
5ad2399 to
d2f47a4
Compare
villebro
left a comment
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.
LGTM. Minor comments, thanks fixing the translations, too!
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.
Could be nice to have this in a constants.ts
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 ideally should be more sophisticated where we display tooltip only when we detect text has been cutoff. This is just a heuristic number that works for the smallest panel width (300px).
It's a very local feature so I wouldn't put it into another file.
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.
Could we be more explicit here as in the other error - "Dataset does not exist".
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.
My thinking is this: the dataset does not exist for two reasons, either it never existed or has been deleted. Since the latter is the most likely case, we inform users about this possibility, but also show reservations with "may" to be more accurate.
I think a little bit more color in copy is more helpful comparing to repeating the same general message over and over.
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.
nit:
| not exists.""" | |
| not exist.""" |
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 comment is inaccurate. I decided to still raise an error to avoid making too many changes.
Will delete.
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.
Nice catch 👍
superset/models/slice.py
Outdated
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.
Not that it matters, but I've always been allergic to md5 on empty string:
>>> import hashlib
>>> hashlib.md5(''.encode()).hexdigest()
'd41d8cd98f00b204e9800998ecf8427e'
| return utils.md5_hex(self.params or "") | |
| return utils.md5_hex(self.params) if self.params else '' |
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 I'll return None here just to be more explicit. The original change is for avoiding an uncaught exception, explicitly returning None forces the downstream handle the case of missing params more properly.
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.
Nvm. I'll keep utils.md5_hex(self.params or "") since this key is also used in thumbnail URLs:
return f"/api/v1/chart/{self.id}/thumbnail/{self.digest}/"We can make a follow up PR to rename digest to thumbnail_key (for both chart and dashboard) if we think it's necessary.
d2f47a4 to
04fab5e
Compare
04fab5e to
aa350ef
Compare
|
A possible followup would be to add "Delete chart" shortcut CTA to make it easier for chart owners to delete outdated charts. |
* master: (52 commits) docs: Updates to Superset Site for 1.0 (apache#12626) test(native-filters): scoping tree in native filters modal (apache#12655) Fix tests errors and warnings - iteration 3 (apache#12212) (apache#12219) Fix tests errors and warnings - iteration 5 (apache#12212) (apache#12224) Fix tests errors and warnings - iteration 6 (apache#12212) (apache#12227) feat(native-filters): apply scoping of native filters to dashboard (apache#12716) Fix tests errors and warnings - iteration 4 (apache#12212) (apache#12223) Fix tests errors and warnings - iteration 7 (apache#12212) (apache#12245) fix: missing select menu background (apache#12759) fix(explore): incorrect missing datasource condition (apache#12758) feat: default timepicker to last week when dataset is changed (apache#12609) feat(explore): allow opening charts with missing dataset (apache#12705) chore: upgrade Cypress to 6.2.1 (apache#12605) refactor(explore): Enhance Dataset and Control panel Collapse components (apache#12218) feat: Adding option to set_database_uri CLI command (apache#12740) docs: Fixed typo on line 348 (apache#12739) Fix tests errors and warnings - iteration 2 (apache#12212) (apache#12214) docs: Remove gatsby-plugin-offline (apache#12693) test: oracle engine spec (apache#12615) test: hive db engine spec (apache#12520) ...
SUMMARY
Allow opening charts with missing dataset as proposed in #12464 (comment). Alternative solution for #12468 .
Also did some refactoring on
get_datasourceerror handling.Closes #12464
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before
Opening a chart with missing dataset redirects to chart list with a flash message.
After
Chart can open, all control params retained; users are offered a way to quickly switch to a valid dataset.
TEST PLAN
Manual
ADDITIONAL INFORMATION