You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ms...@apache.org on 2026/03/18 14:42:11 UTC
(superset) 01/01: fix(AlertsReports): untie filters from alerts reports tabs flag
This is an automated email from the ASF dual-hosted git repository.
msyavuz pushed a commit to branch msyavuz/fix/alert-report-filters-wo-tabs
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 44a80fdea500b78cd4fb7dcd700c7ae1f0dd1a69
Author: Mehmet Salih Yavuz <sa...@proton.me>
AuthorDate: Wed Mar 18 17:41:30 2026 +0300
fix(AlertsReports): untie filters from alerts reports tabs flag
---
superset/commands/report/execute.py | 24 ++++++++-------
tests/unit_tests/commands/report/execute_test.py | 38 ++++++++++++++++++++++++
2 files changed, 52 insertions(+), 10 deletions(-)
diff --git a/superset/commands/report/execute.py b/superset/commands/report/execute.py
index 11593649815..33906c5e759 100644
--- a/superset/commands/report/execute.py
+++ b/superset/commands/report/execute.py
@@ -79,7 +79,7 @@ from superset.utils.decorators import logs_context, transaction
from superset.utils.pdf import build_pdf_from_screenshots
from superset.utils.screenshots import ChartScreenshot, DashboardScreenshot
from superset.utils.slack import get_channels_with_search, SlackChannelTypes
-from superset.utils.urls import get_url_path
+from superset.utils.urls import get_url_path, modify_url_query
logger = logging.getLogger(__name__)
@@ -295,15 +295,19 @@ class BaseReportState:
dashboard.uuid if dashboard and dashboard.uuid else dashboard.id
)
- return [
- get_url_path(
- "Superset.dashboard",
- user_friendly=user_friendly,
- dashboard_id_or_slug=dashboard_id_or_slug,
- force=force,
- **kwargs,
- )
- ]
+ url = get_url_path(
+ "Superset.dashboard",
+ user_friendly=user_friendly,
+ dashboard_id_or_slug=dashboard_id_or_slug,
+ force=force,
+ **kwargs,
+ )
+
+ native_filter_params = self._report_schedule.get_native_filters_params()
+ if native_filter_params:
+ url = modify_url_query(url, native_filters=native_filter_params)
+
+ return [url]
def _get_tab_url(
self, dashboard_state: DashboardPermalinkState, user_friendly: bool = False
diff --git a/tests/unit_tests/commands/report/execute_test.py b/tests/unit_tests/commands/report/execute_test.py
index b2481be1bb3..61a4bf7ba64 100644
--- a/tests/unit_tests/commands/report/execute_test.py
+++ b/tests/unit_tests/commands/report/execute_test.py
@@ -399,6 +399,44 @@ def test_get_tab_url(
assert result == urllib.parse.urljoin(base_url, "superset/dashboard/p/uri/")
+@with_feature_flags(ALERT_REPORT_TABS=False)
+def test_get_dashboard_urls_native_filters_without_tabs(
+ mocker: MockerFixture,
+ app,
+) -> None:
+ """Native filters should be applied even when ALERT_REPORT_TABS is disabled."""
+ mock_report_schedule: ReportSchedule = mocker.Mock(spec=ReportSchedule)
+ mock_report_schedule.chart = False
+ mock_report_schedule.chart_id = None
+ mock_report_schedule.dashboard_id = 123
+ mock_report_schedule.force_screenshot = False
+ mock_report_schedule.extra = {
+ "dashboard": {
+ "nativeFilters": [
+ {
+ "nativeFilterId": "NATIVE_FILTER-abc",
+ "filterType": "filter_select",
+ "value": ["val1"],
+ }
+ ]
+ }
+ }
+
+ mock_dashboard = mocker.MagicMock()
+ mock_dashboard.uuid = UUID("12345678-1234-1234-1234-123456789abc")
+ mock_report_schedule.dashboard = mock_dashboard
+
+ class_instance: BaseReportState = BaseReportState(
+ mock_report_schedule, "January 1, 2021", "execution_id_example"
+ )
+ class_instance._report_schedule = mock_report_schedule
+
+ result: list[str] = class_instance.get_dashboard_urls()
+
+ assert len(result) == 1
+ assert "native_filters" in result[0]
+
+
def create_report_schedule(
mocker: MockerFixture,
custom_width: int | None = None,