superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grace...@apache.org
Subject [incubator-superset] branch master updated: [dashboard bug]Instant control should take effect instantly (#3890)
Date Sat, 18 Nov 2017 00:34:55 GMT
This is an automated email from the ASF dual-hosted git repository.

graceguo 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 831cd21  [dashboard bug]Instant control should take effect instantly (#3890)
831cd21 is described below

commit 831cd2173725e79807f9dd5d48af901ffa527de1
Author: Grace Guo <grace.guo@airbnb.com>
AuthorDate: Fri Nov 17 16:34:53 2017 -0800

    [dashboard bug]Instant control should take effect instantly (#3890)
    
    in explore view, controls like color cheme, legend, rich tooltip, etc., change these controls
should see effect instantly, without click Run Query.
---
 superset/assets/javascripts/chart/ChartContainer.jsx                | 2 +-
 superset/assets/javascripts/chart/chartReducer.js                   | 2 ++
 .../assets/javascripts/explore/components/ExploreViewContainer.jsx  | 6 ++++++
 superset/assets/javascripts/explore/index.jsx                       | 5 +++--
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/superset/assets/javascripts/chart/ChartContainer.jsx b/superset/assets/javascripts/chart/ChartContainer.jsx
index 11c4322..d517677 100644
--- a/superset/assets/javascripts/chart/ChartContainer.jsx
+++ b/superset/assets/javascripts/chart/ChartContainer.jsx
@@ -12,10 +12,10 @@ function mapStateToProps({ charts }, ownProps) {
     chartUpdateEndTime: chart.chartUpdateEndTime,
     chartUpdateStartTime: chart.chartUpdateStartTime,
     latestQueryFormData: chart.latestQueryFormData,
+    lastRendered: chart.lastRendered,
     queryResponse: chart.queryResponse,
     queryRequest: chart.queryRequest,
     triggerQuery: chart.triggerQuery,
-    triggerRender: chart.triggerRender,
   };
 }
 
diff --git a/superset/assets/javascripts/chart/chartReducer.js b/superset/assets/javascripts/chart/chartReducer.js
index 835ee94..ade8c5b 100644
--- a/superset/assets/javascripts/chart/chartReducer.js
+++ b/superset/assets/javascripts/chart/chartReducer.js
@@ -12,6 +12,7 @@ export const chartPropType = {
   chartUpdateEndTime: PropTypes.number,
   chartUpdateStartTime: PropTypes.number,
   latestQueryFormData: PropTypes.object,
+  queryRequest: PropTypes.object,
   queryResponse: PropTypes.object,
   triggerQuery: PropTypes.bool,
   lastRendered: PropTypes.number,
@@ -24,6 +25,7 @@ export const chart = {
   chartUpdateEndTime: null,
   chartUpdateStartTime: now(),
   latestQueryFormData: null,
+  queryRequest: null,
   queryResponse: null,
   triggerQuery: true,
   lastRendered: 0,
diff --git a/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx b/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx
index e3ea7f2..43f6c01 100644
--- a/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx
+++ b/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx
@@ -9,6 +9,7 @@ import ControlPanelsContainer from './ControlPanelsContainer';
 import SaveModal from './SaveModal';
 import QueryAndSaveBtns from './QueryAndSaveBtns';
 import { getExploreUrl } from '../exploreUtils';
+import { areObjectsEqual } from '../../reduxUtils';
 import { getFormDataFromControls } from '../stores/store';
 import { chartPropType } from '../../chart/chartReducer';
 import * as exploreActions from '../actions/exploreActions';
@@ -50,6 +51,11 @@ class ExploreViewContainer extends React.Component {
     if (np.controls.datasource.value !== this.props.controls.datasource.value) {
       this.props.actions.fetchDatasourceMetadata(np.form_data.datasource, true);
     }
+    // if any control value changed and it's an instant control
+    if (Object.keys(np.controls).some(key => (np.controls[key].renderTrigger &&
+      !areObjectsEqual(np.controls[key].value, this.props.controls[key].value)))) {
+      this.props.actions.renderTriggered(new Date().getTime(), this.props.chart.chartKey);
+    }
   }
 
   componentDidUpdate() {
diff --git a/superset/assets/javascripts/explore/index.jsx b/superset/assets/javascripts/explore/index.jsx
index 2247019..fa92d7c 100644
--- a/superset/assets/javascripts/explore/index.jsx
+++ b/superset/assets/javascripts/explore/index.jsx
@@ -43,13 +43,14 @@ const initState = {
     [chartKey]: {
       chartKey,
       chartAlert: null,
-      chartStatus: null,
+      chartStatus: 'loading',
       chartUpdateEndTime: null,
       chartUpdateStartTime: now(),
       latestQueryFormData: getFormDataFromControls(controls),
+      queryRequest: null,
       queryResponse: null,
       triggerQuery: true,
-      triggerRender: false,
+      lastRendered: 0,
     },
   },
   saveModal: {

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

Mime
View raw message