Skip to content

Commit

Permalink
Remove loading overlay from codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
heralden committed Oct 31, 2019
1 parent 5be5f10 commit c0b50ed
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 55 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
:test-paths ["test/cljs"]

:clean-targets ^{:protect false} ["resources/public/js/compiled" "target"
"test/js"]
"out" "test/js"]

:figwheel {:css-dirs ["resources/public/css"]
:server-port 3448}
Expand Down
1 change: 0 additions & 1 deletion src/im_tables/db.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,5 @@
:cache {:summaries {}
:summary {}
:selection {}
:overlay? false
:filters {}
:tree-view {:selection #{}}}})
35 changes: 4 additions & 31 deletions src/im_tables/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -98,24 +98,6 @@
(ocall modal "click"))
{:db (assoc-in db [:cache :modal] nil)}))

(reg-event-db
:show-overlay
(sandbox)
(fn [db [_ loc]]
(assoc-in db [:cache :overlay?] true)))

(reg-event-db
:show-overlay
(sandbox)
(fn [db [_ location value]]
(update-in db location assoc-in [:cache :overlay?] value)))

(reg-event-db
:hide-overlay
(sandbox)
(fn [db [_ loc]]
(assoc-in db [:cache :overlay?] false)))

(defn toggle-into-set [haystack needle]
(if (some #{needle} haystack)
(filter (fn [n] (not= n needle)) haystack)
Expand Down Expand Up @@ -379,9 +361,8 @@
(cond-> {:db (-> db
(update-in [:query :select] move-nth dragged-item dragged-over)
(update-in [:cache] dissoc :dragging-item :dragging-over))}
(not= dragged-item dragged-over) (assoc :dispatch-n
[^:flush-dom [:show-overlay loc]
[:im-tables.main/run-query loc]])))))
(not= dragged-item dragged-over)
(assoc :dispatch [:im-tables.main/run-query loc])))))

;;;;; MANIPULATE QUERY

Expand Down Expand Up @@ -530,18 +511,11 @@
(into {})))

(reg-event-db
:main/initial-query-response
:main/replace-query-response
(sandbox)
(fn [db [_ loc {:keys [start]} response]]
(assoc db :response (update response :results index-map start))))

(reg-event-fx
:main/replace-query-response
(sandbox)
(fn [{db :db} [_ loc {:keys [start]} response]]
{:db (assoc db :response (update response :results index-map start))
:dispatch ^:flush-dom [:hide-overlay loc]}))

(reg-event-db
:main/merge-query-response
(sandbox)
Expand Down Expand Up @@ -570,8 +544,7 @@
{:start start
:size (* limit (get-in db [:settings :buffer]))}))
{:db (assoc-in db [:cache :column-summary] {})
:dispatch-n [^:flush-dom [:show-overlay loc]
[:main/deconstruct loc :force? true]]
:dispatch [:main/deconstruct loc :force? true]
:im-tables/im-operation-chan {:on-success (if merge?
^:flush-dom [:main/merge-query-response loc pagination]
^:flush-dom [:main/replace-query-response loc pagination])
Expand Down
2 changes: 1 addition & 1 deletion src/im_tables/events/boot.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
:response response
:query query)
:dispatch [:main/deconstruct loc]
:im-tables/im-operation-chan {:on-success ^:flush-dom [:main/initial-query-response loc pagination]
:im-tables/im-operation-chan {:on-success ^:flush-dom [:main/replace-query-response loc pagination]
:channel (fetch/table-rows service query {:start start
:size (* limit buffer)})}})))

Expand Down
5 changes: 0 additions & 5 deletions src/im_tables/subs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
(fn [db [_ prefix]]
(get-in db (glue prefix [:query-parts-counts]))))

(reg-sub
:style/overlay?
(fn [db [_ prefix]]
(get-in db (glue prefix [:cache :overlay?]))))

(reg-sub
:summary/item-details
(fn [db [_ loc id]]
Expand Down
15 changes: 0 additions & 15 deletions src/im_tables/views/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@
(def css-transition-group
(reagent/adapt-react-class js/ReactTransitionGroup.CSSTransitionGroup))

(defn table-thinking []
(fn [show?]
[css-transition-group
{:transition-name "fade"
:transition-enter-timeout 50
:transition-leave-timeout 50}
(if show?
[:div.overlay
[:i.fa.fa-cog.fa-spin.fa-4x.fa-fw]])]))

(defn custom-modal []
(fn [loc {:keys [header body footer extra-class]}]
[:div.im-modal
Expand All @@ -42,7 +32,6 @@
(defn main [location]
(let [response (subscribe [:main/query-response location])
pagination (subscribe [:settings/pagination location])
overlay? (subscribe [:style/overlay? location])
modal-markup (subscribe [:modal location])
static? (reagent/atom true)
model (subscribe [:assets/model location])
Expand Down Expand Up @@ -102,7 +91,3 @@

; Only show the modal when the modal subscription has a value
(when @modal-markup [custom-modal location @modal-markup])]))})))

; Cover the app whenever it's thinking
;[table-thinking @overlay?]

2 changes: 1 addition & 1 deletion test/cljs/im_tables/test_utils.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,5 @@
[location im-config & body]
`(run-test-async
(rf/dispatch-sync [:im-tables/load ~location ~im-config])
(wait-for [:main/initial-query-response]
(wait-for [:main/replace-query-response]
~@body)))

0 comments on commit c0b50ed

Please sign in to comment.