Skip to content

Commit

Permalink
Fix Chart Error Message Display
Browse files Browse the repository at this point in the history
  • Loading branch information
Grace Guo committed Aug 14, 2017
1 parent c9c6bca commit 63ef435
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
5 changes: 5 additions & 0 deletions superset/assets/javascripts/explore/actions/chartActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 0 additions & 5 deletions superset/assets/javascripts/explore/actions/exploreActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}

Expand Down
3 changes: 2 additions & 1 deletion superset/assets/javascripts/explore/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -49,6 +49,7 @@ const initState = {
},
saveModal: {
dashboards: [],
saveModalAlert: null,
},
explore: bootstrappedState,
};
Expand Down
6 changes: 6 additions & 0 deletions superset/assets/javascripts/explore/reducers/chartReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down

0 comments on commit 63ef435

Please sign in to comment.