You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/08/07 19:29:19 UTC

[GitHub] [incubator-superset] ktmud commented on a change in pull request #9593: Re-enable table filter, fix #8273 #8683

ktmud commented on a change in pull request #9593:
URL: https://github.com/apache/incubator-superset/pull/9593#discussion_r411582275



##########
File path: superset-frontend/src/dashboard/util/getFilterConfigsFromFormdata.js
##########
@@ -20,89 +20,85 @@
 import { TIME_FILTER_MAP } from '../../visualizations/FilterBox/FilterBox';
 import { TIME_FILTER_LABELS } from '../../explore/constants';
 
-export default function getFilterConfigsFromFormdata(form_data = {}) {
+/**
+ * Parse filters for Table chart. All non-metric columns are considered
+ * filterable values.
+ */
+function getFilterConfigsFromTableChart(form_data = {}) {
+  const { groupby = [], all_columns = [] } = form_data;
+  const configs = { columns: {}, labels: {} };
+  // `groupby` is from GROUP BY mode (aggregations)
+  // `all_columns` is from NOT GROUP BY mode (raw records)
+  const columns = groupby.concat(all_columns);
+  columns.forEach(column => {
+    configs.columns[column] = undefined;

Review comment:
       To me, `null` means users specifically choose an empty value for the filter. `undefined` is more like the "data not yet available" default.
   
   In `FilterBox`, the `defaultValue` is also `undefined`, not `null`:
   <img src="https://user-images.githubusercontent.com/335541/79784053-84373e00-82f6-11ea-8d8c-c4358a9cccf7.png" width="300">
   
   Since there is no way to set a default filter for table charts, using `undefined` to indicate "not set" seems more appropriate to me.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org