Skip to content
Snippets Groups Projects
Unverified Commit 2efd8f47 authored by john-metabase's avatar john-metabase Committed by GitHub
Browse files

Fix serdes v2 collection load (#29572)

Fixes import of dashboards in the root/default collection
parent 0387f115
No related branches found
No related tags found
No related merge requests found
...@@ -170,8 +170,10 @@ ...@@ -170,8 +170,10 @@
{:table_id [:t 10] {:table_id [:t 10]
:collection_id [:coll 10] :collection_id [:coll 10]
:creator_id [:u 10]})) :creator_id [:u 10]}))
:dashboard (many-random-fks 100 {} {:collection_id [:coll 100] :dashboard (concat (many-random-fks 100 {} {:collection_id [:coll 100]
:creator_id [:u 10]}) :creator_id [:u 10]})
;; create some root collection dashboards
(many-random-fks 50 {} {:creator_id [:u 10]}))
:dashboard-card (many-random-fks 300 {} {:card_id [:c 100] :dashboard-card (many-random-fks 300 {} {:card_id [:c 100]
:dashboard_id [:d 100]}) :dashboard_id [:d 100]})
:dimension (vec (concat :dimension (vec (concat
...@@ -270,7 +272,7 @@ ...@@ -270,7 +272,7 @@
(reduce +))))) (reduce +)))))
(testing "for dashboards" (testing "for dashboards"
(is (= 100 (->> (io/file dump-dir "collections") (is (= 150 (->> (io/file dump-dir "collections")
collections collections
(map (comp count dir->file-set #(io/file % "dashboards"))) (map (comp count dir->file-set #(io/file % "dashboards")))
(reduce +))))) (reduce +)))))
......
...@@ -495,7 +495,7 @@ ...@@ -495,7 +495,7 @@
[{:keys [collection_id ordered_cards parameters]}] [{:keys [collection_id ordered_cards parameters]}]
(->> (map serdes-deps-dashcard ordered_cards) (->> (map serdes-deps-dashcard ordered_cards)
(reduce set/union) (reduce set/union)
(set/union #{[{:model "Collection" :id collection_id}]}) (set/union (when collection_id #{[{:model "Collection" :id collection_id}]}))
(set/union (serdes/parameters-deps parameters)))) (set/union (serdes/parameters-deps parameters))))
(defmethod serdes/descendants "Dashboard" [_model-name id] (defmethod serdes/descendants "Dashboard" [_model-name id]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment