mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
[exploreV2] mapStateToProps for fields (#1882)
* Controls support for mapStateToProps * Binding methods in the constructor * Adressing comments * Fixing tests
This commit is contained in:
committed by
GitHub
parent
9a62d94630
commit
222671675c
@@ -39,25 +39,9 @@ export const exploreReducer = function (state, action) {
|
||||
return Object.assign({}, state,
|
||||
{ saveModalAlert: `fetching dashboards failed for ${action.userId}` });
|
||||
},
|
||||
|
||||
[actions.SET_FIELD_OPTIONS]() {
|
||||
const newState = Object.assign({}, state);
|
||||
const optionsByFieldName = action.options;
|
||||
const fieldNames = Object.keys(optionsByFieldName);
|
||||
|
||||
fieldNames.forEach((fieldName) => {
|
||||
if (fieldName === 'filterable_cols') {
|
||||
newState.filterColumnOpts = optionsByFieldName[fieldName];
|
||||
} else {
|
||||
newState.fields[fieldName].choices = optionsByFieldName[fieldName];
|
||||
if (fieldName === 'metric' && state.viz.form_data.viz_type === 'dual_line') {
|
||||
newState.fields.metric_2.choices = optionsByFieldName[fieldName];
|
||||
}
|
||||
}
|
||||
});
|
||||
return Object.assign({}, state, newState);
|
||||
[actions.SET_DATASOURCE]() {
|
||||
return Object.assign({}, state, { datasource: action.datasource });
|
||||
},
|
||||
|
||||
[actions.SET_FILTER_COLUMN_OPTS]() {
|
||||
return Object.assign({}, state, { filterColumnOpts: action.filterColumnOpts });
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user