From 96891a5e5c85481f2f875b21185874e86dfac8f6 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 5 Jul 2021 11:35:56 +0200 Subject: [PATCH] :sparkles: Upgraded beicon version --- frontend/deps.edn | 2 +- .../resources/styles/main/partials/modal.scss | 1 - .../src/app/main/ui/dashboard/import.cljs | 11 ++++------ frontend/src/app/worker/export.cljs | 8 +------ frontend/src/app/worker/import.cljs | 21 +++---------------- 5 files changed, 9 insertions(+), 34 deletions(-) diff --git a/frontend/deps.edn b/frontend/deps.edn index 7d8848998..2958789dd 100644 --- a/frontend/deps.edn +++ b/frontend/deps.edn @@ -6,7 +6,7 @@ binaryage/devtools {:mvn/version "RELEASE"} metosin/reitit-core {:mvn/version "0.5.13"} - funcool/beicon {:mvn/version "2021.06.03-0"} + funcool/beicon {:mvn/version "2021.07.05-1"} funcool/okulary {:mvn/version "2020.04.14-0"} funcool/potok {:mvn/version "2021.06.07-0"} funcool/rumext {:mvn/version "2021.05.12-1"} diff --git a/frontend/resources/styles/main/partials/modal.scss b/frontend/resources/styles/main/partials/modal.scss index e61ec1423..adb71207f 100644 --- a/frontend/resources/styles/main/partials/modal.scss +++ b/frontend/resources/styles/main/partials/modal.scss @@ -482,7 +482,6 @@ padding-right: 1rem; padding-top: 1rem; padding-bottom: 1rem; - // margin-bottom: 12px; cursor: pointer; user-select: none; diff --git a/frontend/src/app/main/ui/dashboard/import.cljs b/frontend/src/app/main/ui/dashboard/import.cljs index 005ba8789..342bbbaaa 100644 --- a/frontend/src/app/main/ui/dashboard/import.cljs +++ b/frontend/src/app/main/ui/dashboard/import.cljs @@ -22,9 +22,6 @@ (log/set-level! :debug) -(defn rx-delay-emit [ms ob] - (->> ob (rx/mapcat #(rx/delay ms (rx/of %))))) - (defn use-import-file [project-id on-finish-import] (mf/use-callback @@ -78,13 +75,13 @@ (assoc :status :analyze-error)))))) (defn set-analyze-result [files uri data] - (let [exiting-files? (into #{} (->> files (map :file-id) (filter some?))) + (let [existing-files? (into #{} (->> files (map :file-id) (filter some?))) replace-file (fn [file] (if (and (= uri (:uri file) ) (= (:status file) :analyzing)) (->> (:files data) - (remove (comp exiting-files? first) ) + (remove (comp existing-files? first) ) (mapv (fn [[file-id file-data]] (-> file-data (assoc :file-id file-id @@ -204,7 +201,7 @@ (->> (uw/ask-many! {:cmd :analyze-import :files (->> files (mapv :uri))}) - (rx-delay-emit 1000) + (rx/delay-emit 1000) (rx/subs (fn [{:keys [uri data error] :as msg}] (log/debug :msg msg) @@ -219,7 +216,7 @@ {:cmd :import-files :project-id project-id :files files}) - (rx-delay-emit 1000) + (rx/delay-emit 1000) (rx/subs (fn [{:keys [file-id status] :as msg}] (log/debug :msg msg) diff --git a/frontend/src/app/worker/export.cljs b/frontend/src/app/worker/export.cljs index 075b65842..f2fbe1652 100644 --- a/frontend/src/app/worker/export.cljs +++ b/frontend/src/app/worker/export.cljs @@ -19,12 +19,6 @@ [beicon.core :as rx] [cuerdas.core :as str])) -(defn rx-expand - "Recursively projects each source value to an Observable - which is merged in the output Observable." - [f ob] - (.pipe ob (.expand ^js js/rxjsOperators f))) - (defn create-manifest "Creates a manifest entry for the given files" [team-id file-id export-type files] @@ -377,7 +371,7 @@ (let [files {} pending [file-id]] (->> (rx/of [files pending]) - (rx-expand fetch-dependencies) + (rx/expand fetch-dependencies) (rx/last) (rx/map first) (rx/map #(process-export file-id export-type %)))))) diff --git a/frontend/src/app/worker/import.cljs b/frontend/src/app/worker/import.cljs index 79a33129a..c7be805b4 100644 --- a/frontend/src/app/worker/import.cljs +++ b/frontend/src/app/worker/import.cljs @@ -23,21 +23,6 @@ [cuerdas.core :as str] [tubax.core :as tubax])) -;;; TODO: Move to funcool/beicon - -(defn rx-merge-reduce [f seed ob] - (let [current-acc (atom seed)] - (->> (rx/concat - (rx/of seed) - (->> ob - (rx/mapcat #(f @current-acc %)) - (rx/tap #(reset! current-acc %)))) - (rx/last)))) - -(defn rx-skip-last - [n ob] - (.pipe ob (.skipLast js/rxjsOperators (int n)))) - ;; Upload changes batches size (def change-batch-size 100) @@ -297,7 +282,7 @@ (->> (rx/from children) (rx/filter cip/shape?) (rx/skip 1) - (rx-skip-last 1) + (rx/skip-last 1) (rx/mapcat (partial resolve-media file-id)) (rx/reduce (partial process-import-node context) file) (rx/map fb/finish-component)))) @@ -316,7 +301,7 @@ (fn [[page-id page-name]] (->> (get-file context :page page-id) (rx/map (fn [page-data] [page-id page-name page-data]))))) - (rx-merge-reduce (partial import-page context) file)))) + (rx/concat-reduce (partial import-page context) file)))) (defn process-library-colors [context file] @@ -380,7 +365,7 @@ (->> (get-file context :components) (rx/flat-map split-components) - (rx-merge-reduce (partial import-component context) file))) + (rx/concat-reduce (partial import-component context) file))) (rx/of file))) (defn process-file