From b7f9dabc44137fd62ccd29d5f24724eb162f0012 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Mon, 6 Aug 2018 08:36:06 -0700 Subject: [PATCH] A collection of small bug fixes on master (#5561) --- .../src/visualizations/deckgl/layers/grid.jsx | 1 - superset/data/__init__.py | 19 ++++++++++--------- superset/legacy.py | 4 +++- superset/views/core.py | 4 ++-- superset/viz.py | 3 +-- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/superset/assets/src/visualizations/deckgl/layers/grid.jsx b/superset/assets/src/visualizations/deckgl/layers/grid.jsx index ca3056e2c1..16a538c906 100644 --- a/superset/assets/src/visualizations/deckgl/layers/grid.jsx +++ b/superset/assets/src/visualizations/deckgl/layers/grid.jsx @@ -21,7 +21,6 @@ function getLayer(formData, payload, slice) { const jsFnMutator = sandboxedEval(fd.js_data_mutator); data = jsFnMutator(data); } - return new GridLayer({ id: `grid-layer-${fd.slice_id}`, data, diff --git a/superset/data/__init__.py b/superset/data/__init__.py index b887034899..a164111e62 100644 --- a/superset/data/__init__.py +++ b/superset/data/__init__.py @@ -226,6 +226,7 @@ def load_world_bank_health_n_pop(): params=get_slice_json( defaults, viz_type='filter_box', + date_filter=False, groupby=['region', 'country_name'])), Slice( slice_name="World's Population", @@ -472,7 +473,7 @@ def load_world_bank_health_n_pop(): "width": 4 }, "type": "CHART" - }, + }, "CHART-a4808bba": { "children": [], "id": "CHART-a4808bba", @@ -994,7 +995,7 @@ def load_birth_names(): "type": "CHART", "id": "CHART-976960a5", "children": [] - }, + }, "CHART-58575537": { "meta": { "chartId": 54, @@ -1024,7 +1025,7 @@ def load_birth_names(): "type": "CHART", "id": "CHART-e440d205", "children": [] - }, + }, "CHART-59444e0b": { "meta": { "chartId": 57, @@ -1054,7 +1055,7 @@ def load_birth_names(): "type": "CHART", "id": "CHART-e8774b49", "children": [] - }, + }, "CHART-985bfd1e": { "meta": { "chartId": 61, @@ -1064,7 +1065,7 @@ def load_birth_names(): "type": "CHART", "id": "CHART-985bfd1e", "children": [] - }, + }, "CHART-17f13246": { "meta": { "chartId": 62, @@ -1331,7 +1332,7 @@ def load_unicode_test_data(): "type": "ROW" }, "VERSION_KEY": "v2" -} +} """ dash.dashboard_title = "Unicode Test" l = json.loads(js) @@ -1836,6 +1837,7 @@ def load_deck_dash(): "multiplier": 10, "point_radius_fixed": {"type": "metric", "value": "count"}, "point_unit": "square_m", + "min_radius": 1, "row_limit": 5000, "since": None, "size": "count", @@ -1972,10 +1974,9 @@ def load_deck_dash(): "granularity_sqla": "dttm", "size": "count", "viz_type": "deck_grid", - "since": None, "point_radius_unit": "Pixels", "point_radius": "Auto", - "until": None, + "time_range": "No filter", "color_picker": { "a": 1, "r": 14, @@ -2244,7 +2245,7 @@ def load_deck_dash(): "type": "CHART", "id": "CHART-d02f6c40", "children": [] - }, + }, "CHART-2673431d": { "meta": { "chartId": 70, diff --git a/superset/legacy.py b/superset/legacy.py index 54da75c93d..49cc5fe530 100644 --- a/superset/legacy.py +++ b/superset/legacy.py @@ -88,4 +88,6 @@ def update_time_range(form_data): """Move since and until to time_range.""" if 'since' in form_data or 'until' in form_data: form_data['time_range'] = '{} : {}'.format( - form_data.pop('since', ''), form_data.pop('until', '')) + form_data.pop('since', '') or '', + form_data.pop('until', '') or '', + ) diff --git a/superset/views/core.py b/superset/views/core.py index 09904f71d6..14c5469195 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -1075,7 +1075,7 @@ class Superset(BaseSupersetView): json.dumps({ 'query': query, 'language': viz_obj.datasource.query_language, - 'data': viz_obj.get_df().to_dict('records'), + 'data': viz_obj.get_df().to_dict('records'), # TODO, split into endpoint }, default=utils.json_iso_dttm_ser), status=200, mimetype='application/json') @@ -2742,7 +2742,7 @@ class Superset(BaseSupersetView): @api @has_access_api @expose('/slice_query//') - def sliceQuery(self, slice_id): + def slice_query(self, slice_id): """ This method exposes an API endpoint to get the database query string for this slice diff --git a/superset/viz.py b/superset/viz.py index c9eea34ca2..b0a71d5a9d 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -2065,7 +2065,7 @@ class BaseDeckGLViz(BaseViz): spatial_control_keys = [] def handle_nulls(self, df): - pass + return df def get_metrics(self): self.metric = self.form_data.get('size') @@ -2146,7 +2146,6 @@ class BaseDeckGLViz(BaseViz): d['columns'] = [] else: d['columns'] = gb - return d def get_js_columns(self, d):