Refactored Overview to Event, added Timing panel and hid View panel

This commit is contained in:
Gregg8 2018-01-10 16:34:35 +11:00
parent 841b206778
commit 6dbdd4c8c7
5 changed files with 92 additions and 83 deletions

View File

@ -5,7 +5,7 @@
(defn init-db []
(let [panel-width% (localstorage/get "panel-width-ratio" 0.35)
show-panel? (localstorage/get "show-panel" false)
selected-tab (localstorage/get "selected-tab" :overview)
selected-tab (localstorage/get "selected-tab" :event)
filter-items (localstorage/get "filter-items" [])
app-db-paths (localstorage/get "app-db-paths" '())
json-ml-paths (localstorage/get "app-db-json-ml-expansions" #{})

View File

@ -2,11 +2,12 @@
(:require-macros [day8.re-frame.trace.utils.macros :as macros])
(:require [mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
[re-frame.db :as db]
[day8.re-frame.trace.view.overview :as overview]
[day8.re-frame.trace.view.event :as event]
[day8.re-frame.trace.view.app-db :as app-db]
[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.timing :as timing]
[day8.re-frame.trace.view.debug :as debug]
[day8.re-frame.trace.view.settings :as settings]
[garden.core :refer [css style]]
@ -32,8 +33,7 @@
showing-settings? (= @selected-tab :settings)]
[rc/h-box
:align :center
:children
[(when showing-settings?
:children [(when showing-settings?
[:button {:class "bm-active-button"
:on-click #(rf/dispatch [:settings/toggle-settings])} "Done"])
[:img.nav-icon.noselect
@ -59,8 +59,7 @@
:align :center
:size "auto"
:gap common/gs-12s
:children
[[rc/label :class "bm-title-text" :label "Settings"]]]
:children [[rc/label :class "bm-title-text" :label "Settings"]]]
;; TODO: this line needs to be between Done and other buttons
[rc/gap-f :size common/gs-12s]
[rc/line :size "2px" :color common/sidebar-heading-divider-color]
@ -73,8 +72,7 @@
:align :center
:size "auto"
:gap common/gs-12s
:children
[[:span.arrow {:on-click #(rf/dispatch [:epochs/previous-epoch])} "◀"]
:children [[:span.arrow {:on-click #(rf/dispatch [:epochs/previous-epoch])} "◀"]
[rc/v-box
:size "auto"
:children [[:span.event-header (prn-str current-event)]]]
@ -96,29 +94,25 @@
[rc/h-box
:class "panel-content-top nav"
:style {:padding "0px 19px"}
:children
(settings-header external-window?)]
:children (settings-header external-window?)]
[rc/h-box
:class "panel-content-top nav"
:style {:padding "0px 19px"}
:children
(standard-header external-window?)])
:children (standard-header external-window?)])
(when-not showing-settings?
[rc/h-box
:class "panel-content-tabs"
:justify :between
:children
[[rc/h-box
:children [[rc/h-box
:gap "7px"
:align :center
:children
[(tab-button :overview "Overview")
:children [(tab-button :event "Event")
(tab-button :app-db "app-db")
(tab-button :subs "Subs")
(tab-button :views "Views")
;(tab-button :views "Views")
(tab-button :traces "Trace")
(tab-button :debug "Debug")]]
]])
(tab-button :timing "Timing")
(tab-button :debug "Debug")]]]])
[rc/line :color "#EEEEEE"]
(when (and external-window? @unloading?)
[:h1.host-closed "Host window has closed. Reopen external window to continue tracing."])
@ -127,13 +121,13 @@
[rc/v-box
:size "auto"
:style {:margin-left common/gs-19s :overflow "auto"}
:children
[(case @selected-tab
:overview [overview/render traces]
:children [(case @selected-tab
:event [event/render traces]
:app-db [app-db/render-state db/app-db]
:subs [subs/subs-panel]
:views [views/render]
:traces [traces/render-trace-panel traces]
:timing [timing/render]
:debug [debug/render-debug]
:settings [settings/render]
[app-db/render-state db/app-db])]]]))

View File

@ -0,0 +1,19 @@
(ns day8.re-frame.trace.view.event
(:require [day8.re-frame.trace.utils.re-com :as rc]
[day8.re-frame.trace.metamorphic :as metam]))
(defn render [traces]
[rc/v-box
:padding "12px 0px"
:children [[rc/label :label "Event"]
[rc/label :label "Dispatch Point"]
[rc/label :label "Coeffects"]
[rc/label :label "Effects"]
[rc/label :label "Interceptors"]
[rc/h-box
:children [[:p "Subs Run"] [:p "Created"] [:p "Destroyed"]]]
[:p "Views Rendered"]
[rc/h-box
:children [[:p "Timing"] [:p "Animation Frames"]]]
]])

View File

@ -1,19 +0,0 @@
(ns day8.re-frame.trace.view.overview
(:require [day8.re-frame.trace.utils.re-com :as rc]
[day8.re-frame.trace.metamorphic :as metam]))
(defn render [traces]
[rc/v-box
:children
[[rc/label :label "Event"]
[rc/label :label "Dispatch Point"]
[rc/label :label "Coeffects"]
[rc/label :label "Effects"]
[rc/label :label "Interceptors"]
[rc/h-box
:children [[:p "Subs Run"] [:p "Created"] [:p "Destroyed"]]]
[:p "Views Rendered"]
[rc/h-box
:children [[:p "Timing"] [:p "Animation Frames"]]]
]])

View File

@ -0,0 +1,15 @@
(ns day8.re-frame.trace.view.timing
(:require [clojure.string :as str]
[devtools.prefs]
[devtools.formatters.core]
[day8.re-frame.trace.view.components :as components]
[mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
[mranderson047.reagent.v0v6v0.reagent.core :as r]
[day8.re-frame.trace.utils.re-com :as rc]
[day8.re-frame.trace.common-styles :as common])
(:require-macros [day8.re-frame.trace.utils.macros :as macros]))
(defn render []
[rc/v-box
:padding "12px 0px"
:children [[rc/label :label "Timing panel"]]])