-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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: Reuse Dashboard redux data in Explore #20668
Conversation
Codecov Report
@@ Coverage Diff @@
## master #20668 +/- ##
==========================================
- Coverage 66.85% 66.84% -0.02%
==========================================
Files 1753 1753
Lines 65825 65846 +21
Branches 7006 7010 +4
==========================================
+ Hits 44010 44015 +5
- Misses 20030 20045 +15
- Partials 1785 1786 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
/testenv up |
@zhaoyongjie Container image not yet published for this PR. Please try again when build is complete. |
@zhaoyongjie Ephemeral environment creation failed. Please check the Actions logs for details. |
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.
leave a minor suggestion.
return fetchExploreData(); | ||
} | ||
return SupersetClient.get({ | ||
endpoint: `/datasource/get/${datasourceType}/${datasourceId}/`, |
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 is a new endpoint for the dataset GET method is /api/v1/dataset/<datasource PK(a.k.a datasource id without type>
. I added it at here
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 actually used GET /v1/dataset
endpoint at first, but then changed it to GET /datasource/get/
. As far as I know, Explore now supports (or will soon support?) other sources than datasets, such as SQL queries. Tagging @hughhhh for transparency.
Also, the /v1/explore/
endpoint uses DatasourceDAO
to get datasource and the response from /v1/dataset
endpoint is missing some fields compared to datasource from /v1/explore
, which caused some components in Explore to crash
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 propose we stick to the legacy /datasource/get
endpoint for now and create a new /v1/datasource
API in the future and refactor
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.
@kgabryje Thanks for the explanation, we will optimize it in the future.
6bb360e
to
8121f57
Compare
/testenv up |
@kgabryje Container image not yet published for this PR. Please try again when build is complete. |
@kgabryje Ephemeral environment creation failed. Please check the Actions logs for details. |
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
This reverts commit ff5b4bc.
This PR will be re-opened when linking from Dashboard to Explore is refactored (coming in a few days) |
SUMMARY
Currently when user open Explore, we always send a request to
/v1/explore
endpoint, which assembles Explore initial data - slice, form_data and datasource.When user goes to Explore from Dashboard (by clicking "Edit chart" or char title), most of the data needed to assemble Explore should already be available in Redux store.
This PR implements using data from Dashboard Redux store to initialize Explore without calling
/v1/explore
endpoint.If user opens Explore from Dashboard, check if slice, formData, datasourceId and datasourceType are available. If they are, fetch datasource metadata and hydrate Explore using slice, formData and datasource.
If they are not available, call
/v1/explore
and hydrate Explore.We can't reuse datasource from Dashboard. Datasources metadata on Dashboard is trimmed so that datasource contains only columns and metrics used by charts on that dashboard. In Explore we need to be able to access all columns and metrics, which means we must fetch those from API.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
/v1/explore/
endpoint/v1/explore
ADDITIONAL INFORMATION