mirror of
https://github.com/status-im/re-frame-10x.git
synced 2025-02-10 13:06:35 +00:00
Merge branch 'master' into feature/extend-filter
This commit is contained in:
commit
45a58550be
@ -144,11 +144,13 @@
|
|||||||
(fn [trace]
|
(fn [trace]
|
||||||
(< (:query query) (:duration trace)))))
|
(< (:query query) (:duration trace)))))
|
||||||
|
|
||||||
(defn render-traces [showing-traces filter-items]
|
(defn render-traces [showing-traces filter-items trace-detail-expansions]
|
||||||
(doall
|
(doall
|
||||||
(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-row? (get-in @trace-detail-expansions [:overrides id]
|
||||||
|
(:show-all? @trace-detail-expansions))
|
||||||
op-name (if (vector? operation)
|
op-name (if (vector? operation)
|
||||||
(second operation)
|
(second operation)
|
||||||
operation)
|
operation)
|
||||||
@ -158,6 +160,9 @@
|
|||||||
:filter-type :contains}))
|
:filter-type :contains}))
|
||||||
#_#__ (js/console.log (devtools/header-api-call tags))]
|
#_#__ (js/console.log (devtools/header-api-call tags))]
|
||||||
(list [:tr {:key id
|
(list [:tr {:key id
|
||||||
|
:on-click (fn [ev]
|
||||||
|
(swap! trace-detail-expansions update-in [:overrides id]
|
||||||
|
#(if show-row? false (not %))))
|
||||||
:style {:color (case op-type
|
:style {:color (case op-type
|
||||||
:sub/create "green"
|
:sub/create "green"
|
||||||
:sub/run "#fd701e"
|
:sub/run "#fd701e"
|
||||||
@ -165,6 +170,8 @@
|
|||||||
:render "purple"
|
:render "purple"
|
||||||
:re-frame.router/fsm-trigger "#fd701e"
|
:re-frame.router/fsm-trigger "#fd701e"
|
||||||
nil)}}
|
nil)}}
|
||||||
|
[:td {:style row-style}
|
||||||
|
[:button (if show-row? "▼" "▶")]]
|
||||||
[:td {:style row-style
|
[:td {:style row-style
|
||||||
:on-click #(save-query op-type)}
|
:on-click #(save-query op-type)}
|
||||||
[:div.op-string
|
[:div.op-string
|
||||||
@ -181,7 +188,7 @@
|
|||||||
:white-space "nowrap"})}
|
:white-space "nowrap"})}
|
||||||
|
|
||||||
(.toFixed duration 1) " ms"]]
|
(.toFixed duration 1) " ms"]]
|
||||||
(when true
|
(when show-row?
|
||||||
[: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)))]]))))))
|
||||||
|
|
||||||
@ -189,7 +196,8 @@
|
|||||||
(let [filter-input (r/atom "")
|
(let [filter-input (r/atom "")
|
||||||
filter-items (r/atom [])
|
filter-items (r/atom [])
|
||||||
filter-type (r/atom :contains)
|
filter-type (r/atom :contains)
|
||||||
input-error (r/atom false)]
|
input-error (r/atom false)
|
||||||
|
trace-detail-expansions (r/atom {:show-all? false :overrides {}})]
|
||||||
(fn []
|
(fn []
|
||||||
(let [showing-traces (if (= @filter-items [])
|
(let [showing-traces (if (= @filter-items [])
|
||||||
@traces
|
@traces
|
||||||
@ -234,6 +242,14 @@
|
|||||||
[:table
|
[:table
|
||||||
{:cell-spacing "0" :width "100%"}
|
{:cell-spacing "0" :width "100%"}
|
||||||
[:thead>tr
|
[:thead>tr
|
||||||
|
[:th [:button.text-button
|
||||||
|
{:style {:cursor "pointer"}
|
||||||
|
:on-click (fn [ev]
|
||||||
|
;; Always reset expansions
|
||||||
|
(swap! trace-detail-expansions assoc :overrides {})
|
||||||
|
;; Then toggle :show-all?
|
||||||
|
(swap! trace-detail-expansions update :show-all? not))}
|
||||||
|
(if (:show-all? @trace-detail-expansions) "-" "+")]]
|
||||||
[:th "operations"]
|
[:th "operations"]
|
||||||
[:th
|
[:th
|
||||||
(when (pos? (count @filter-items))
|
(when (pos? (count @filter-items))
|
||||||
@ -244,7 +260,7 @@
|
|||||||
(when (pos? (count @traces))
|
(when (pos? (count @traces))
|
||||||
[:span "(" [:button.text-button {:on-click #(do (trace/reset-tracing!) (reset! traces []))} "clear"] ")"])]
|
[:span "(" [:button.text-button {:on-click #(do (trace/reset-tracing!) (reset! traces []))} "clear"] ")"])]
|
||||||
[:th "meta"]]
|
[:th "meta"]]
|
||||||
[:tbody (render-traces showing-traces filter-items)]]]]))))
|
[:tbody (render-traces showing-traces filter-items trace-detail-expansions)]]]]))))
|
||||||
|
|
||||||
(defn resizer-style [draggable-area]
|
(defn resizer-style [draggable-area]
|
||||||
{:position "absolute" :z-index 2 :opacity 0
|
{:position "absolute" :z-index 2 :opacity 0
|
||||||
|
@ -9,6 +9,11 @@
|
|||||||
#--re-frame-trace-- tbody {
|
#--re-frame-trace-- tbody {
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
}
|
}
|
||||||
|
#--re-frame-trace-- tr:hover {
|
||||||
|
transition: all 0.1s ease-out;
|
||||||
|
background: aliceblue;
|
||||||
|
filter: brightness(90%);
|
||||||
|
}
|
||||||
#--re-frame-trace-- tr:nth-child(even) {
|
#--re-frame-trace-- tr:nth-child(even) {
|
||||||
background: aliceblue;
|
background: aliceblue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user