mirror of
https://github.com/apache/superset.git
synced 2026-04-21 00:54:44 +00:00
Save modal component for explore v2 (#1612)
* Added specs for SaveModal * Move datasource_id and datasource_name to form_data * Add comments * Deleted redundant fetchDashboard * Replcae has_key for python3 * More react and less jquery * Added alert for save slice * Small changes based on comments * Use react bootstrap
This commit is contained in:
@@ -27,6 +27,16 @@ export const exploreReducer = function (state, action) {
|
||||
[actions.REMOVE_CONTROL_PANEL_ALERT]() {
|
||||
return Object.assign({}, state, { controlPanelAlert: null });
|
||||
},
|
||||
|
||||
[actions.FETCH_DASHBOARDS_SUCCEEDED]() {
|
||||
return Object.assign({}, state, { dashboards: action.choices });
|
||||
},
|
||||
|
||||
[actions.FETCH_DASHBOARDS_FAILED]() {
|
||||
return Object.assign({}, state,
|
||||
{ saveModalAlert: `fetching dashboards failed for ${action.userId}` });
|
||||
},
|
||||
|
||||
[actions.SET_FIELD_OPTIONS]() {
|
||||
const newState = Object.assign({}, state);
|
||||
const optionsByFieldName = action.options;
|
||||
@@ -66,6 +76,9 @@ export const exploreReducer = function (state, action) {
|
||||
newFormData.slice_name = state.viz.form_data.slice_name;
|
||||
newFormData.viz_type = state.viz.form_data.viz_type;
|
||||
}
|
||||
if (action.key === 'viz_type') {
|
||||
newFormData.previous_viz_type = state.viz.form_data.viz_type;
|
||||
}
|
||||
newFormData[action.key] = action.value ? action.value : (!state.viz.form_data[action.key]);
|
||||
return Object.assign(
|
||||
{},
|
||||
@@ -99,6 +112,12 @@ export const exploreReducer = function (state, action) {
|
||||
[actions.REMOVE_CHART_ALERT]() {
|
||||
return Object.assign({}, state, { chartAlert: null });
|
||||
},
|
||||
[actions.SAVE_SLICE_FAILED]() {
|
||||
return Object.assign({}, state, { saveModalAlert: 'Failed to save slice' });
|
||||
},
|
||||
[actions.REMOVE_SAVE_MODAL_ALERT]() {
|
||||
return Object.assign({}, state, { saveModalAlert: null });
|
||||
},
|
||||
};
|
||||
if (action.type in actionHandlers) {
|
||||
return actionHandlers[action.type]();
|
||||
|
||||
Reference in New Issue
Block a user