mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
fix: Native time range filter in legacy charts (#23865)
This commit is contained in:
committed by
Elizabeth Thompson
parent
3c44e6d639
commit
7155dcd5df
@@ -22,12 +22,16 @@ import {
|
|||||||
D3_FORMAT_DOCS,
|
D3_FORMAT_DOCS,
|
||||||
D3_TIME_FORMAT_OPTIONS,
|
D3_TIME_FORMAT_OPTIONS,
|
||||||
getStandardizedControls,
|
getStandardizedControls,
|
||||||
sections,
|
|
||||||
} from '@superset-ui/chart-controls';
|
} from '@superset-ui/chart-controls';
|
||||||
|
|
||||||
const config: ControlPanelConfig = {
|
const config: ControlPanelConfig = {
|
||||||
controlPanelSections: [
|
controlPanelSections: [
|
||||||
sections.legacyRegularTime,
|
{
|
||||||
|
label: t('Time'),
|
||||||
|
expanded: true,
|
||||||
|
description: t('Time related form attributes'),
|
||||||
|
controlSetRows: [['granularity_sqla'], ['time_range']],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: t('Query'),
|
label: t('Query'),
|
||||||
expanded: true,
|
expanded: true,
|
||||||
|
|||||||
@@ -1159,6 +1159,14 @@ def merge_extra_form_data(form_data: Dict[str, Any]) -> None:
|
|||||||
for fltr in append_filters
|
for fltr in append_filters
|
||||||
if fltr
|
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:
|
def merge_extra_filters(form_data: Dict[str, Any]) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user