From 3f6e5ac41da5839bb90b16e0b44b64b7d2b7eb16 Mon Sep 17 00:00:00 2001 From: cccs-jc Date: Sat, 13 Mar 2021 20:30:54 +0000 Subject: [PATCH 1/3] added support to configure the default explorer viz --- superset-frontend/src/explore/store.js | 2 +- superset/config.py | 3 +++ superset/views/base.py | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/superset-frontend/src/explore/store.js b/superset-frontend/src/explore/store.js index 9b33aaa49f6a9..9f12dc172b409 100644 --- a/superset-frontend/src/explore/store.js +++ b/superset-frontend/src/explore/store.js @@ -41,7 +41,7 @@ export function getControlsState(state, inputFormData) { * */ // Getting a list of active control names for the current viz const formData = { ...inputFormData }; - const vizType = formData.viz_type || 'table'; + const vizType = formData.viz_type || state.common.conf.DEFAULT_EXPLORER_VIZ || 'table'; handleDeprecatedControls(formData); diff --git a/superset/config.py b/superset/config.py index 94abd64cd997f..563d85c5ddc63 100644 --- a/superset/config.py +++ b/superset/config.py @@ -114,6 +114,9 @@ def _try_json_readsha( # pylint: disable=unused-argument VERSION_SHA_LENGTH = 8 VERSION_SHA = _try_json_readsha(VERSION_INFO_FILE, VERSION_SHA_LENGTH) +# default viz used in chart explorer +DEFAULT_EXPLORER_VIZ = 'table' + ROW_LIMIT = 50000 VIZ_ROW_LIMIT = 10000 # max rows retreieved when requesting samples from datasource in explore view diff --git a/superset/views/base.py b/superset/views/base.py index cb486c51357ab..8e255023f85b8 100644 --- a/superset/views/base.py +++ b/superset/views/base.py @@ -74,6 +74,7 @@ "DISABLE_DATASET_SOURCE_EDIT", "ENABLE_JAVASCRIPT_CONTROLS", "DEFAULT_SQLLAB_LIMIT", + "DEFAULT_EXPLORER_VIZ", "SQL_MAX_ROW", "SUPERSET_WEBSERVER_DOMAINS", "SQLLAB_SAVE_WARNING_MESSAGE", From f9211e08c3057666bf8897e8f3e6554a415c144a Mon Sep 17 00:00:00 2001 From: cccs-jc Date: Wed, 17 Mar 2021 18:55:53 +0000 Subject: [PATCH 2/3] code review fix --- superset-frontend/src/explore/store.js | 2 +- superset/config.py | 2 +- superset/views/base.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/superset-frontend/src/explore/store.js b/superset-frontend/src/explore/store.js index 9f12dc172b409..392245285230c 100644 --- a/superset-frontend/src/explore/store.js +++ b/superset-frontend/src/explore/store.js @@ -41,7 +41,7 @@ export function getControlsState(state, inputFormData) { * */ // Getting a list of active control names for the current viz const formData = { ...inputFormData }; - const vizType = formData.viz_type || state.common.conf.DEFAULT_EXPLORER_VIZ || 'table'; + const vizType = formData.viz_type || state.common.conf.DEFAULT_VIZ_TYPE || 'table'; handleDeprecatedControls(formData); diff --git a/superset/config.py b/superset/config.py index 563d85c5ddc63..39fae228d7d78 100644 --- a/superset/config.py +++ b/superset/config.py @@ -115,7 +115,7 @@ def _try_json_readsha( # pylint: disable=unused-argument VERSION_SHA = _try_json_readsha(VERSION_INFO_FILE, VERSION_SHA_LENGTH) # default viz used in chart explorer -DEFAULT_EXPLORER_VIZ = 'table' +DEFAULT_VIZ_TYPE = 'table' ROW_LIMIT = 50000 VIZ_ROW_LIMIT = 10000 diff --git a/superset/views/base.py b/superset/views/base.py index 8e255023f85b8..9236570f8f7f6 100644 --- a/superset/views/base.py +++ b/superset/views/base.py @@ -74,7 +74,7 @@ "DISABLE_DATASET_SOURCE_EDIT", "ENABLE_JAVASCRIPT_CONTROLS", "DEFAULT_SQLLAB_LIMIT", - "DEFAULT_EXPLORER_VIZ", + "DEFAULT_VIZ_TYPE", "SQL_MAX_ROW", "SUPERSET_WEBSERVER_DOMAINS", "SQLLAB_SAVE_WARNING_MESSAGE", From cbf3e77f599e812c59e0637a6805364fc6d7cd95 Mon Sep 17 00:00:00 2001 From: Ville Brofeldt Date: Fri, 26 Mar 2021 17:44:27 +0200 Subject: [PATCH 3/3] lint --- superset-frontend/src/explore/store.js | 3 ++- superset/config.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/explore/store.js b/superset-frontend/src/explore/store.js index 392245285230c..16ad2324c0922 100644 --- a/superset-frontend/src/explore/store.js +++ b/superset-frontend/src/explore/store.js @@ -41,7 +41,8 @@ export function getControlsState(state, inputFormData) { * */ // Getting a list of active control names for the current viz const formData = { ...inputFormData }; - const vizType = formData.viz_type || state.common.conf.DEFAULT_VIZ_TYPE || 'table'; + const vizType = + formData.viz_type || state.common.conf.DEFAULT_VIZ_TYPE || 'table'; handleDeprecatedControls(formData); diff --git a/superset/config.py b/superset/config.py index 39fae228d7d78..a9d52ae1961ff 100644 --- a/superset/config.py +++ b/superset/config.py @@ -115,7 +115,7 @@ def _try_json_readsha( # pylint: disable=unused-argument VERSION_SHA = _try_json_readsha(VERSION_INFO_FILE, VERSION_SHA_LENGTH) # default viz used in chart explorer -DEFAULT_VIZ_TYPE = 'table' +DEFAULT_VIZ_TYPE = "table" ROW_LIMIT = 50000 VIZ_ROW_LIMIT = 10000