This is an automated email from the ASF dual-hosted git repository. arivero pushed a commit to branch table-time-comparison in repository https://gitbox.apache.org/repos/asf/superset.git
commit 07527fbbced8f9adcc906b05c328c6791c83bbbb Author: Antonio Rivero <[email protected]> AuthorDate: Thu Apr 4 03:45:29 2024 +0200 Table with Time Comparison: - Use Comparison Range label - Fix undefined handling in the label --- superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx | 6 ++++++ .../src/explore/components/controls/ComparisonRangeLabel.tsx | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx index 7778b69ecf..c61b2d6b4b 100644 --- a/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx @@ -405,6 +405,12 @@ const config: ControlPanelConfig = { }, }, ], + [ + { + name: 'comparison_range_label', + config: { type: 'ComparisonRangeLabel' }, + }, + ], [ { name: 'row_limit', diff --git a/superset-frontend/src/explore/components/controls/ComparisonRangeLabel.tsx b/superset-frontend/src/explore/components/controls/ComparisonRangeLabel.tsx index cb5717604e..a3f9993826 100644 --- a/superset-frontend/src/explore/components/controls/ComparisonRangeLabel.tsx +++ b/superset-frontend/src/explore/components/controls/ComparisonRangeLabel.tsx @@ -40,7 +40,7 @@ export const ComparisonRangeLabel = () => { const [labels, setLabels] = useState<string[]>([]); const currentTimeRangeFilters = useSelector<RootState, BinaryAdhocFilter[]>( state => - state.explore.form_data.adhoc_filters.filter( + state.explore.form_data.adhoc_filters?.filter( (adhoc_filter: SimpleAdhocFilter) => adhoc_filter.operator === 'TEMPORAL_RANGE', ), @@ -51,7 +51,7 @@ export const ComparisonRangeLabel = () => { BinaryAdhocFilter[] >( state => - state.explore.form_data.adhoc_custom.filter( + state.explore.form_data.adhoc_custom?.filter( (adhoc_filter: SimpleAdhocFilter) => adhoc_filter.operator === 'TEMPORAL_RANGE', ),
