Skip to content
Snippets Groups Projects
Commit 740cb70c authored by Tom Robinson's avatar Tom Robinson
Browse files

Fix table rendering when col doesn't have a display_name (SQL, etc). Use 'for' instead of 'map'

parent 6e400d15
No related branches found
No related tags found
No related merge requests found
......@@ -144,20 +144,20 @@
[:table {:style (str "padding-bottom: 8px; border-bottom: 4px solid " color-grey-1 ";")}
[:thead
[:tr
(map (fn [col-idx]
[:th {:style (str bar-td-style bar-th-style "min-width: 60px;")}
(-> cols (nth col-idx) :display_name upper-case h)])
col-indexes)
(if bar-column [:th {:style (str bar-td-style bar-th-style "width: 99%;")}])]]
(for [col-idx col-indexes :let [col (-> cols (nth col-idx))]]
[:th {:style (str bar-td-style bar-th-style "min-width: 60px;")}
(h (upper-case (name (or (:display_name col) (:name col)))))])
(if bar-column
[:th {:style (str bar-td-style bar-th-style "width: 99%;")}])]]
[:tbody
(map-indexed (fn [row-idx row]
[:tr {:style (str "color: " (if (odd? row-idx) color-grey-2 color-grey-3) ";")}
(map (fn [col-idx]
[:td {:style (str bar-td-style (if (and bar-column (= col-idx 1)) "font-weight: 700;"))}
(-> row (nth col-idx) (format-cell (nth cols col-idx )) h)])
col-indexes)
(if bar-column [:td {:style (str bar-td-style "width: 99%;")}
[:div {:style (str "background-color: " color-purple "; height: 20px; width: " (float (* 100 (/ (bar-column row) max-value))) "%")} " "]])])
(for [col-idx col-indexes :let [col (-> cols (nth col-idx))]]
[:td {:style (str bar-td-style (if (and bar-column (= col-idx 1)) "font-weight: 700;"))}
(-> row (nth col-idx) (format-cell col) h)])
(if bar-column
[:td {:style (str bar-td-style "width: 99%;")}
[:div {:style (str "background-color: " color-purple "; height: 20px; width: " (float (* 100 (/ (bar-column row) max-value))) "%")} " "]])])
rows)]]))
(defn render-truncation-warning
......
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