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(table-viz): rewrite with react-table and add query mode switch mode #10113
Conversation
1b2eaac
to
ff486d1
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.
approve the js part
c01fd1e
to
0c4ac2b
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.
@john-bodley @michellethomas would you mind having a look on the python part?
const validators = control.validators; | ||
if (validators && validators.length > 0) { | ||
const validatedControl = { ...control }; | ||
const validationErrors = []; | ||
validators.forEach(f => { | ||
const v = f(control.value); | ||
const v = f.call(control, control.value, processedState); |
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.
Extend the validators
API to allow access to processed state and the control config itself (not really in use anywhere yet).
@@ -344,26 +344,21 @@ def test_adhoc_filters_overwrite_legacy_filters(self): | |||
self.assertEqual("(value3 in ('North America'))", query_obj["extras"]["where"]) | |||
self.assertEqual("", query_obj["extras"]["having"]) | |||
|
|||
@patch("superset.viz.BaseViz.query_obj") |
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 sure why the patch is here, but removing it doesn't hurt.
with self.assertRaises(Exception): | ||
test_viz = viz.TableViz(datasource, form_data) |
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.
The exception now raises earlier.
tests/viz_tests.py
Outdated
self.assertEqual(["colA", "colB", "__time__"], query_obj["metrics"]) | ||
self.assertEqual([("__time__", True)], query_obj["orderby"]) | ||
self.assertEqual(["colA", "colB", "sort_column"], query_obj["metrics"]) | ||
self.assertEqual([("sort_column", True)], query_obj["orderby"]) |
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.
Rename so not to be confused with the time column (__timestamp
).
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.
Quick first pass. We probably should add query_mode
into QueryObject
both here and on @superset-ui/query
, and use that as the primary means of either grouping or not grouping a query. The plan in SIP-38 is to deprecate the groupby
property and only use columns
, and then perform grouping only if grouping is requested (we also hope to be introducing non-aggregating metrics soon)
Do you mind if I do this in a separate PR? |
@ktmud sure thing, just wanted to put the comments here to make sure I don't forget mentioning it. I can also do it, I have an idea of how we can do it with minimal disruption. |
d845c07
to
c3b765f
Compare
Also optimize hot loader for ChartRenderer
Codecov Report
@@ Coverage Diff @@
## master #10113 +/- ##
==========================================
- Coverage 70.57% 70.41% -0.17%
==========================================
Files 594 594
Lines 31461 31483 +22
Branches 3228 3222 -6
==========================================
- Hits 22205 22170 -35
- Misses 9140 9198 +58
+ Partials 116 115 -1
Continue to review full report at Codecov.
|
Rebased and fixed another issue with js-dom upgrade and now it seems fine? |
1, Replace table chart rendering from jquery.DataTables to react-table: apache-superset/superset-ui#623 2. Rearrange the control panel, replace GROUP BY and NOT GROUP BY with a "Query Mode" switch: apache-superset/superset-ui#609
SUMMARY
This PR combines two major updates for the table chart:
jquery.DataTables
toreact-table
: feat(plugin-chart-table): rewrite with react-table apache-superset/superset-ui#623In addition to these, there are also some smaller refactoring and UX improvements:
query_mode
field.Must wait for release of new versions of
@superset-ui/chart-controls
and@superset-ui/plugin-chart-table
.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before
After
TEST PLAN
Manual testing
ADDITIONAL INFORMATION