From 4e339a3b2f48a030c5b75c6d79c686faa51d48b9 Mon Sep 17 00:00:00 2001 From: cccs-jc Date: Thu, 3 Jun 2021 11:25:53 -0400 Subject: [PATCH 1/2] renamed sqllab filters to _filters --- 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 6c3cc1efedb60..7dff638b041e4 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 4ff6f3dc6537c..96f084565ac90 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 1d1603e41d786..a3dd432e4f377 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): From b1402937a1d753689960f005bcd0a5d201109ebc Mon Sep 17 00:00:00 2001 From: cccs-jc Date: Thu, 3 Jun 2021 11:59:50 -0400 Subject: [PATCH 2/2] linter --- superset-frontend/src/SqlLab/components/ResultSet.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset-frontend/src/SqlLab/components/ResultSet.tsx b/superset-frontend/src/SqlLab/components/ResultSet.tsx index 96f084565ac90..b5a6e4faaa0a5 100644 --- a/superset-frontend/src/SqlLab/components/ResultSet.tsx +++ b/superset-frontend/src/SqlLab/components/ResultSet.tsx @@ -280,7 +280,7 @@ export default class ResultSet extends React.PureComponent< // before saving the dataset. if (templateParams) { const p = JSON.parse(templateParams); - /* eslint-disable-next-line no-underscore-dangle */ + /* eslint-disable-next-line no-underscore-dangle */ if (p._filters) { /* eslint-disable-next-line no-underscore-dangle */ delete p._filters;