superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: [hotfix] fix slices where since/until = None (#3401)
Date Thu, 31 Aug 2017 03:27:03 GMT
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 66f646a  [hotfix] fix slices where since/until = None (#3401)
66f646a is described below

commit 66f646ac66c308ca0235e2a62c6d4f5110712640
Author: Maxime Beauchemin <maximebeauchemin@gmail.com>
AuthorDate: Wed Aug 30 20:26:58 2017 -0700

    [hotfix] fix slices where since/until = None (#3401)
---
 .../explore/components/controls/DateFilterControl.jsx    | 16 +++++++++-------
 superset/viz.py                                          |  2 +-
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/superset/assets/javascripts/explore/components/controls/DateFilterControl.jsx
b/superset/assets/javascripts/explore/components/controls/DateFilterControl.jsx
index d1bc335..9e9ed46 100644
--- a/superset/assets/javascripts/explore/components/controls/DateFilterControl.jsx
+++ b/superset/assets/javascripts/explore/components/controls/DateFilterControl.jsx
@@ -21,20 +21,20 @@ const propTypes = {
   label: PropTypes.string,
   description: PropTypes.string,
   onChange: PropTypes.func,
-  value: PropTypes.string.isRequired,
+  value: PropTypes.string,
   height: PropTypes.number,
 };
 
 const defaultProps = {
   animation: true,
   onChange: () => {},
-  value: null,
+  value: '',
 };
 
 export default class DateFilterControl extends React.Component {
   constructor(props) {
     super(props);
-    const words = props.value.split(' ');
+    const value = props.value || '';
     this.state = {
       num: '7',
       grain: 'days',
@@ -43,16 +43,17 @@ export default class DateFilterControl extends React.Component {
       type: 'free',
       free: '',
     };
+    const words = value.split(' ');
     if (words.length >= 3 && RELATIVE_TIME_OPTIONS.indexOf(words[2]) >= 0)
{
       this.state.num = words[0];
       this.state.grain = words[1];
       this.state.rel = words[2];
       this.state.type = 'rel';
-    } else if (moment(props.value).isValid()) {
-      this.state.dttm = props.value;
+    } else if (moment(value).isValid()) {
+      this.state.dttm = value;
       this.state.type = 'fix';
     } else {
-      this.state.free = props.value;
+      this.state.free = value;
       this.state.type = 'free';
     }
   }
@@ -193,6 +194,7 @@ export default class DateFilterControl extends React.Component {
     );
   }
   render() {
+    const value = this.props.value || '';
     return (
       <div>
         <ControlHeader {...this.props} />
@@ -206,7 +208,7 @@ export default class DateFilterControl extends React.Component {
           overlay={this.renderPopover()}
         >
           <Label style={{ cursor: 'pointer' }}>
-            {this.props.value.replace('T00:00:00', '') || '∞'}
+            {value.replace('T00:00:00', '') || '∞'}
           </Label>
         </OverlayTrigger>
       </div>
diff --git a/superset/viz.py b/superset/viz.py
index b3c49bb..b7f1e63 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -143,7 +143,7 @@ class BaseViz(object):
         # potential conflicts with column that would be named `from` or `to`
         since = (
             extra_filters.get('__from') or
-            form_data.get("since")
+            form_data.get("since") or ''
         )
 
         # Backward compatibility hack

-- 
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <commits@superset.apache.org>'].

Mime
View raw message