sadpandajoe commented on code in PR #38591:
URL: https://github.com/apache/superset/pull/38591#discussion_r2997974939


##########
superset-frontend/src/features/reports/ReportModal/actions.ts:
##########
@@ -169,8 +169,9 @@ export const addReport =
         dispatch({ type: ADD_REPORT, json } as AddReportAction);
         dispatch(addSuccessToast(t('The report has been created')));
       })
-      .catch(() => {
+      .catch(err => {
         dispatch(addDangerToast(t('Failed to create report')));
+        throw err;
       });

Review Comment:
   Good catch — updated the PR description to explicitly list the two 
production fixes, including this rethrow change.



##########
tests/unit_tests/commands/report/execute_test.py:
##########
@@ -343,6 +360,230 @@ def test_get_dashboard_urls_with_exporting_dashboard_only(
     assert expected_url == result[0]
 
 
+@patch("superset.commands.report.execute.CreateDashboardPermalinkCommand")
+@with_feature_flags(ALERT_REPORT_TABS=True)
+def test_get_dashboard_urls_with_filters_and_tabs(
+    mock_permalink_cls,
+    mocker: MockerFixture,
+    app,
+) -> None:
+    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.type = "report_type"
+    mock_report_schedule.report_format = "report_format"
+    mock_report_schedule.owners = [1, 2]
+    mock_report_schedule.recipients = []
+    native_filter_rison = "(NATIVE_FILTER-1:(filterType:filter_select))"
+    mock_report_schedule.extra = {
+        "dashboard": {
+            "anchor": json.dumps(["TAB-1", "TAB-2"]),
+            "dataMask": {"NATIVE_FILTER-1": {"filterState": {"value": 
["Sales"]}}},
+            "activeTabs": ["TAB-1", "TAB-2"],
+            "urlParams": None,
+            "nativeFilters": [  # type: ignore[typeddict-unknown-key]
+                {
+                    "nativeFilterId": "NATIVE_FILTER-1",
+                    "filterType": "filter_select",
+                    "columnName": "department",
+                    "filterValues": ["Sales"],
+                }
+            ],
+        }
+    }
+    mock_report_schedule.get_native_filters_params.return_value = 
native_filter_rison  # type: ignore[attr-defined]
+    mock_permalink_cls.return_value.run.side_effect = ["key1", "key2"]
+
+    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()
+
+    import urllib.parse
+
+    base_url = app.config.get("WEBDRIVER_BASEURL", "http://0.0.0.0:8080/";)
+    assert result == [
+        urllib.parse.urljoin(base_url, "superset/dashboard/p/key1/"),
+        urllib.parse.urljoin(base_url, "superset/dashboard/p/key2/"),
+    ]
+    mock_report_schedule.get_native_filters_params.assert_called_once()  # 
type: ignore[attr-defined]
+    assert mock_permalink_cls.call_count == 2
+    for call in mock_permalink_cls.call_args_list:
+        state = call.kwargs["state"]
+        assert state["urlParams"] == [["native_filters", native_filter_rison]]
+    assert mock_permalink_cls.call_args_list[0].kwargs["state"]["anchor"] == 
"TAB-1"
+    assert mock_permalink_cls.call_args_list[1].kwargs["state"]["anchor"] == 
"TAB-2"
+
+
[email protected](
+    reason="BUG: {urlParams: [...], **dashboard_state} overwrites 
native_filters. "
+    "Will pass when execute.py:281-291 is fixed.",
+    strict=False,

Review Comment:
   Fixed in 7a83cb5 — all 3 xfail markers changed to `strict=True`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to