You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2018/08/03 18:29:37 UTC
[incubator-superset] branch master updated: [bugfix] time filter on
dashboard view (#5546)
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 8014709 [bugfix] time filter on dashboard view (#5546)
8014709 is described below
commit 8014709b1ad1fb9b5a17a36d680cab56f34cf38f
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Fri Aug 3 11:29:34 2018 -0700
[bugfix] time filter on dashboard view (#5546)
Charts using the old since/until time filtering form_data format would
only work in the Explore view, not on the dashboard view. This fixes
that.
---
superset/legacy.py | 6 +++---
superset/models/core.py | 3 +++
superset/views/core.py | 6 ++----
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/superset/legacy.py b/superset/legacy.py
index 25f282d..54da75c 100644
--- a/superset/legacy.py
+++ b/superset/legacy.py
@@ -86,6 +86,6 @@ def cast_form_data(form_data):
def update_time_range(form_data):
"""Move since and until to time_range."""
- form_data['time_range'] = '{} : {}'.format(
- form_data.pop('since'), form_data.pop('until'))
- return form_data
+ if 'since' in form_data or 'until' in form_data:
+ form_data['time_range'] = '{} : {}'.format(
+ form_data.pop('since', ''), form_data.pop('until', ''))
diff --git a/superset/models/core.py b/superset/models/core.py
index 3aa7038..2a11545 100644
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -37,6 +37,7 @@ import sqlparse
from superset import app, db, db_engine_specs, security_manager, utils
from superset.connectors.connector_registry import ConnectorRegistry
+from superset.legacy import update_time_range
from superset.models.helpers import AuditMixinNullable, ImportMixin, set_perm
from superset.viz import viz_types
install_aliases()
@@ -213,8 +214,10 @@ class Slice(Model, AuditMixinNullable, ImportMixin):
'datasource': '{}__{}'.format(
self.datasource_id, self.datasource_type),
})
+
if self.cache_timeout:
form_data['cache_timeout'] = self.cache_timeout
+ update_time_range(form_data)
return form_data
def get_explore_url(self, base_url='/superset/explore', overrides=None):
diff --git a/superset/views/core.py b/superset/views/core.py
index 667bfca..4c1752e 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -1006,6 +1006,8 @@ class Superset(BaseSupersetView):
slice_form_data.update(form_data)
form_data = slice_form_data
+ update_time_range(form_data)
+
return form_data, slc
def get_viz(
@@ -1312,10 +1314,6 @@ class Superset(BaseSupersetView):
datasource_type,
datasource.name)
- # update to new time filter
- if 'since' in form_data and 'until' in form_data:
- form_data = update_time_range(form_data)
-
standalone = request.args.get('standalone') == 'true'
bootstrap_data = {
'can_add': slice_add_perm,