You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2021/06/03 18:24:06 UTC

[superset] branch master updated: fix: renamed sqllab filters to _filters (#14971)

This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new f652908  fix: renamed sqllab filters to _filters (#14971)
f652908 is described below

commit f652908a70e49b3baa566a85b930c76bf410771c
Author: cccs-jc <56...@users.noreply.github.com>
AuthorDate: Thu Jun 3 14:22:50 2021 -0400

    fix: renamed sqllab filters to _filters (#14971)
---
 docs/installation.rst                                 | 3 ++-
 superset-frontend/src/SqlLab/components/ResultSet.tsx | 3 ++-
 superset/views/utils.py                               | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/docs/installation.rst b/docs/installation.rst
index 6c3cc1e..7dff638 100644
--- a/docs/installation.rst
+++ b/docs/installation.rst
@@ -1271,10 +1271,11 @@ There is a special ``_filters`` parameter which can be used to test filters used
 
 .. code-block:: JSON
     {
-        "_filters": {
+        "_filters": [ {
             "col": "action_type",
             "op": "IN",
             "val": ["sell", "buy"]
+            } ]
     }
 
 .. code-block:: python
diff --git a/superset-frontend/src/SqlLab/components/ResultSet.tsx b/superset-frontend/src/SqlLab/components/ResultSet.tsx
index 4ff6f3d..b5a6e4f 100644
--- a/superset-frontend/src/SqlLab/components/ResultSet.tsx
+++ b/superset-frontend/src/SqlLab/components/ResultSet.tsx
@@ -280,7 +280,8 @@ export default class ResultSet extends React.PureComponent<
     // before saving the dataset.
     if (templateParams) {
       const p = JSON.parse(templateParams);
-      if (p.filters) {
+      /* eslint-disable-next-line no-underscore-dangle */
+      if (p._filters) {
         /* eslint-disable-next-line no-underscore-dangle */
         delete p._filters;
         templateParams = JSON.stringify(p);
diff --git a/superset/views/utils.py b/superset/views/utils.py
index 1d1603e..a3dd432 100644
--- a/superset/views/utils.py
+++ b/superset/views/utils.py
@@ -212,7 +212,7 @@ def add_sqllab_custom_filters(form_data: Dict[Any, Any]) -> Any:
             if isinstance(params_str, str):
                 params = json.loads(params_str)
                 if isinstance(params, dict):
-                    filters = params.get("filters")
+                    filters = params.get("_filters")
                     if filters:
                         form_data.update({"filters": filters})
     except (TypeError, json.JSONDecodeError):