You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2024/03/22 12:36:07 UTC

(superset) branch 3.1 updated (03d7384b04 -> 06195b53ce)

This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a change to branch 3.1
in repository https://gitbox.apache.org/repos/asf/superset.git


 discard 03d7384b04 fix: Persist query params appended to permalink (#27601)
     new 06195b53ce fix: Persist query params appended to permalink (#27601)

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (03d7384b04)
            \
             N -- N -- N   refs/heads/3.1 (06195b53ce)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 superset/models/dashboard.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


(superset) 01/01: fix: Persist query params appended to permalink (#27601)

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 06195b53ce60d292cf1f4908ed368bc62930fa2d
Author: Kamil Gabryjelski <ka...@gmail.com>
AuthorDate: Fri Mar 22 10:24:31 2024 +0100

    fix: Persist query params appended to permalink (#27601)
---
 superset/models/dashboard.py          |  6 +++---
 superset/views/core.py                |  2 ++
 tests/integration_tests/core_tests.py | 15 +++++++++++++++
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/superset/models/dashboard.py b/superset/models/dashboard.py
index b615d886ee..f5a1b3c061 100644
--- a/superset/models/dashboard.py
+++ b/superset/models/dashboard.py
@@ -320,9 +320,9 @@ class Dashboard(Model, AuditMixinNullable, ImportExportMixin):
     )
     def datasets_trimmed_for_slices(self) -> list[dict[str, Any]]:
         # Verbose but efficient database enumeration of dashboard datasources.
-        slices_by_datasource: dict[tuple[type[BaseDatasource], int], set[Slice]] = (
-            defaultdict(set)
-        )
+        slices_by_datasource: dict[
+            tuple[type[BaseDatasource], int], set[Slice]
+        ] = defaultdict(set)
 
         for slc in self.slices:
             slices_by_datasource[(slc.cls_model, slc.datasource_id)].add(slc)
diff --git a/superset/views/core.py b/superset/views/core.py
index 613ea89b34..dead91cb98 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -891,6 +891,8 @@ class Superset(BaseSupersetView):  # pylint: disable=too-many-public-methods
         if url_params := state.get("urlParams"):
             params = parse.urlencode(url_params)
             url = f"{url}&{params}"
+        if original_params := request.query_string.decode():
+            url = f"{url}&{original_params}"
         if hash_ := state.get("anchor", state.get("hash")):
             url = f"{url}#{hash_}"
         return redirect(url)
diff --git a/tests/integration_tests/core_tests.py b/tests/integration_tests/core_tests.py
index c4a0897332..3698e5f5be 100644
--- a/tests/integration_tests/core_tests.py
+++ b/tests/integration_tests/core_tests.py
@@ -1220,6 +1220,21 @@ class TestCore(SupersetTestCase):
         resp = self.client.get("/superset/sqllab/history/")
         assert resp.status_code == 302
 
+    @mock.patch("superset.views.core.request")
+    @mock.patch(
+        "superset.commands.dashboard.permalink.get.GetDashboardPermalinkCommand.run"
+    )
+    def test_dashboard_permalink(self, get_dashboard_permalink_mock, request_mock):
+        request_mock.query_string = b"standalone=3"
+        get_dashboard_permalink_mock.return_value = {"dashboardId": 1}
+        self.login()
+        resp = self.client.get("superset/dashboard/p/123/")
+
+        expected_url = "/superset/dashboard/1?permalink_key=123&standalone=3"
+
+        self.assertEqual(resp.headers["Location"], expected_url)
+        assert resp.status_code == 302
+
 
 if __name__ == "__main__":
     unittest.main()