          (fn [[name value]]
            (create-field name (display-value value)))
          log-map)])))
+
+(react/defc Failures
+  {:get-initial-state
+   (fn []
+     {:expanded false})
+   :render
+   (fn [{:keys [props state]}]
+     [:div {}
+      (create-field
+        "Failures"
+        (style/create-link {:text (if (:expanded @state) "Hide" "Show")
+                            :onClick #(swap! state assoc :expanded (not (:expanded @state)))}))
+      (when (:expanded @state)
+        [comps/Tree {:start-collapsed? false
+                     :highlight-ends false
+                     :data (prewalk
+                             (fn [elem]
+                               (cond
+                                 ;; reorder map elements to message then causedBy
+                                 (map? elem) (select-keys elem ["message" "causedBy"])
+                                 ;; remove empty causedBy[] arrays - prewalk means this executes after the above
+                                 (= (second elem) []) nil
+                                 :else elem))
+                             (:data props))}])])})
 
 (react/defc CallDetail
   {:get-initial-state

(ns broadfcui.page.workspace.monitor.workflow-details
  (:require
    [dmohs.react :as react]
    [clojure.string :as string]
    [broadfcui.common :as common]
    [broadfcui.common.components :as comps]

              [IODetail {:label "Outputs" :data (data "outputs")}]
              (create-field "stdout" (display-value (data "stdout") (last (string/split (data "stdout") #"/"))))
              (create-field "stderr" (display-value (data "stderr") (last (string/split (data "stderr") #"/"))))
              (backend-logs data)
              (when-let [failures (data "failures")]
                [Failures {:data failures}])]])
        (:data props)))])})


(defn- render-workflow-detail [workflow raw-data workflow-name submission-id bucketName]
