You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/07/20 22:15:35 UTC

[GitHub] mistercrunch closed pull request #5448: Time filter fixes

mistercrunch closed pull request #5448: Time filter fixes
URL: https://github.com/apache/incubator-superset/pull/5448
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/assets/src/explore/components/controls/DateFilterControl.jsx b/superset/assets/src/explore/components/controls/DateFilterControl.jsx
index f15e6f470c..b571a16fd0 100644
--- a/superset/assets/src/explore/components/controls/DateFilterControl.jsx
+++ b/superset/assets/src/explore/components/controls/DateFilterControl.jsx
@@ -38,6 +38,7 @@ const COMMON_TIME_FRAMES = [
   'Last month',
   'Last quarter',
   'Last year',
+  'No filter',
 ];
 const TIME_GRAIN_OPTIONS = ['seconds', 'minutes', 'hours', 'days', 'weeks', 'months', 'years'];
 
diff --git a/superset/data/__init__.py b/superset/data/__init__.py
index 49df42b137..f0201668d9 100644
--- a/superset/data/__init__.py
+++ b/superset/data/__init__.py
@@ -197,6 +197,7 @@ def load_world_bank_health_n_pop():
         "row_limit": config.get("ROW_LIMIT"),
         "since": "2014-01-01",
         "until": "2014-01-02",
+        "time_range": "2014-01-01 : 2014-01-02",
         "where": "",
         "markup_type": "markdown",
         "country_fieldtype": "cca3",
diff --git a/superset/utils.py b/superset/utils.py
index 76e2749b48..8fd8337cca 100644
--- a/superset/utils.py
+++ b/superset/utils.py
@@ -861,10 +861,12 @@ def get_since_until(form_data):
 
     Additionally, for `time_range` (these specify both `since` and `until`):
 
-        - Yesterday
+        - Last day
         - Last week
         - Last month
+        - Last quarter
         - Last year
+        - No filter
         - Last X seconds/minutes/hours/days/weeks/months/years
         - Next X seconds/minutes/hours/days/weeks/months/years
 
@@ -872,9 +874,10 @@ def get_since_until(form_data):
     separator = ' : '
     today = parse_human_datetime('today')
     common_time_frames = {
-        'Yesterday': (today - relativedelta(days=1), today),
+        'Last day': (today - relativedelta(days=1), today),
         'Last week': (today - relativedelta(weeks=1), today),
         'Last month': (today - relativedelta(months=1), today),
+        'Last quarter': (today - relativedelta(months=3), today),
         'Last year': (today - relativedelta(years=1), today),
     }
 
@@ -886,6 +889,8 @@ def get_since_until(form_data):
             until = parse_human_datetime(until)
         elif time_range in common_time_frames:
             since, until = common_time_frames[time_range]
+        elif time_range == 'No filter':
+            since = until = None
         else:
             rel, num, grain = time_range.split()
             if rel == 'Last':


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org