diff --git a/superset/assets/src/explore/controlPanels/DeckPolygon.js b/superset/assets/src/explore/controlPanels/DeckPolygon.js index d038c54ff..25790216f 100644 --- a/superset/assets/src/explore/controlPanels/DeckPolygon.js +++ b/superset/assets/src/explore/controlPanels/DeckPolygon.js @@ -26,10 +26,10 @@ export default { label: t('Query'), expanded: true, controlSetRows: [ + ['line_column', 'line_type'], ['adhoc_filters'], ['metric', 'point_radius_fixed'], ['row_limit', null], - ['line_column', 'line_type'], ['reverse_long_lat', 'filter_nulls'], ], }, diff --git a/superset/assets/src/explore/controls.jsx b/superset/assets/src/explore/controls.jsx index 6f3578bc4..f03925c3d 100644 --- a/superset/assets/src/explore/controls.jsx +++ b/superset/assets/src/explore/controls.jsx @@ -171,6 +171,7 @@ const metric = { ...metrics, multi: false, label: t('Metric'), + description: t('Metric'), default: props => mainMetric(props.savedMetrics), }; diff --git a/superset/data/birth_names.py b/superset/data/birth_names.py index 112082b42..9040847ab 100644 --- a/superset/data/birth_names.py +++ b/superset/data/birth_names.py @@ -91,7 +91,15 @@ def load_birth_names(): "granularity_sqla": "ds", "groupby": [], "metric": "sum__num", - "metrics": ["sum__num"], + "metrics": [ + { + "expressionType": "SIMPLE", + "column": {"column_name": "num", "type": "BIGINT"}, + "aggregate": "SUM", + "label": "Births", + "optionName": "metric_11", + } + ], "row_limit": config.get("ROW_LIMIT"), "since": "100 years ago", "until": "now", @@ -261,11 +269,7 @@ def load_birth_names(): datasource_type="table", datasource_id=tbl.id, params=get_slice_json( - defaults, - viz_type="pivot_table", - metrics=["sum__num"], - groupby=["name"], - columns=["state"], + defaults, viz_type="pivot_table", groupby=["name"], columns=["state"] ), ), Slice( diff --git a/superset/data/unicode_test_data.py b/superset/data/unicode_test_data.py index 943bfc35d..3f3ed55d9 100644 --- a/superset/data/unicode_test_data.py +++ b/superset/data/unicode_test_data.py @@ -76,11 +76,10 @@ def load_unicode_test_data(): "granularity_sqla": "dttm", "groupby": [], "metric": { - "expressionType": "SIMPLE", - "column": {"column_name": "value", "type": "INT"}, "aggregate": "SUM", - "label": "value", - "optionName": "metric_11", + "column": {"column_name": "value"}, + "expressionType": "SIMPLE", + "label": "Value", }, "row_limit": config.get("ROW_LIMIT"), "since": "100 years ago", diff --git a/superset/data/world_bank.py b/superset/data/world_bank.py index f00269b45..a64bd2ba1 100644 --- a/superset/data/world_bank.py +++ b/superset/data/world_bank.py @@ -106,7 +106,17 @@ def load_world_bank_health_n_pop(): "where": "", "markup_type": "markdown", "country_fieldtype": "cca3", - "secondary_metric": "sum__SP_POP_TOTL", + "secondary_metric": { + "aggregate": "SUM", + "column": { + "column_name": "SP_RUR_TOTL", + "optionName": "_col_SP_RUR_TOTL", + "type": "DOUBLE", + }, + "expressionType": "SIMPLE", + "hasCustomLabel": True, + "label": "Rural Population", + }, "entity": "country_code", "show_bubbles": True, } @@ -244,7 +254,6 @@ def load_world_bank_health_n_pop(): defaults, viz_type="sunburst", groupby=["region", "country_name"], - secondary_metric="sum__SP_RUR_TOTL", since="2011-01-01", until="2011-01-01", ), diff --git a/superset/viz.py b/superset/viz.py index 7ffd753c1..f802787ad 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -683,7 +683,7 @@ class PivotTableViz(BaseViz): if self.form_data.get("granularity") == "all" and DTTM_ALIAS in df: del df[DTTM_ALIAS] - aggfunc = self.form_data.get("pandas_aggfunc") + aggfunc = self.form_data.get("pandas_aggfunc") or "sum" # Ensure that Pandas's sum function mimics that of SQL. if aggfunc == "sum": diff --git a/tests/core_tests.py b/tests/core_tests.py index 2fdd6ad8a..ea3b88913 100644 --- a/tests/core_tests.py +++ b/tests/core_tests.py @@ -280,7 +280,8 @@ class CoreTests(SupersetTestCase): ] for name, method, url in urls: logging.info(f"[{name}]/[{method}]: {url}") - self.client.get(url) + resp = self.client.get(url) + self.assertEqual(resp.status_code, 200) def test_tablemodelview_list(self): self.login(username="admin")