Fix logic for hiding details

This commit is contained in:
Saskia Lindner 2017-08-17 16:51:27 +02:00
parent c3ac48cacd
commit b9a83a9908
1 changed files with 6 additions and 10 deletions

View File

@ -149,6 +149,8 @@
(for [{:keys [op-type id operation tags duration] :as trace} showing-traces] (for [{:keys [op-type id operation tags duration] :as trace} showing-traces]
(let [padding {:padding "0px 5px 0px 5px"} (let [padding {:padding "0px 5px 0px 5px"}
row-style (merge padding {:border-top (case op-type :event "1px solid lightgrey" nil)}) row-style (merge padding {:border-top (case op-type :event "1px solid lightgrey" nil)})
show? (get-in @trace-detail-expansions [:overrides id]
(:showing @trace-detail-expansions))
#_#__ (js/console.log (devtools/header-api-call tags))] #_#__ (js/console.log (devtools/header-api-call tags))]
(list [:tr {:key id (list [:tr {:key id
:style {:color (case op-type :style {:color (case op-type
@ -160,13 +162,10 @@
nil)}} nil)}}
[:td {:style (merge row-style {:cursor "pointer"}) [:td {:style (merge row-style {:cursor "pointer"})
:on-click (fn [e] :on-click (fn [e]
(when (:showing @trace-detail-expansions) (when show?
(swap! trace-detail-expansions assoc :showing false)) (swap! trace-detail-expansions assoc-in [:overrides id] true))
(swap! trace-detail-expansions update-in [:overrides id] not))} (swap! trace-detail-expansions update-in [:overrides id] not))}
(if (or (get-in @trace-detail-expansions [:overrides id]) (if show? "▼" "▶")]
(:showing @trace-detail-expansions))
"▼"
"▶")]
[:td {:style row-style} (str op-type)] [:td {:style row-style} (str op-type)]
[:td {:style row-style} (if (= PersistentVector (type (js->clj operation))) [:td {:style row-style} (if (= PersistentVector (type (js->clj operation)))
(second operation) (second operation)
@ -179,13 +178,10 @@
:white-space "nowrap"})} :white-space "nowrap"})}
(.toFixed duration 1) " ms"]] (.toFixed duration 1) " ms"]]
(when (or (get-in @trace-detail-expansions [:overrides id]) (when show?
(:showing @trace-detail-expansions))
[:tr {:key (str id "-details")} [:tr {:key (str id "-details")}
[:td {:col-span 3} (with-out-str (pprint/pprint (dissoc tags :query-v :event :duration)))]])))))) [:td {:col-span 3} (with-out-str (pprint/pprint (dissoc tags :query-v :event :duration)))]]))))))
(defn render-trace-panel [] (defn render-trace-panel []
(let [filter-input (r/atom "") (let [filter-input (r/atom "")
filter-items (r/atom []) filter-items (r/atom [])