Skip to content

Commit

Permalink
fix: Native time range filter in legacy charts (#23865)
Browse files Browse the repository at this point in the history
  • Loading branch information
kgabryje authored and eschutho committed Jun 15, 2023
1 parent 8a0b66d commit 73d3b7a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ import {
D3_FORMAT_DOCS,
D3_TIME_FORMAT_OPTIONS,
getStandardizedControls,
sections,
} from '@superset-ui/chart-controls';

const config: ControlPanelConfig = {
controlPanelSections: [
sections.legacyRegularTime,
{
label: t('Time'),
expanded: true,
description: t('Time related form attributes'),
controlSetRows: [['granularity_sqla'], ['time_range']],
},
{
label: t('Query'),
expanded: true,
Expand Down
8 changes: 8 additions & 0 deletions superset/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,14 @@ def merge_extra_form_data(form_data: Dict[str, Any]) -> None:
for fltr in append_filters
if fltr
)
if (
form_data.get("time_range")
and not form_data.get("granularity")
and not form_data.get("granularity_sqla")
):
for adhoc_filter in form_data.get("adhoc_filters", []):
if adhoc_filter.get("operator") == "TEMPORAL_RANGE":
adhoc_filter["comparator"] = form_data["time_range"]


def merge_extra_filters(form_data: Dict[str, Any]) -> None:
Expand Down

0 comments on commit 73d3b7a

Please sign in to comment.