-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Use chart plugins and remove code under visualizations #6838
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6838 +/- ##
==========================================
+ Coverage 56.22% 63.11% +6.89%
==========================================
Files 527 423 -104
Lines 23529 20672 -2857
Branches 2782 2281 -501
==========================================
- Hits 13229 13048 -181
+ Misses 9888 7487 -2401
+ Partials 412 137 -275
Continue to review full report at Codecov.
|
−221,445 WOW! |
e464ed6
to
2bdb445
Compare
2bdb445
to
3c01eeb
Compare
Hi reviewers, I think this is ready for review. Please let me know if you have any concern. @williaster @mistercrunch @graceguo-supercat @michellethomas @xtinec @betodealmeida |
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, thanks for all of your hard work on this and debugging the nvd3 issue!
quite an epic PR 🙌 🏆 I can't believe the vis code had that many lines 😱
@kristw I'm interested in whether/how this affects the "Country Map" - how should we now add a new country to visualisations? |
@@ -17,21 +17,19 @@ | |||
* under the License. | |||
*/ | |||
import { Preset } from '@superset-ui/core'; |
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.
(senv) [root@blade02 presets]# pwd
/root/incubator-superset/superset/assets/src/visualizations/presets
(senv) [root@blade02 presets]# ll
total 8
-rw-r--r--. 1 root root 6453 Feb 4 16:33 MainPreset.js
Hello, there is no such a file in this directory
Note: superset version 0.35.2
Changes in this PR
This PR affects many files. 😱 However, the real edits only happen in
package.json
src/visualizations/presets/CommonChartPreset.js
src/visualizations/presets/LegacyChartPreset.js
The rest are deletions 💣. To sum up, here is what's happening.
visualizations
directory) that have been moved into@superset-ui/legacy-*
repository and published as multiplenpm
packages. See https://apache-superset.github.io/superset-ui-legacy for demos of every chart and code at https://github.com/apache-superset/superset-ui-legacyvisualizations
directory.Note: Currently applies to all charts except
TimeTable
,FilterBox
anddeck.gl
.What does this mean for the project?
This PR enable charts that are plugins to be embeddable in another application using
ChartClient
and<SuperChart />
from@superset-ui/chart
. (Still need to work on demo and documentation. cc @xtinec)This PR trim the core Superset codebase and make the chart plugins optional. The chart plugins potentially can be added/removed as the developers wish, or switched to different implementation, without everybody slamming all kinds of charts or customization into this repo, which makes the codebase become impossible to maintain over time and the Superset app has too many chart options that fits no one.
Future work
To enable developers to write their own chart plugins. There are still remaining work.
Part 1. Make control panels (left side of the explore page) part of the plugins
controls.jsx
At this point developers will be enable to define a new chart and its control panel. However, the backend logic that would have been added to
viz.py
in the previous approach will be replaced by calling the new query api viabuildQuery
logic defined in the plugin.Part 2. We still have some work left on the backend to handle query objects created by
buildQuery
. Meanwhile the legacy charts will haveuseLegacyApi
flag in theChartMetadata
to indicate that it is not using the new endpoint but use the old endpoints powered byviz.py
instead.Part 3. Documentation and better tooling for cross-repo work
npm link
to enable interactive development.@superset-ui/legacy-*
to preview live code. (Currently reading from the distribution code)With that said, I think we have made a lot of progress in the past few months and this PR is one major step forward. There are still remaining work so please hold on if you are eager to add your own chart. In the meantime if the developers want to see previews of how to write a chart plugin, please look at
https://github.com/apache-superset/superset-ui-legacy
and
https://github.com/apache-superset/superset-ui/packages/plugin-chart-word-cloud
for examples.