Skip to content

Commit

Permalink
#146 First version, force reload of a configuration when reset is pre…
Browse files Browse the repository at this point in the history
…ssed.
  • Loading branch information
Ćésar Carvalho committed May 26, 2020
1 parent 106b63d commit d4ea766
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/client/controller.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/client/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 4 additions & 0 deletions src/client/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d4ea766

Please sign in to comment.