You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by el...@apache.org on 2021/12/21 00:35:04 UTC

[superset] 01/02: fix: Remove positions from json_metadata (#17766)

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

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

commit f4661d6924b50f70cf79acc7ded1ca565537e7f5
Author: Geido <60...@users.noreply.github.com>
AuthorDate: Wed Dec 15 19:32:31 2021 +0100

    fix: Remove positions from json_metadata (#17766)
    
    * Remove positions from json_metadata
    
    * Update superset-frontend/src/dashboard/components/PropertiesModal/index.tsx
    
    Co-authored-by: Kamil Gabryjelski <ka...@gmail.com>
    
    * Indent
    
    Co-authored-by: Kamil Gabryjelski <ka...@gmail.com>
    (cherry picked from commit 274fb37a917e78acd0711b754edf7b833f06911d)
---
 .../src/dashboard/components/PropertiesModal/index.tsx             | 7 ++++++-
 superset/dashboards/dao.py                                         | 3 +++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/superset-frontend/src/dashboard/components/PropertiesModal/index.tsx b/superset-frontend/src/dashboard/components/PropertiesModal/index.tsx
index 7e7ad24..83671d9 100644
--- a/superset-frontend/src/dashboard/components/PropertiesModal/index.tsx
+++ b/superset-frontend/src/dashboard/components/PropertiesModal/index.tsx
@@ -161,10 +161,15 @@ const PropertiesModal = ({
 
       form.setFieldsValue(dashboardInfo);
       setDashboardInfo(dashboardInfo);
-      setJsonMetadata(metadata ? jsonStringify(metadata) : '');
       setOwners(owners);
       setRoles(roles);
       setColorScheme(metadata.color_scheme);
+
+      // temporary fix to remove positions from dashboards' metadata
+      if (metadata?.positions) {
+        delete metadata.positions;
+      }
+      setJsonMetadata(metadata ? jsonStringify(metadata) : '');
     },
     [form],
   );
diff --git a/superset/dashboards/dao.py b/superset/dashboards/dao.py
index 0692789..0443763 100644
--- a/superset/dashboards/dao.py
+++ b/superset/dashboards/dao.py
@@ -239,6 +239,9 @@ class DashboardDAO(BaseDAO):
             }
             md["default_filters"] = json.dumps(applicable_filters)
 
+            # positions have its own column, no need to store it in metadata
+            md.pop("positions", None)
+
         # The css and dashboard_title properties are not part of the metadata
         # TODO (geido): remove by refactoring/deprecating save_dash endpoint
         if data.get("css") is not None: