mirror of
https://github.com/apache/superset.git
synced 2026-04-20 00:24:38 +00:00
fix: Native time range filter in legacy charts (#23865)
This commit is contained in:
committed by
GitHub
parent
ba00dfa584
commit
78833bcc30
@@ -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,
|
||||
|
||||
@@ -1161,6 +1161,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:
|
||||
|
||||
Reference in New Issue
Block a user