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: Fix Chart Error Message Display (#3287)
Date Mon, 14 Aug 2017 19:24:37 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 025ef5a  Fix Chart Error Message Display (#3287)
025ef5a is described below

commit 025ef5a0f1e66b85bde114102cf4a37946be0a21
Author: Grace Guo <grace.guo@airbnb.com>
AuthorDate: Mon Aug 14 12:24:35 2017 -0700

    Fix Chart Error Message Display (#3287)
---
 superset/assets/javascripts/explore/actions/chartActions.js       | 5 +++++
 superset/assets/javascripts/explore/actions/exploreActions.js     | 5 -----
 superset/assets/javascripts/explore/components/ChartContainer.jsx | 6 +++---
 superset/assets/javascripts/explore/components/SaveModal.jsx      | 2 +-
 superset/assets/javascripts/explore/index.jsx                     | 3 ++-
 superset/assets/javascripts/explore/reducers/chartReducer.js      | 6 ++++++
 superset/assets/javascripts/explore/reducers/exploreReducer.js    | 6 ------
 7 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/superset/assets/javascripts/explore/actions/chartActions.js b/superset/assets/javascripts/explore/actions/chartActions.js
index 6c9291d..a9e5d1d 100644
--- a/superset/assets/javascripts/explore/actions/chartActions.js
+++ b/superset/assets/javascripts/explore/actions/chartActions.js
@@ -43,6 +43,11 @@ export function chartRenderingFailed(error) {
   return { type: CHART_RENDERING_FAILED, error };
 }
 
+export const REMOVE_CHART_ALERT = 'REMOVE_CHART_ALERT';
+export function removeChartAlert() {
+  return { type: REMOVE_CHART_ALERT };
+}
+
 export const RUN_QUERY = 'RUN_QUERY';
 export function runQuery(formData, force = false) {
   return function (dispatch, getState) {
diff --git a/superset/assets/javascripts/explore/actions/exploreActions.js b/superset/assets/javascripts/explore/actions/exploreActions.js
index f539aa1..1608282 100644
--- a/superset/assets/javascripts/explore/actions/exploreActions.js
+++ b/superset/assets/javascripts/explore/actions/exploreActions.js
@@ -141,11 +141,6 @@ export function removeControlPanelAlert() {
   return { type: REMOVE_CONTROL_PANEL_ALERT };
 }
 
-export const REMOVE_CHART_ALERT = 'REMOVE_CHART_ALERT';
-export function removeChartAlert() {
-  return { type: REMOVE_CHART_ALERT };
-}
-
 export const UPDATE_CHART_TITLE = 'UPDATE_CHART_TITLE';
 export function updateChartTitle(slice_name) {
   return { type: UPDATE_CHART_TITLE, slice_name };
diff --git a/superset/assets/javascripts/explore/components/ChartContainer.jsx b/superset/assets/javascripts/explore/components/ChartContainer.jsx
index 3e93b9e..3243f32 100644
--- a/superset/assets/javascripts/explore/components/ChartContainer.jsx
+++ b/superset/assets/javascripts/explore/components/ChartContainer.jsx
@@ -325,9 +325,9 @@ ChartContainer.propTypes = propTypes;
 function mapStateToProps({ explore, chart }) {
   const formData = getFormDataFromControls(explore.controls);
   return {
-    alert: explore.chartAlert,
-    can_overwrite: explore.can_overwrite,
-    can_download: explore.can_download,
+    alert: chart.chartAlert,
+    can_overwrite: !!explore.can_overwrite,
+    can_download: !!explore.can_download,
     datasource: explore.datasource,
     column_formats: explore.datasource ? explore.datasource.column_formats : null,
     containerId: explore.slice ? `slice-container-${explore.slice.slice_id}` : 'slice-container',
diff --git a/superset/assets/javascripts/explore/components/SaveModal.jsx b/superset/assets/javascripts/explore/components/SaveModal.jsx
index b3a69a3..45f5ac1 100644
--- a/superset/assets/javascripts/explore/components/SaveModal.jsx
+++ b/superset/assets/javascripts/explore/components/SaveModal.jsx
@@ -238,7 +238,7 @@ function mapStateToProps({ explore, saveModal }) {
     can_overwrite: explore.can_overwrite,
     user_id: explore.user_id,
     dashboards: saveModal.dashboards,
-    alert: explore.saveModalAlert,
+    alert: saveModal.saveModalAlert,
   };
 }
 
diff --git a/superset/assets/javascripts/explore/index.jsx b/superset/assets/javascripts/explore/index.jsx
index 2f6e898..525f2c4 100644
--- a/superset/assets/javascripts/explore/index.jsx
+++ b/superset/assets/javascripts/explore/index.jsx
@@ -35,12 +35,12 @@ const bootstrappedState = Object.assign(
     isStarred: false,
     triggerQuery: true,
     triggerRender: false,
-    alert: null,
   },
 );
 
 const initState = {
   chart: {
+    chartAlert: null,
     chartStatus: null,
     chartUpdateEndTime: null,
     chartUpdateStartTime: now(),
@@ -49,6 +49,7 @@ const initState = {
   },
   saveModal: {
     dashboards: [],
+    saveModalAlert: null,
   },
   explore: bootstrappedState,
 };
diff --git a/superset/assets/javascripts/explore/reducers/chartReducer.js b/superset/assets/javascripts/explore/reducers/chartReducer.js
index c41771b..9337b24 100644
--- a/superset/assets/javascripts/explore/reducers/chartReducer.js
+++ b/superset/assets/javascripts/explore/reducers/chartReducer.js
@@ -63,6 +63,12 @@ export default function chartReducer(state = {}, action) {
       }
       return newState;
     },
+    [actions.REMOVE_CHART_ALERT]() {
+      if (state.chartAlert !== null) {
+        return Object.assign({}, state, { chartAlert: null });
+      }
+      return state;
+    },
   };
 
   if (action.type in actionHandlers) {
diff --git a/superset/assets/javascripts/explore/reducers/exploreReducer.js b/superset/assets/javascripts/explore/reducers/exploreReducer.js
index bc1072f..35281aa 100644
--- a/superset/assets/javascripts/explore/reducers/exploreReducer.js
+++ b/superset/assets/javascripts/explore/reducers/exploreReducer.js
@@ -65,12 +65,6 @@ export default function exploreReducer(state = {}, action) {
       const updatedSlice = Object.assign({}, state.slice, { slice_name: action.slice_name
});
       return Object.assign({}, state, { slice: updatedSlice });
     },
-    [actions.REMOVE_CHART_ALERT]() {
-      if (state.chartAlert !== null) {
-        return Object.assign({}, state, { chartAlert: null });
-      }
-      return state;
-    },
     [actions.RESET_FIELDS]() {
       const controls = getControlsState(state, getFormDataFromControls(state.controls));
       return Object.assign({}, state, { controls });

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

Mime
View raw message