Moved time column and grains to models.py (#1255)

This commit is contained in:
vera-liu
2016-10-05 13:02:35 -07:00
committed by Maxime Beauchemin
parent a8a16900e7
commit 659bf6d7e8
6 changed files with 27 additions and 29 deletions

View File

@@ -29,7 +29,7 @@ export const CHANGE_FILTER_OP = 'CHANGE_FILTER_OP';
export const CHANGE_FILTER_VALUE = 'CHANGE_FILTER_VALUE';
export const RESET_FORM_DATA = 'RESET_FORM_DATA';
export const CLEAR_ALL_OPTS = 'CLEAR_ALL_OPTS';
export const SET_DATASOURCE_CLASS = 'SET_DATASOURCE_CLASS';
export const SET_DATASOURCE_TYPE = 'SET_DATASOURCE_TYPE';
export function setTimeColumnOpts(timeColumnOpts) {
return { type: SET_TIME_COLUMN_OPTS, timeColumnOpts };
@@ -60,8 +60,8 @@ export function clearAllOpts() {
return { type: CLEAR_ALL_OPTS };
}
export function setDatasourceClass(datasourceClass) {
return { type: SET_DATASOURCE_CLASS, datasourceClass };
export function setDatasourceType(datasourceType) {
return { type: SET_DATASOURCE_TYPE, datasourceType };
}
export function setFormOpts(datasourceId, datasourceType) {
@@ -94,7 +94,6 @@ export function setFormOpts(datasourceId, datasourceType) {
if (d) timeGrainOpts.push({ value: d, label: d });
});
// Repopulate options for controls
dispatch(setDatasourceClass(data.datasource_class));
dispatch(setTimeColumnOpts(timeColumnOpts));
dispatch(setTimeGrainOpts(timeGrainOpts));
dispatch(setGroupByColumnOpts(groupByColumnOpts));

View File

@@ -17,7 +17,6 @@ const bootstrappedState = Object.assign(initialState, {
datasources: bootstrapData.datasources,
datasourceId: parseInt(bootstrapData.datasource_id, 10),
datasourceType: bootstrapData.datasource_type,
datasourceClass: bootstrapData.datasource_class,
sliceName: bootstrapData.viz.form_data.slice_name,
sliceId: bootstrapData.viz.form_data.slice_id,
vizType: bootstrapData.viz.form_data.viz_type,

View File

@@ -103,8 +103,8 @@ export const exploreReducer = function (state, action) {
[actions.CLEAR_ALL_OPTS]() {
return Object.assign({}, state, defaultOpts);
},
[actions.SET_DATASOURCE_CLASS]() {
return Object.assign({}, state, { datasourceClass: action.datasourceClass });
[actions.SET_DATASOURCE_TYPE]() {
return Object.assign({}, state, { datasourceType: action.datasourceType });
},
};
if (action.type in actionHandlers) {

View File

@@ -2,7 +2,6 @@ export const initialState = {
datasources: null,
datasourceId: null,
datasourceType: null,
datasourceClass: null,
vizType: null,
timeColumnOpts: [],
timeColumn: null,