mirror of
https://github.com/status-im/re-frame-10x.git
synced 2025-02-05 10:53:23 +00:00
Set number of retained epochs
This commit is contained in:
parent
c527aed09e
commit
7a863c35c1
@ -11,12 +11,14 @@
|
||||
json-ml-paths (localstorage/get "app-db-json-ml-expansions" #{})
|
||||
external-window? (localstorage/get "external-window?" false)
|
||||
using-trace? (localstorage/get "using-trace?" true)
|
||||
num-epochs (localstorage/get "retained-epochs" 30)
|
||||
categories (localstorage/get "categories" #{:event :sub/run :sub/create :sub/dispose})]
|
||||
(when using-trace?
|
||||
(rf/dispatch [:global/enable-tracing]))
|
||||
(rf/dispatch [:settings/panel-width% panel-width%])
|
||||
(rf/dispatch [:settings/show-panel? show-panel?])
|
||||
(rf/dispatch [:settings/selected-tab selected-tab])
|
||||
(rf/dispatch [:settings/set-number-of-retained-epochs num-epochs])
|
||||
(when external-window?
|
||||
(rf/dispatch [:global/launch-external]))
|
||||
(rf/dispatch [:traces/filter-items filter-items])
|
||||
|
@ -124,6 +124,18 @@
|
||||
(assoc-in [:settings :paused?] false)
|
||||
(assoc-in [:epochs :current-epoch-index] nil))))
|
||||
|
||||
(rf/reg-event-db
|
||||
:settings/set-number-of-retained-epochs
|
||||
[rf/debug]
|
||||
|
||||
(fn [db [_ num-str]]
|
||||
(let [num (js/parseInt num-str)]
|
||||
(if-not (js/isNaN num)
|
||||
(do
|
||||
(localstorage/save! "retained-epochs" num)
|
||||
(assoc-in db [:settings :number-of-epochs] num))
|
||||
db))))
|
||||
|
||||
;; Global
|
||||
|
||||
(defn mount [popup-window popup-document]
|
||||
|
@ -34,6 +34,12 @@
|
||||
(fn [settings _]
|
||||
(:paused? settings)))
|
||||
|
||||
(rf/reg-sub
|
||||
:settings/number-of-retained-epochs
|
||||
:<- [:settings/root]
|
||||
(fn [settings]
|
||||
(:number-of-epochs settings)))
|
||||
|
||||
;; App DB
|
||||
|
||||
(rf/reg-sub
|
||||
|
@ -14,8 +14,6 @@
|
||||
|
||||
;; TODO: START ========== LOCAL DATA - REPLACE WITH SUBS AND EVENTS
|
||||
|
||||
(def retain-epochs (r/atom "99"))
|
||||
|
||||
(def *ignore-items (r/atom [{:id (gensym) :text ":some/event-id"}]))
|
||||
|
||||
(def *filter-items (r/atom [{:id (gensym) :text "re-com.h-box"}
|
||||
@ -93,7 +91,8 @@
|
||||
:style {:margin-left common/gs-12s ;; A bit of a hack, 19px already provided by parent, add 12 to get to 31 as requires by spec
|
||||
:margin-right common/gs-19s}
|
||||
:children [(let [num-epochs @(rf/subscribe [:epochs/number-of-matches])
|
||||
num-traces @(rf/subscribe [:traces/number-of-traces])]
|
||||
num-traces @(rf/subscribe [:traces/number-of-traces])
|
||||
epochs-to-retain @(rf/subscribe [:settings/number-of-retained-epochs])]
|
||||
[settings-box
|
||||
[[rc/h-box
|
||||
:align :center
|
||||
@ -101,12 +100,12 @@
|
||||
:children [[rc/label :label "Retain last"]
|
||||
[rc/input-text
|
||||
:width common/gs-31s
|
||||
:style {:width common/gs-31s ;; TODO: Not needed in standard re-com but caused by :all unset
|
||||
:style {:width "35px" ;; TODO: Not needed in standard re-com but caused by :all unset
|
||||
:height "25px"
|
||||
:padding (css-join "0px" common/gs-5s)}
|
||||
:model retain-epochs
|
||||
:change-on-blur? false
|
||||
:on-change #(reset! retain-epochs %)]
|
||||
:model epochs-to-retain
|
||||
:change-on-blur? true
|
||||
:on-change #(rf/dispatch [:settings/set-number-of-retained-epochs %])]
|
||||
[rc/label :label "epochs"]
|
||||
[rc/gap-f :size common/gs-31s]
|
||||
[rc/button
|
||||
@ -194,6 +193,6 @@
|
||||
:label [rc/v-box
|
||||
:align :center
|
||||
:children ["Factory Reset"]]
|
||||
:on-click #()]]
|
||||
:on-click #(rf/dispatch [:settings/factory-reset])]]
|
||||
[""]
|
||||
settings-box-81]]])
|
||||
|
Loading…
x
Reference in New Issue
Block a user