Skip to content

Commit

Permalink
fix(chart-controls): expose datasource for some controls (#969)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmud authored and zhaoyongjie committed Nov 26, 2021
1 parent 20e8c07 commit 61c2f0d
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ const time_range: SharedControlConfig<'DateFilterControl'> = {
"using the engine's local timezone. Note one can explicitly set the timezone " +
'per the ISO 8601 format if specifying either the start and/or end time.',
),
mapStateToProps: ({ form_data }) => ({
mapStateToProps: ({ datasource, form_data }) => ({
datasource,
endpoints: form_data?.time_range_endpoints || null,
}),
};
Expand Down Expand Up @@ -443,12 +444,13 @@ const adhoc_filters: SharedControlConfig<'AdhocFilterControl'> = {
label: t('Filters'),
default: null,
description: '',
mapStateToProps: ({ datasource }) => ({
mapStateToProps: ({ datasource, form_data }) => ({
columns: datasource?.columns.filter(c => c.filterable) || [],
savedMetrics: datasource?.metrics || [],
// current active adhoc metrics
selectedMetrics: form_data.metrics || (form_data.metric ? [form_data.metric] : []),
datasource,
}),
provideFormDataToProps: true,
};

const color_scheme: SharedControlConfig<'ColorSchemeControl'> = {
Expand Down

0 comments on commit 61c2f0d

Please sign in to comment.