Fix Chart Error Message Display (#3287)

This commit is contained in:
Grace Guo 2017-08-14 12:24:35 -07:00 committed by Maxime Beauchemin
parent 9a4e4d0443
commit 025ef5a0f1
7 changed files with 17 additions and 16 deletions

View File

@ -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) {

View File

@ -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 };

View File

@ -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',

View File

@ -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,
};
}

View File

@ -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,
};

View File

@ -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) {

View File

@ -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 });