mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
[explorev2] fix textfield and druid bug (#1732)
* Fixed bug with textfield being empty * Only return time grains for sqla table
This commit is contained in:
parent
abd0974897
commit
76aa9f7e10
@ -96,7 +96,8 @@ export const exploreReducer = function (state, action) {
|
||||
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]);
|
||||
newFormData[action.key] = (action.value !== undefined)
|
||||
? action.value : (!state.viz.form_data[action.key]);
|
||||
return Object.assign(
|
||||
{},
|
||||
state,
|
||||
|
@ -2471,10 +2471,7 @@ class Superset(BaseSupersetView):
|
||||
for s in sorted(datasource.column_names):
|
||||
order_by_choices.append((json.dumps([s, True]), s + ' [asc]'))
|
||||
order_by_choices.append((json.dumps([s, False]), s + ' [desc]'))
|
||||
grains = datasource.database.grains()
|
||||
grain_choices = []
|
||||
if grains:
|
||||
grain_choices = [(grain.name, grain.name) for grain in grains]
|
||||
|
||||
field_options = {
|
||||
'datasource': [(d.id, d.full_name) for d in datasources],
|
||||
'metrics': datasource.metrics_combo,
|
||||
@ -2486,8 +2483,6 @@ class Superset(BaseSupersetView):
|
||||
'all_columns': all_cols,
|
||||
'all_columns_x': all_cols,
|
||||
'all_columns_y': all_cols,
|
||||
'granularity_sqla': [(c, c) for c in datasource.dttm_cols],
|
||||
'time_grain_sqla': grain_choices,
|
||||
'timeseries_limit_metric': [('', '')] + datasource.metrics_combo,
|
||||
'series': gb_cols,
|
||||
'entity': gb_cols,
|
||||
@ -2499,6 +2494,15 @@ class Superset(BaseSupersetView):
|
||||
'filterable_cols': datasource.filterable_column_names,
|
||||
}
|
||||
|
||||
if (datasource_type == 'table'):
|
||||
grains = datasource.database.grains()
|
||||
grain_choices = []
|
||||
if grains:
|
||||
grain_choices = [(grain.name, grain.name) for grain in grains]
|
||||
field_options['granularity_sqla'] = \
|
||||
[(c, c) for c in datasource.dttm_cols]
|
||||
field_options['time_grain_sqla'] = grain_choices
|
||||
|
||||
return Response(
|
||||
json.dumps({'field_options': field_options}),
|
||||
mimetype="application/json"
|
||||
|
Loading…
Reference in New Issue
Block a user