diff --git a/src/client/controller.cljs b/src/client/controller.cljs index 7e3821f..8dc7ee6 100644 --- a/src/client/controller.cljs +++ b/src/client/controller.cljs @@ -181,7 +181,7 @@ (fn [{:keys [db]} [folder log-folder]] (let [paths (distinct (conj (:prev-paths db) folder))] (storage/set-item! "cosim-paths" (pr-str paths)) - (merge {:db (assoc db :prev-paths paths :plot-config-changed? false)} + (merge {:db (assoc db :prev-paths paths :plot-config-changed? false :log-dir (or log-folder ""))} (socket-command ["load" folder (or log-folder "")]))))) (k/reg-event-fx ::delete-prev diff --git a/src/client/core.cljs b/src/client/core.cljs index b14d32f..829d919 100644 --- a/src/client/core.cljs +++ b/src/client/core.cljs @@ -86,6 +86,11 @@ (rf/reg-sub :time simulation-time) (rf/reg-sub :loading? (comp :loading :state)) (rf/reg-sub :loaded? (comp :loaded :state)) +(rf/reg-sub :loaded-dir (fn [db] + (-> db :state :configDir))) +(rf/reg-sub :log-dir (fn [db] + (:log-dir db))) +(rf/reg-sub :overview status-data) (rf/reg-sub :prev-paths (fn [db] (:prev-paths db))) (rf/reg-sub :status (comp :status :state)) diff --git a/src/client/view.cljs b/src/client/view.cljs index bdf6222..70a6f8b 100644 --- a/src/client/view.cljs +++ b/src/client/view.cljs @@ -330,6 +330,8 @@ (defn root-comp [] (let [socket-state (rf/subscribe [:kee-frame.websocket/state socket-url]) loaded? (rf/subscribe [:loaded?]) + load-dir (rf/subscribe [:loaded-dir]) + log-dir (rf/subscribe [:log-dir]) status (rf/subscribe [:status]) module (rf/subscribe [:current-module]) trends (rf/subscribe [:trend-info]) @@ -357,6 +359,8 @@ [:a.item {:on-click #(rf/dispatch [::controller/play])} "Play"]) (when (and @loaded? (= @status "play")) [:a.item {:on-click #(rf/dispatch [::controller/pause])} "Pause"]) + (when @loaded? + [:a.item {:on-click #(rf/dispatch [::controller/load @load-dir @log-dir])} "Reset"]) [:div.ui.simple.dropdown.item [:i.question.circle.icon] [:div.menu