Move trace count info and clear button to table header

This commit is contained in:
chris (daiyi) 2017-08-01 16:25:52 +02:00
parent c6eac7807a
commit d04a114838
3 changed files with 23 additions and 16 deletions

View File

@ -2,14 +2,14 @@
(defn icon-add []
[:svg.icon.icon-add
{:viewBox "0 0 32 32"}
[:title "add"]
[:path
{:d "M31 12h-11v-11c0-0.552-0.448-1-1-1h-6c-0.552 0-1 0.448-1 1v11h-11c-0.552 0-1 0.448-1 1v6c0 0.552 0.448 1 1 1h11v11c0 0.552 0.448 1 1 1h6c0.552 0 1-0.448 1-1v-11h11c0.552 0 1-0.448 1-1v-6c0-0.552-0.448-1-1-1z"}]])
{:viewBox "0 0 32 32"}
[:title "add"]
[:path
{:d "M31 12h-11v-11c0-0.552-0.448-1-1-1h-6c-0.552 0-1 0.448-1 1v11h-11c-0.552 0-1 0.448-1 1v6c0 0.552 0.448 1 1 1h11v11c0 0.552 0.448 1 1 1h6c0.552 0 1-0.448 1-1v-11h11c0.552 0 1-0.448 1-1v-6c0-0.552-0.448-1-1-1z"}]])
(defn icon-remove []
[:svg.icon.icon-remove
{:viewBox "0 0 32 32"}
[:title "remove"]
[:path
{:d "M31.708 25.708c-0-0-0-0-0-0l-9.708-9.708 9.708-9.708c0-0 0-0 0-0 0.105-0.105 0.18-0.227 0.229-0.357 0.133-0.356 0.057-0.771-0.229-1.057l-4.586-4.586c-0.286-0.286-0.702-0.361-1.057-0.229-0.13 0.048-0.252 0.124-0.357 0.228 0 0-0 0-0 0l-9.708 9.708-9.708-9.708c-0-0-0-0-0-0-0.105-0.104-0.227-0.18-0.357-0.228-0.356-0.133-0.771-0.057-1.057 0.229l-4.586 4.586c-0.286 0.286-0.361 0.702-0.229 1.057 0.049 0.13 0.124 0.252 0.229 0.357 0 0 0 0 0 0l9.708 9.708-9.708 9.708c-0 0-0 0-0 0-0.104 0.105-0.18 0.227-0.229 0.357-0.133 0.355-0.057 0.771 0.229 1.057l4.586 4.586c0.286 0.286 0.702 0.361 1.057 0.229 0.13-0.049 0.252-0.124 0.357-0.229 0-0 0-0 0-0l9.708-9.708 9.708 9.708c0 0 0 0 0 0 0.105 0.105 0.227 0.18 0.357 0.229 0.356 0.133 0.771 0.057 1.057-0.229l4.586-4.586c0.286-0.286 0.362-0.702 0.229-1.057-0.049-0.13-0.124-0.252-0.229-0.357z"}]])
{:viewBox "0 0 32 32"}
[:title "remove"]
[:path
{:d "M31.708 25.708c-0-0-0-0-0-0l-9.708-9.708 9.708-9.708c0-0 0-0 0-0 0.105-0.105 0.18-0.227 0.229-0.357 0.133-0.356 0.057-0.771-0.229-1.057l-4.586-4.586c-0.286-0.286-0.702-0.361-1.057-0.229-0.13 0.048-0.252 0.124-0.357 0.228 0 0-0 0-0 0l-9.708 9.708-9.708-9.708c-0-0-0-0-0-0-0.105-0.104-0.227-0.18-0.357-0.228-0.356-0.133-0.771-0.057-1.057 0.229l-4.586 4.586c-0.286 0.286-0.361 0.702-0.229 1.057 0.049 0.13 0.124 0.252 0.229 0.357 0 0 0 0 0 0l9.708 9.708-9.708 9.708c-0 0-0 0-0 0-0.104 0.105-0.18 0.227-0.229 0.357-0.133 0.355-0.057 0.771 0.229 1.057l4.586 4.586c0.286 0.286 0.702 0.361 1.057 0.229 0.13-0.049 0.252-0.124 0.357-0.229 0-0 0-0 0-0l9.708-9.708 9.708 9.708c0 0 0 0 0 0 0.105 0.105 0.227 0.18 0.357 0.229 0.356 0.133 0.771 0.057 1.057-0.229l4.586-4.586c0.286-0.286 0.362-0.702 0.229-1.057-0.049-0.13-0.124-0.252-0.229-0.357z"}]])

View File

@ -15,6 +15,10 @@
border-radius: 2px;
cursor: pointer;
}
#--re-frame-trace-- .text-button {
border-bottom: 1px dotted #888;
font-weight: normal;
}
#--re-frame-trace-- .icon-button {
vertical-align: middle;
font-size: 10px;

View File

@ -14,8 +14,8 @@
[goog.object :as gob]
[re-frame.interop :as interop]
[devtools.formatters.core :as devtools]
))
[devtools.formatters.core :as devtools]))
(defn comp-name [c]
(let [n (or (component/component-path c)
@ -179,9 +179,6 @@
(filter #(< slower-than-ms-int (:duration %))))
transducers (apply comp (remove nil? [ms-filter op-filter]))
showing-traces (sequence transducers @traces)
filter-msg (if (and (str/blank? @filter-input) (str/blank? @slower-than-ms))
(str "Filter " (count @traces) " events: ")
(str "Filtering " (count showing-traces) " of " (count @traces) " events:"))
padding {:padding "0px 5px 0px 5px"}
save-query (fn [_]
(swap! filter-items conj {:id (random-uuid)
@ -189,7 +186,6 @@
:filter-type @filter-type}))]
[:div
{:style {:padding "10px"}}
[:span filter-msg "(" [:button.text-button {:on-click #(do (trace/reset-tracing!) (reset! traces []))} " Clear"] ")"] [:br]
[:span
[:select {:value @filter-type :on-change (fn [e]
(reset! filter-type (.. e -target -value))
@ -216,8 +212,15 @@
[:table
{:cell-spacing "0" :width "100%"}
[:thead>tr
[:th "operation"]
[:th "event"]
[:th "operations"]
[:th
(when (pos? (count showing-traces))
(str (count showing-traces) " of "))
(when (pos? (count @traces))
(str (count @traces)))
" events "
(when (pos? (count @traces))
[:span "(" [:button.text-button {:on-click #(do (trace/reset-tracing!) (reset! traces []))} "clear"] ")"])]
[:th "meta"]]
[:tbody (render-traces padding slower-than-bold-int showing-traces)]]]))))