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: Call props.onChange only when closing filter (#4003)
Date Tue, 05 Dec 2017 19:17:15 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 823f306  Call props.onChange only when closing filter (#4003)
823f306 is described below

commit 823f306f248f27b6976f7a69e47b773418d7d0d4
Author: Beto Dealmeida <roberto@dealmeida.net>
AuthorDate: Tue Dec 5 11:17:12 2017 -0800

    Call props.onChange only when closing filter (#4003)
---
 .../components/controls/DateFilterControl.jsx        | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/superset/assets/javascripts/explore/components/controls/DateFilterControl.jsx
b/superset/assets/javascripts/explore/components/controls/DateFilterControl.jsx
index 9e9ed46..eb35c01 100644
--- a/superset/assets/javascripts/explore/components/controls/DateFilterControl.jsx
+++ b/superset/assets/javascripts/explore/components/controls/DateFilterControl.jsx
@@ -63,17 +63,6 @@ export default class DateFilterControl extends React.Component {
   onNumberChange(event) {
     this.setState({ num: event.target.value }, this.onChange);
   }
-  onChange() {
-    let val;
-    if (this.state.type === 'rel') {
-      val = `${this.state.num} ${this.state.grain} ${this.state.rel}`;
-    } else if (this.state.type === 'fix') {
-      val = this.state.dttm;
-    } else if (this.state.type === 'free') {
-      val = this.state.free;
-    }
-    this.props.onChange(val);
-  }
   onFreeChange(event) {
     this.setState({ free: event.target.value }, this.onChange);
   }
@@ -88,6 +77,15 @@ export default class DateFilterControl extends React.Component {
     this.setState({ dttm: dttm.format().substring(0, 19) }, this.onChange);
   }
   close() {
+    let val;
+    if (this.state.type === 'rel') {
+      val = `${this.state.num} ${this.state.grain} ${this.state.rel}`;
+    } else if (this.state.type === 'fix') {
+      val = this.state.dttm;
+    } else if (this.state.type === 'free') {
+      val = this.state.free;
+    }
+    this.props.onChange(val);
     this.refs.trigger.hide();
   }
   renderPopover() {

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

Mime
View raw message