diff --git a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/controlPanel.ts index 9071a278eeba..6cdd79162bae 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/controlPanel.ts @@ -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, diff --git a/superset/utils/core.py b/superset/utils/core.py index 22ff3f8be4be..8cf73b84aa3e 100644 --- a/superset/utils/core.py +++ b/superset/utils/core.py @@ -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: