Added Alert for ControlPanel and ChartContainer (#1626)

* Added Alert for ControlPanel and ChartContainer

Done:
 - Add alert for Control Panel when fetch_datasource_metadata failes
 - Add alert for Chart Container when update_explore query fails

* Changed color to warning-yellow

* Solve linter issue

* Fixed indent and delete error_redirect
This commit is contained in:
vera-liu
2016-11-18 11:17:06 -08:00
committed by GitHub
parent 0acf26b37c
commit a8480f5492
6 changed files with 79 additions and 22 deletions

View File

@@ -18,9 +18,15 @@ export const exploreReducer = function (state, action) {
[actions.FETCH_FAILED]() {
// todo(alanna) handle failure/error state
return Object.assign({}, state, { isDatasourceMetaLoading: false });
return Object.assign({}, state,
{
isDatasourceMetaLoading: false,
controlPanelAlert: action.error,
});
},
[actions.REMOVE_CONTROL_PANEL_ALERT]() {
return Object.assign({}, state, { controlPanelAlert: null });
},
[actions.SET_FIELD_OPTIONS]() {
const newState = Object.assign({}, state);
const optionsByFieldName = action.options;
@@ -88,7 +94,10 @@ export const exploreReducer = function (state, action) {
return Object.assign({}, state, { isChartLoading: true });
},
[actions.CHART_UPDATE_FAILED]() {
return Object.assign({}, state, { isChartLoading: false });
return Object.assign({}, state, { isChartLoading: false, chartAlert: action.error });
},
[actions.REMOVE_CHART_ALERT]() {
return Object.assign({}, state, { chartAlert: null });
},
};
if (action.type in actionHandlers) {