mirror of
https://github.com/apache/superset.git
synced 2026-04-18 15:44:57 +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
@@ -2,16 +2,16 @@
|
||||
const $ = window.$ = require('jquery');
|
||||
const FAVESTAR_BASE_URL = '/superset/favstar/slice';
|
||||
|
||||
export const SET_FIELD_OPTIONS = 'SET_FIELD_OPTIONS';
|
||||
export function setFieldOptions(options) {
|
||||
return { type: SET_FIELD_OPTIONS, options };
|
||||
}
|
||||
|
||||
export const SET_DATASOURCE_TYPE = 'SET_DATASOURCE_TYPE';
|
||||
export function setDatasourceType(datasourceType) {
|
||||
return { type: SET_DATASOURCE_TYPE, datasourceType };
|
||||
}
|
||||
|
||||
export const SET_DATASOURCE = 'SET_DATASOURCE';
|
||||
export function setDatasource(datasource) {
|
||||
return { type: SET_DATASOURCE, datasource };
|
||||
}
|
||||
|
||||
export const FETCH_STARTED = 'FETCH_STARTED';
|
||||
export function fetchStarted() {
|
||||
return { type: FETCH_STARTED };
|
||||
@@ -27,7 +27,7 @@ export function fetchFailed(error) {
|
||||
return { type: FETCH_FAILED, error };
|
||||
}
|
||||
|
||||
export function fetchFieldOptions(datasourceId, datasourceType) {
|
||||
export function fetchDatasourceMetadata(datasourceId, datasourceType) {
|
||||
return function (dispatch) {
|
||||
dispatch(fetchStarted());
|
||||
|
||||
@@ -38,7 +38,7 @@ export function fetchFieldOptions(datasourceId, datasourceType) {
|
||||
type: 'GET',
|
||||
url,
|
||||
success: (data) => {
|
||||
dispatch(setFieldOptions(data.field_options));
|
||||
dispatch(setDatasource(data));
|
||||
dispatch(fetchSucceeded());
|
||||
},
|
||||
error(error) {
|
||||
|
||||
Reference in New Issue
Block a user