Add debug panel

This commit is contained in:
Daniel Compton 2018-01-10 12:29:03 +13:00
parent f4a6c3e9b9
commit 1dfb6373fb
2 changed files with 30 additions and 5 deletions

View File

@ -7,6 +7,7 @@
[day8.re-frame.trace.view.subs :as subs]
[day8.re-frame.trace.view.views :as views]
[day8.re-frame.trace.view.traces :as traces]
[day8.re-frame.trace.view.debug :as debug]
[day8.re-frame.trace.view.settings :as settings]
[garden.core :refer [css style]]
[garden.units :refer [px]]
@ -114,7 +115,8 @@
(tab-button :app-db "app-db")
(tab-button :subs "Subs")
(tab-button :views "Views")
(tab-button :traces "Trace")]]
(tab-button :traces "Trace")
(tab-button :debug "Debug")]]
]])
[rc/line :color "#EEEEEE"]
(when (and external-window? @unloading?)
@ -123,13 +125,14 @@
[:h1.host-closed {:style {:word-wrap "break-word"}} "Tracing is not enabled. Please set " [:pre "{\"re_frame.trace.trace_enabled_QMARK_\" true}"] " in " [:pre ":closure-defines"]])
[rc/v-box
:size "auto"
:style {:margin-left common/gs-19s
:overflow "auto"}
:children [(case @selected-tab
:style {:margin-left common/gs-19s :overflow "auto"}
:children
[(case @selected-tab
:overview [overview/render traces]
:app-db [app-db/render-state db/app-db]
:subs [subs/subs-panel]
:views [views/render]
:traces [traces/render-trace-panel traces]
:debug [debug/render-debug]
:settings [settings/render]
[app-db/render-state db/app-db])]]]))

View File

@ -0,0 +1,22 @@
(ns day8.re-frame.trace.view.debug
(:require [day8.re-frame.trace.utils.re-com :as rc]
[mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
[day8.re-frame.trace.metamorphic :as metam]))
(defn render-debug []
[rc/v-box
:gap "5px"
:children
[
[rc/label :label (str "Number of matches " (prn-str @(rf/subscribe [:epochs/number-of-matches])))]
[rc/label :label (str "Beginning trace " (prn-str @(rf/subscribe [:epochs/beginning-trace-id])))]
[rc/label :label (str "Ending " (prn-str @(rf/subscribe [:epochs/ending-trace-id])))]
[rc/label :label "Matches"]
(for [match (:matches @(rf/subscribe [:epochs/epoch-root]))]
[rc/v-box
:style {:border "1px solid black"}
:children (doall (map (fn [event] [rc/label :label (prn-str event)]) (metam/summarise-match match)))
])
]]
)