Skip to content

Commit

Permalink
Filter ignored events in settings from traces in trace tab
Browse files Browse the repository at this point in the history
  • Loading branch information
MawiraIke authored and superstructor committed Jan 10, 2022
1 parent 0ad2449 commit 199a9e6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/day8/re_frame_10x/panels/traces/subs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,16 @@
::sorted
:<- [::filtered-by-queries]
(fn [traces _]
(sort-by :id traces)))
(sort-by :id traces)))

(rf/reg-sub
::filtered-by-ignored-events
:<- [::sorted]
:<- [::settings.subs/ignored-events]
(fn [[traces ignored-events] _]
(let [ignored-events (->> ignored-events (map :event-id) set)]
;; loop over traces and find events, then remove any events in `ignored events`
(remove (fn [trace]
(let [event? (= :event (:op-type trace))
event-name (when event? (first (get-in trace [:tags :event])))]
(contains? ignored-events event-name))) traces))))
2 changes: 1 addition & 1 deletion src/day8/re_frame_10x/panels/traces/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@
(defn table
[]
(let [ambiance @(rf/subscribe [::settings.subs/ambiance])
traces @(rf/subscribe [::traces.subs/sorted])]
traces @(rf/subscribe [::traces.subs/filtered-by-ignored-events])]
[rc/v-box
:size "1"
:class (table-style ambiance)
Expand Down

0 comments on commit 199a9e6

Please sign in to comment.