Skip to content
Snippets Groups Projects
Commit 8d9a9d4c authored by Lewis Liu's avatar Lewis Liu
Browse files

Using when over if, fixed indentation

parent 72da119e
Branches
Tags
No related merge requests found
......@@ -400,37 +400,38 @@
"Render a single CARD for a `Pulse`. DATA is the `:data` from QP results (I think)."
[card result]
(try
(if (:error result) (throw (Exception. "Card has errors")))
(when (:error result)
(throw (Exception. "Card has errors")))
(let [data (:data result)]
[:a {:href (card-href card)
:target "_blank"
:style (style section-style
{:margin :16px
:margin-bottom :16px
:display :block
:text-decoration :none})}
(when *include-title*
[:table {:style (style {:margin-bottom :8px
:width :100%})}
[:tbody
[:tr
[:td [:span {:style header-style}
(-> card :name h)]]
[:td {:style (style {:text-align :right})}
(when *include-buttons*
[:img {:style (style {:width :16px})
:width 16
:src (render-image-with-filename "frontend_client/app/img/external_link.png")}])]]]])
(case (detect-pulse-card-type card data)
:empty (render:empty card data)
:scalar (render:scalar card data)
:sparkline (render:sparkline card data)
:bar (render:bar card data)
:table (render:table card data)
[:div {:style (style font-style
{:color "#F9D45C"
:font-weight 700})}
"We were unable to display this card." [:br] "Please view this card in Metabase."])])
[:a {:href (card-href card)
:target "_blank"
:style (style section-style
{:margin :16px
:margin-bottom :16px
:display :block
:text-decoration :none})}
(when *include-title*
[:table {:style (style {:margin-bottom :8px
:width :100%})}
[:tbody
[:tr
[:td [:span {:style header-style}
(-> card :name h)]]
[:td {:style (style {:text-align :right})}
(when *include-buttons*
[:img {:style (style {:width :16px})
:width 16
:src (render-image-with-filename "frontend_client/app/img/external_link.png")}])]]]])
(case (detect-pulse-card-type card data)
:empty (render:empty card data)
:scalar (render:scalar card data)
:sparkline (render:sparkline card data)
:bar (render:bar card data)
:table (render:table card data)
[:div {:style (style font-style
{:color "#F9D45C"
:font-weight 700})}
"We were unable to display this card." [:br] "Please view this card in Metabase."])])
(catch Throwable e
(log/warn "Pulse card render error:" e)
[:div {:style (style font-style
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment