diff --git a/caravel/assets/javascripts/explorev2/actions/exploreActions.js b/caravel/assets/javascripts/explorev2/actions/exploreActions.js index e5e5c33eb4..11cd7ae987 100644 --- a/caravel/assets/javascripts/explorev2/actions/exploreActions.js +++ b/caravel/assets/javascripts/explorev2/actions/exploreActions.js @@ -29,6 +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 function setTimeColumnOpts(timeColumnOpts) { return { type: SET_TIME_COLUMN_OPTS, timeColumnOpts }; @@ -59,6 +60,10 @@ export function clearAllOpts() { return { type: CLEAR_ALL_OPTS }; } +export function setDatasourceClass(datasourceClass) { + return { type: SET_DATASOURCE_CLASS, datasourceClass }; +} + export function setFormOpts(datasourceId, datasourceType) { return function (dispatch) { const timeColumnOpts = []; @@ -73,7 +78,7 @@ export function setFormOpts(datasourceId, datasourceType) { $.get(url, (data, status) => { if (status === 'success') { - data.dttm_cols.forEach((d) => { + data.time_columns.forEach((d) => { if (d) timeColumnOpts.push({ value: d, label: d }); }); data.groupby_cols.forEach((d) => { @@ -89,6 +94,7 @@ 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)); diff --git a/caravel/assets/javascripts/explorev2/components/TimeFilter.jsx b/caravel/assets/javascripts/explorev2/components/TimeFilter.jsx index 2cbf7afede..dfcbd4041d 100644 --- a/caravel/assets/javascripts/explorev2/components/TimeFilter.jsx +++ b/caravel/assets/javascripts/explorev2/components/TimeFilter.jsx @@ -7,6 +7,7 @@ import { sinceOptions, untilOptions } from '../constants'; const propTypes = { actions: React.PropTypes.object, + datasourceClass: React.PropTypes.string, timeColumnOpts: React.PropTypes.array, timeColumn: React.PropTypes.string, timeGrainOpts: React.PropTypes.array, @@ -42,16 +43,20 @@ class TimeFilter extends React.Component { this.props.actions.setUntil(val); } render() { + const timeColumnPlaceHolder = + (this.props.datasourceClass === 'SqlaTable') ? 'Time Column' : 'Time Granularity'; + const timeGrainPlaceHolder = + (this.props.datasourceClass === 'SqlaTable') ? 'Time Grain' : 'Origin'; return (