Bläddra i källkod

HUE-7975 [core] Open newly copied document (type: dashboard) throws error: HTTP ERROR 404

Roohi 7 år sedan
förälder
incheckning
e4540739e2
1 ändrade filer med 5 tillägg och 4 borttagningar
  1. 5 4
      desktop/core/src/desktop/api2.py

+ 5 - 4
desktop/core/src/desktop/api2.py

@@ -406,10 +406,11 @@ def copy_document(request):
       copy_document.save()
       _import_workspace(request.fs, request.user, bundle_or_coordinator)
   elif document.type == 'search-dashboard':
-    copy_data = copy_document.data_dict
-    copy_data['collection']['name'] = name
-    copy_data['collection']['uuid'] = copy_document.uuid
-    copy_document.update_data(copy_data)
+    from dashboard.models import Collection2
+    collection = Collection2(request.user, document=document)
+    collection.data['collection']['label'] = name
+    collection.data['collection']['uuid'] = copy_document.uuid
+    copy_document.update_data({'collection': collection.data['collection']})
     copy_document.save()
   # Keep the document and data in sync
   else: