Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Enable copying of iframe cards (#64232)

lbrdnke2334d688adf
diff --git a/src/metabase/dashboards/api.clj b/src/metabase/dashboards/api.clj
index 21b63b0722e..239b0d4c198 100644
--- a/src/metabase/dashboards/api.clj
+++ b/src/metabase/dashboards/api.clj
@@ -442,6 +442,9 @@
(:action_id dashboard-card)
nil
+ (some-> dashboard-card :visualization_settings :virtual_card :display #{"iframe"})
+ dashboard-card
+
;; text cards need no manipulation
(some-> dashboard-card :visualization_settings :virtual_card :display #{"text" "heading"})
dashboard-card
diff --git a/test/metabase/dashboards/api_test.clj b/test/metabase/dashboards/api_test.clj
index 5185cfcef3d..72356a2415b 100644
--- a/test/metabase/dashboards/api_test.clj
+++ b/test/metabase/dashboards/api_test.clj
@@ -1679,6 +1679,16 @@
:text "keep me!"}}
{:action_id 123}]]
(is (= (butlast dashcards)
+ (api.dashboard/update-cards-for-copy dashcards
+ {1 {:id 1}}
+ nil
+ nil)))))
+ (testing "Copies iframe cards"
+ (let [dashcards [{:card_id 1 :card {:id 1}}
+ {:visualization_settings
+ {:virtual_card {:display "iframe"}
+ :iframe "<iframe src=\"https://www.youtube.com/embed/dQw4w9WgXcQ\" />"}}]]
+ (is (= dashcards
(api.dashboard/update-cards-for-copy dashcards
{1 {:id 1}}
nil