fix(plugin-chart-table): refine ordering logic#930
fix(plugin-chart-table): refine ordering logic#930villebro merged 1 commit intoapache-superset:masterfrom
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/superset/superset-ui/k57lswnpy |
| if (timeseriesLimitMetric && orderDesc != null) { | ||
| orderby = [[timeseriesLimitMetric, !orderDesc]]; | ||
| if (timeseriesLimitMetric.length > 0 && orderDesc != null) { | ||
| orderby = [[timeseriesLimitMetric[0], !orderDesc]]; |
There was a problem hiding this comment.
In practice timeseriesLimitMetric is always truthy, as the control always returns either an empty array (nothing selected) or a string/object (=an orderby is set). See the updated type in types.ts.
There was a problem hiding this comment.
Wow, didn't notice the control returns an empty array when nothing is selected. That sounds wrong.
95989ed to
068d6cf
Compare
Codecov Report
@@ Coverage Diff @@
## master #930 +/- ##
==========================================
+ Coverage 27.32% 27.37% +0.04%
==========================================
Files 411 412 +1
Lines 8281 8292 +11
Branches 1134 1139 +5
==========================================
+ Hits 2263 2270 +7
- Misses 5886 5888 +2
- Partials 132 134 +2
Continue to review full report at Codecov.
|
🐛 Bug Fix
Previously table chart would by default order by the first metric if no sort order was specified. This replicates the logic from the old
viz.pyimplementation and also fixes a few minor issues in the current code:queryModefromformDatacontents; if it's undefined andmetricsis not empty, assumeQueryMode.aggregate. This is the case in some old metadata, e.g. the World Bank example dashboard.timeseries_limit_metricis[]when the control is unset, andQueryFormMetricwhen set. The type is updated and a util is added for normalizing toQueryFormMetric[]+ relevant tests.AFTER
BEFORE