Fix reset tracing button

This commit is contained in:
Daniel Compton 2018-01-26 12:22:00 +13:00
parent 17b81ba52c
commit c1e077fa0a
2 changed files with 12 additions and 2 deletions

View File

@ -11,7 +11,8 @@
[day8.re-frame.trace.view.container :as container] [day8.re-frame.trace.view.container :as container]
[day8.re-frame.trace.styles :as styles] [day8.re-frame.trace.styles :as styles]
[clojure.set :as set] [clojure.set :as set]
[day8.re-frame.trace.metamorphic :as metam])) [day8.re-frame.trace.metamorphic :as metam]
[re-frame.trace]))
(defonce traces (r/atom [])) (defonce traces (r/atom []))
(defonce total-traces (r/atom 0)) (defonce total-traces (r/atom 0))
@ -475,6 +476,15 @@
{:db (assoc db :current-epoch-id (last (:match-ids db))) {:db (assoc db :current-epoch-id (last (:match-ids db)))
:dispatch [:settings/pause]}))) :dispatch [:settings/pause]})))
(rf/reg-event-db
:epochs/reset
[(rf/path [:epochs])]
(fn [epochs]
(re-frame.trace/reset-tracing!)
(reset! traces [])
(reset! total-traces 0)
nil))
(rf/reg-event-db (rf/reg-event-db
:traces/update-traces :traces/update-traces
[(rf/path [:traces :all-traces])] [(rf/path [:traces :all-traces])]

View File

@ -171,7 +171,7 @@
(str (count @current-traces))] (str (count @current-traces))]
" traces " " traces "
(when (pos? (count @current-traces)) (when (pos? (count @current-traces))
[:span "(" [:button.text-button {:on-click #(do (trace/reset-tracing!) (reset! current-traces []))} "clear"] ")"])] [:span "(" [:button.text-button {:on-click #(rf/dispatch [:epochs/reset])} "clear"] ")"])]
[:th {:style {:text-align "right"}} "meta"]] [:th {:style {:text-align "right"}} "meta"]]
[:tbody (render-traces visible-traces filter-items filter-input trace-detail-expansions)]]]])))) [:tbody (render-traces visible-traces filter-items filter-input trace-detail-expansions)]]]]))))