From c7055d7a70685ee0585db31c370f2b59b7022a3e Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Thu, 27 May 2021 06:58:01 -0700 Subject: [PATCH] fixes double click import ledger bug --- src/clj/user.clj | 8 ++++++++ src/cljs/auto_ap/views/pages/ledger/external_import.cljs | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/clj/user.clj b/src/clj/user.clj index 9cc8cb94..e6ded9a6 100644 --- a/src/clj/user.clj +++ b/src/clj/user.clj @@ -377,6 +377,14 @@ '[(= ?ad true)]]} :args [i (d/history (d/db (d/connect uri)))]})))) +(defn entity-history-with-revert [i] + (vec (sort-by first (d/query + {:query {:find ['?tx '?z '?v '?ad ] + :in ['?i '$] + :where ['[?i ?a ?v ?tx ?ad] + '[?a :db/ident ?z]]} + :args [i (d/history (d/db (d/connect uri)))]})))) + (defn tx-detail [i] (map (juxt :e #(d/ident (d/db (d/connect uri)) (:a %)) :v) (:data (first diff --git a/src/cljs/auto_ap/views/pages/ledger/external_import.cljs b/src/cljs/auto_ap/views/pages/ledger/external_import.cljs index 397cfcfc..1bff9894 100644 --- a/src/cljs/auto_ap/views/pages/ledger/external_import.cljs +++ b/src/cljs/auto_ap/views/pages/ledger/external_import.cljs @@ -203,7 +203,8 @@ [:h1.title "Eternal Import"]] [:div.level-right - [:button.button.is-primary.is-pulled-right.is-large {:disabled (not data) + [:button.button.is-primary.is-pulled-right.is-large {:disabled (or (not data) + (= :loading (:state status ))) :on-click (dispatch-event [::importing])} "Import"]]] [status/status-notification {:statuses [[::status/single ::import]]} ] (when result