You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/07/06 23:57:32 UTC

[GitHub] [superset] ktmud commented on a diff in pull request #20632: feat(dashboard): make permalinks stable

ktmud commented on code in PR #20632:
URL: https://github.com/apache/superset/pull/20632#discussion_r915339557


##########
superset/dashboards/permalink/commands/create.py:
##########
@@ -40,21 +53,28 @@ def __init__(
         self.dashboard_id = dashboard_id
         self.state = state
 
+    @property
+    def value(self) -> DashboardPermalinkValue:
+        return {
+            "dashboardId": self.dashboard_id,
+            "state": self.state,
+        }
+
+    @property
+    def signature(self) -> Tuple[Optional[int], DashboardPermalinkValue]:
+        return (get_owner_id(self.actor), self.value)
+
     def run(self) -> str:
         self.validate()
         try:
             DashboardDAO.get_by_id_or_slug(self.dashboard_id)
-            value = {
-                "dashboardId": self.dashboard_id,
-                "state": self.state,
-            }
-            key = CreateKeyValueCommand(
+            key = UpsertKeyValueCommand(
+                key=get_deterministic_uuid(self.salt, self.signature),

Review Comment:
   Theoretically the uuid3 would never collide with another uuid3, but there is an extremely small chance of colliding with a uuid4. Once we change the Explore permalink to this deterministic id, too, this should not be a concern.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org